Adjust native lifecycle builds to not throw during configuration phase (#1356)

Allow Gradle to run other tasks on unsupported machines, but throw when
running native lifecycle tasks (e.g. `buildNative`).
This commit is contained in:
Daniel Chao
2025-12-07 11:35:14 -08:00
committed by GitHub
parent 139f70bb79
commit 252f44728e

View File

@@ -69,19 +69,15 @@ val assembleNative by
buildInfo.os.isWindows && buildInfo.targetArch == "amd64" -> {
wraps(assembleNativeWindowsAmd64)
}
buildInfo.os.isWindows && buildInfo.targetArch == "aarch64" -> {
logger.warn("Windows Aarch64 is not supported by GraalVM, skipping assembleNative")
}
buildInfo.musl -> {
throw GradleException("Building musl on ${buildInfo.os} is not supported")
}
else -> {
doLast {
throw GradleException(
"Unsupported os/arch pair: ${buildInfo.os.name}/${buildInfo.targetArch}"
"Cannot build targeting ${buildInfo.os.name}/${buildInfo.targetArch} with musl=${buildInfo.musl}"
)
}
}
}
}
val testNative by
tasks.registering {
@@ -109,19 +105,15 @@ val testNative by
buildInfo.os.isWindows && buildInfo.targetArch == "amd64" -> {
dependsOn(testNativeWindowsAmd64)
}
buildInfo.os.isWindows && buildInfo.targetArch == "aarch64" -> {
logger.warn("Windows Aarch64 is not supported by GraalVM, skipping testNative")
}
buildInfo.musl -> {
throw GradleException("Building musl on ${buildInfo.os} is not supported")
}
else -> {
doLast {
throw GradleException(
"Unsupported os/arch pair: ${buildInfo.os.name}/${buildInfo.targetArch}"
"Cannot build targeting ${buildInfo.os.name}/${buildInfo.targetArch} with musl=${buildInfo.musl}"
)
}
}
}
}
val checkNative by
tasks.registering {