mirror of
https://github.com/speice-io/polyglot_jni
synced 2024-10-11 07:41:27 -04:00
53 lines
1.3 KiB
Groovy
53 lines
1.3 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
}
|
|
|
|
group = "io.speice"
|
|
version = "1.0.0-SNAPSHOT"
|
|
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
|
|
dependencies {
|
|
// Include the NOP logger to suppress SLF4J warnings on start
|
|
implementation 'org.slf4j:slf4j-nop:+'
|
|
implementation 'org.scijava:native-lib-loader:+'
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:+'
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:+'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
dependsOn "buildPolyglot"
|
|
}
|
|
|
|
tasks.register("buildPolyglot") {
|
|
inputs.files fileTree("$projectDir/src/main/c")
|
|
outputs.file "$buildDir/resources/main/META-INF/lib/linux_64/libpolyglot.so"
|
|
|
|
doLast {
|
|
mkdir(buildDir)
|
|
if ("cmake ..".execute(null, buildDir).waitFor() != 0) {
|
|
throw new GradleException("Unable to configure CMake project");
|
|
}
|
|
if ("cmake --build . --target install --config RelWithDebInfo".execute(null, buildDir).waitFor() != 0) {
|
|
throw new GradleException("Unable to build CMake project");
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register("jarDist", Jar) {
|
|
dependsOn "buildPolyglot"
|
|
|
|
archiveAppendix = "dist"
|
|
manifest {
|
|
attributes(
|
|
"Main-Class": "io.speice.Polyglot"
|
|
)
|
|
}
|
|
|
|
from sourceSets.main.output
|
|
from { configurations.runtimeClasspath.collect { zipTree(it) } }
|
|
} |