// The platform-free half, compiled for the host JVM: its unit tests load the JNI layer over a // host build of libwai (scripts/build-native.sh host writes it to build/native/). import org.jetbrains.kotlin.gradle.dsl.JvmTarget plugins { id("org.jetbrains.kotlin.jvm") } java { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlin { compilerOptions { jvmTarget.set(JvmTarget.JVM_17) allWarningsAsErrors.set(true) } } sourceSets { test { kotlin.srcDir("src/testkit/kotlin") } } dependencies { testImplementation("junit:junit:4.13.2") } val native = layout.buildDirectory.dir("native") tasks.test { val lib = native.get().asFile systemProperty("java.library.path", lib.path) systemProperty("wai.corpus", file("../../live-conformance/native-sink/vectors.json").path) // The integer decode's cases (src/testkit/int-cases.json) name their files relative to wai/. systemProperty("wai.root", file("../..").canonicalPath) inputs.dir(native).withPropertyName("native") inputs.file("../../live-conformance/native-sink/vectors.json").withPropertyName("corpus") outputs.upToDateWhen { false } testLogging { events("passed", "failed", "skipped") exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL showStandardStreams = false } doFirst { require(lib.resolve("libwai_sink_jni.so").exists() || lib.resolve("libwai_sink_jni.dylib").exists()) { "no JNI layer in $lib: run scripts/build-native.sh host first" } } }