diff --git a/bindings/jni/build.gradle b/bindings/jni/build.gradle index fd9c8807..072f825a 100644 --- a/bindings/jni/build.gradle +++ b/bindings/jni/build.gradle @@ -5,15 +5,24 @@ ################################################################################ */ +buildscript { + configurations.configureEach { + resolutionStrategy { + force 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' + } + exclude group: 'xerces', module: 'xercesImpl' + } +} + plugins { id 'java' id 'maven-publish' - id 'com.jfrog.artifactory' version '4.21.0' + id 'com.jfrog.artifactory' version '5.2.3' id 'com.jfrog.bintray' version '1.8.5' - id 'com.google.osdetector' version '1.7.0' + id 'com.google.osdetector' version '1.7.3' } -wrapper.gradleVersion = '7.5.1' +wrapper.gradleVersion = '8.9' subprojects { apply plugin: 'java' @@ -47,7 +56,6 @@ artifactory { repoKey = 'oss-snapshot-local' username = System.getenv('ARTIFACTORY_USERNAME') password = System.getenv('ARTIFACTORY_PASSWORD') - maven = true } } } diff --git a/bindings/jni/zyre-jni-all/build.gradle b/bindings/jni/zyre-jni-all/build.gradle index 3c06e860..9f7f9554 100644 --- a/bindings/jni/zyre-jni-all/build.gradle +++ b/bindings/jni/zyre-jni-all/build.gradle @@ -47,7 +47,6 @@ artifactoryPublish { publications ('mavenJava') } - bintray { user = System.getenv('BINTRAY_USER') key = System.getenv('BINTRAY_KEY') diff --git a/bindings/jni/zyre-jni-native/build.gradle b/bindings/jni/zyre-jni-native/build.gradle index e629a68e..065ac834 100644 --- a/bindings/jni/zyre-jni-native/build.gradle +++ b/bindings/jni/zyre-jni-native/build.gradle @@ -13,7 +13,7 @@ dependencies { // ------------------------------------------------------------------ // Build section -task copyLibs(type: Copy) { +tasks.register('copyLibs', Copy) { def libraryPaths = [] if (project.hasProperty('buildPrefix')) { if (osdetector.os == 'windows') { @@ -24,7 +24,7 @@ task copyLibs(type: Copy) { } def javaLibraryPaths = System.getProperty('java.library.path').split(File.pathSeparator).toList() - libraryPaths.addAll (javaLibraryPaths) + libraryPaths.addAll(javaLibraryPaths) libraryPaths.add('/usr/local/lib') if (osdetector.os == 'windows') { @@ -54,7 +54,7 @@ task copyLibs(type: Copy) { duplicatesStrategy = oldStrategy } -jar.baseName = "zyre-jni-${osdetector.classifier}" +jar.archiveBaseName = "zyre-jni-${osdetector.classifier}" jar.dependsOn copyLibs jar { diff --git a/bindings/jni/zyre-jni/build.gradle b/bindings/jni/zyre-jni/build.gradle index 63ef34b6..c08e796d 100644 --- a/bindings/jni/zyre-jni/build.gradle +++ b/bindings/jni/zyre-jni/build.gradle @@ -12,15 +12,16 @@ ext.hasNotEmptyProperty = { propertyName -> dependencies { implementation "org.zeromq.czmq:czmq-jni:$jni_dependencies_version" - implementation 'org.scijava:native-lib-loader:2.4.0' - testImplementation 'junit:junit:4.12' - testImplementation 'org.hamcrest:hamcrest-all:1.3' + implementation 'org.scijava:native-lib-loader:2.5.0' + testImplementation 'junit:junit:4.13.2' + testImplementation 'org.hamcrest:hamcrest:2.2' } // ------------------------------------------------------------------ // Build section -task generateJniHeaders(type: Exec, dependsOn: 'classes') { +tasks.register('generateJniHeaders', Exec) { + dependsOn 'classes' def classpath = sourceSets.main.output.classesDirs def appclasspath = configurations.runtimeClasspath.files*.getAbsolutePath().join(File.pathSeparator) def nativeIncludes = 'src/native/include' @@ -34,14 +35,14 @@ task generateJniHeaders(type: Exec, dependsOn: 'classes') { commandLine("javac", "-h", "$nativeIncludes", "-classpath", "$classpath${File.pathSeparator}$appclasspath", *jniClasses, *utilityClasses) } -tasks.withType(Test) { +tasks.withType(Test).configureEach { def defaultJavaLibraryPath = System.getProperty("java.library.path") if (osdetector.os == 'windows') { - def extraJavaLibraryPath = hasNotEmptyProperty('buildPrefix') ? "$project.buildPrefix\\bin;$project.buildPrefix\\lib" : '' - extraJavaLibraryPath = extraJavaLibraryPath.replace("/", "\\") - systemProperty "java.library.path", "${projectDir}\\build\\Release${File.pathSeparator}" + - "${extraJavaLibraryPath}${File.pathSeparator}" + - "${defaultJavaLibraryPath}" + def extraJavaLibraryPath = hasNotEmptyProperty('buildPrefix') ? "$project.buildPrefix\\bin;$project.buildPrefix\\lib" : '' + extraJavaLibraryPath = extraJavaLibraryPath.replace("/", "\\") + systemProperty "java.library.path", "${projectDir}\\build\\Release${File.pathSeparator}" + + "${extraJavaLibraryPath}${File.pathSeparator}" + + "${defaultJavaLibraryPath}" } else { def extraJavaLibraryPath = hasNotEmptyProperty('buildPrefix') ? "$project.buildPrefix/lib" : '' systemProperty "java.library.path", "${projectDir}/build${File.pathSeparator}" + @@ -52,22 +53,24 @@ tasks.withType(Test) { } } -task initCMake(type: Exec, dependsOn: 'generateJniHeaders') { - workingDir 'build' +tasks.register('initCMake', Exec) { + dependsOn 'generateJniHeaders' + workingDir 'build' def prefixPath = hasNotEmptyProperty('buildPrefix') ? "-DCMAKE_PREFIX_PATH=$project.buildPrefix" : '' commandLine 'cmake', "$prefixPath", '..' } -task buildNative(type: Exec, dependsOn: 'initCMake') { +tasks.register('buildNative', Exec) { + dependsOn 'initCMake' if (osdetector.os == 'windows') { commandLine 'cmake', - '--build', 'build', + '--build', 'build', '--config', 'Release', '--target', 'zyrejni', - '--', '-verbosity:Minimal', '-maxcpucount' + '--', '-verbosity:Minimal', '-maxcpucount' } else { commandLine 'cmake', - '--build', 'build' + '--build', 'build' } } @@ -77,13 +80,15 @@ test.dependsOn buildNative // ------------------------------------------------------------------ // Install and Publish section -task sourcesJar(type: Jar, dependsOn: 'classes') { - classifier = 'sources' +tasks.register('sourcesJar', Jar) { + dependsOn 'classes' + archiveClassifier = 'sources' from sourceSets.main.allSource } -task javadocJar(type: Jar, dependsOn: 'javadoc') { - classifier = 'javadoc' +tasks.register('javadocJar', Jar) { + dependsOn 'javadoc' + archiveClassifier = 'javadoc' from javadoc.destinationDir } @@ -119,7 +124,6 @@ artifactoryPublish { publications ('mavenJava') } - bintray { user = System.getenv('BINTRAY_USER') key = System.getenv('BINTRAY_KEY')