diff --git a/build.gradle b/build.gradle index a15ab72..f77181a 100644 --- a/build.gradle +++ b/build.gradle @@ -195,7 +195,7 @@ if (project.platform == "linux-athena") { def toolchain = null def args = defaultCmakeArgs if (buildType.contains("Shared")) { - args = args + '-DBUILD_SHARED_LIBS=ON' + args = args + '-DBUILD_SHARED_LIBS=ON' + '-DCMAKE_DEBUG_POSTFIX=d' } else { args = args + '-DBUILD_SHARED_LIBS=OFF' } diff --git a/config.gradle b/config.gradle index db6433b..2e4cca0 100644 --- a/config.gradle +++ b/config.gradle @@ -8,9 +8,7 @@ ext.createAllCombined = { list, name, base, type, project, extraclassifier -> duplicatesStrategy = 'exclude' list.each { - it.outputs.files.each { - from project.zipTree(it) - } + from project.zipTree(it.archivePath) dependsOn it } } diff --git a/publish.gradle b/publish.gradle index 90f4e06..d131419 100644 --- a/publish.gradle +++ b/publish.gradle @@ -1,3 +1,5 @@ +import java.security.MessageDigest + apply plugin: 'maven-publish' publishing { @@ -11,7 +13,7 @@ publishing { } } -def pubVersion = "${project.ext.version}-1" +def pubVersion = "${project.ext.version}-2" def outputsFolder = file("$project.buildDir/outputs") @@ -264,17 +266,30 @@ task cppHeadersZip(type: Zip, dependsOn: make) { into '/' } + def directory + def jniFileName + def jniFile + if (!project.platform.startsWith("windows")) { - from(staticBuildDir.resolve("lib").toFile()) { - into project.platformPath - include '*java*.so' - include '*java*.dylib' - } + directory = staticBuildDir.resolve("lib").toFile() + jniFileName = project.platform.startsWith('osx') ? "libopencv_java${libVersion}.dylib" : "libopencv_java${libVersion}.so" + jniFile = new File(directory.absolutePath, "${jniFileName}") } else { - from(staticBuildDir.resolve("lib").resolve("Release").toFile()) { - into project.platformPath - include '*java*.dll' - } + directory = staticBuildDir.resolve("lib").resolve(buildTypeFolder).toFile() + jniFileName = "opencv_java${libVersion}.dll" + jniFile = new File(directory.absolutePath, "${jniFileName}") + } + + def hashFile = new File(directory.absolutePath, "${jniFileName}.hash") + it.outputs.file(hashFile) + it.from(hashFile) { + into project.platformPath + } + it.doFirst { + hashFile.text = MessageDigest.getInstance("MD5").digest(jniFile.bytes).encodeHex().toString() + } + it.from(jniFile) { + into project.platformPath } }