Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update builds with d suffix, and JNI hash. #13

Merged
merged 4 commits into from
Dec 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down
4 changes: 1 addition & 3 deletions config.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
35 changes: 25 additions & 10 deletions publish.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.security.MessageDigest

apply plugin: 'maven-publish'

publishing {
Expand All @@ -11,7 +13,7 @@ publishing {
}
}

def pubVersion = "${project.ext.version}-1"
def pubVersion = "${project.ext.version}-2"

def outputsFolder = file("$project.buildDir/outputs")

Expand Down Expand Up @@ -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
}
}

Expand Down