secp256k1-kmp/jni/jvm/build.gradle.kts
Salomon BRYS 6c850eb2c4
Native jni build (#5)
* Each native library is in its own jar. Got rid of cross compilation. The project is `secp256k1` and not `secp256k1-kmp`.

* Updated CI to use all 3 OS VMs

Co-authored-by: Salomon BRYS <salomon@kodein.net>
2020-07-09 14:54:34 +02:00

48 lines
1.1 KiB
Plaintext

plugins {
kotlin("jvm")
`maven-publish`
}
val currentOs = org.gradle.internal.os.OperatingSystem.current()
val bash = if (currentOs.isWindows) "bash.exe" else "bash"
val buildNativeHost by tasks.creating(Exec::class) {
group = "build"
dependsOn(":jni:generateHeaders")
dependsOn(":native:buildSecp256k1Host")
val target = when {
currentOs.isLinux -> "linux"
currentOs.isMacOsX -> "darwin"
currentOs.isWindows -> "mingw"
else -> error("Unsupported OS $currentOs")
}
inputs.files(projectDir.resolve("build.sh"))
outputs.dir(buildDir.resolve(target))
workingDir = projectDir
environment("TARGET", target)
commandLine(bash, "build.sh")
}
dependencies {
api(project(":jni"))
implementation(kotlin("stdlib-jdk8"))
}
publishing {
publications {
create<MavenPublication>("jvm") {
artifactId = "secp256k1-jni-jvm-extract"
from(components["java"])
}
}
}
afterEvaluate {
tasks["clean"].doLast {
delete("$buildDir/build/cmake")
}
}