Files
pkl/pkl-server/pkl-server.gradle.kts
Daniel Chao 9cc9816440 Fix native tests in CircleCI (#514)
Fix an issue where the CI job attempts to install the wrong executable
when on macOS/aarch64.

Also, adjusts native test definitions in pkl-server to match pkl-core.
2024-06-05 09:05:16 -07:00

86 lines
2.2 KiB
Kotlin

plugins {
pklAllProjects
pklJavaLibrary
pklKotlinLibrary
pklNativeBuild
}
dependencies {
implementation(projects.pklCore)
implementation(libs.msgpack)
implementation(libs.truffleApi)
implementation(libs.antlrRuntime)
testImplementation(projects.pklCommonsTest)
}
tasks.test {
inputs.dir("src/test/files/SnippetTests/input")
.withPropertyName("snippetTestsInput")
.withPathSensitivity(PathSensitivity.RELATIVE)
inputs.dir("src/test/files/SnippetTests/output")
.withPropertyName("snippetTestsOutput")
.withPathSensitivity(PathSensitivity.RELATIVE)
exclude("**/NativeServerTest.*")
}
private fun Test.configureNativeTest() {
testClassesDirs = files(tasks.test.get().testClassesDirs)
classpath = tasks.test.get().classpath
include("**/NativeServerTest.*")
}
val testMacExecutableAarch64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:macExecutableAarch64")
configureNativeTest()
}
val testMacExecutableAmd64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:macExecutableAmd64")
configureNativeTest()
}
val testLinuxExecutableAmd64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:linuxExecutableAmd64")
configureNativeTest()
}
val testLinuxExecutableAarch64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:linuxExecutableAarch64")
configureNativeTest()
}
val testAlpineExecutableAmd64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:alpineExecutableAmd64")
configureNativeTest()
}
val testWindowsExecutableAmd64 by tasks.registering(Test::class) {
dependsOn(":pkl-cli:windowsExecutableAmd64")
configureNativeTest()
}
val testNative by tasks.existing
testNative {
when {
buildInfo.os.isMacOsX -> {
dependsOn(testMacExecutableAmd64)
if (buildInfo.arch == "aarch64") {
dependsOn(testMacExecutableAarch64)
}
}
buildInfo.os.isWindows -> {
dependsOn(testWindowsExecutableAmd64)
}
buildInfo.os.isLinux && buildInfo.arch == "aarch64" -> {
dependsOn(testLinuxExecutableAarch64)
}
buildInfo.os.isLinux && buildInfo.arch == "amd64" -> {
dependsOn(testLinuxExecutableAmd64)
if (buildInfo.hasMuslToolchain) {
dependsOn(testAlpineExecutableAmd64)
}
}
}
}