mirror of
https://github.com/apple/pkl.git
synced 2026-07-07 13:35:36 +02:00
Only build static executable if musl toolchain is installed (#83)
This improves the development experience for (WSL) Linux users. They can now run "./gradlew buildNative" without having a musl toolchain installed. In this case, only the dynamically linked executable will be built.
This commit is contained in:
@@ -95,6 +95,11 @@ open class BuildInfo(project: Project) {
|
|||||||
java.lang.Boolean.getBoolean("releaseBuild")
|
java.lang.Boolean.getBoolean("releaseBuild")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val hasMuslToolchain: Boolean by lazy {
|
||||||
|
// see "install musl" in .circleci/jobs/BuildNativeJob.pkl
|
||||||
|
File(System.getProperty("user.home"), "staticdeps/bin/x86_64-linux-musl-gcc").exists()
|
||||||
|
}
|
||||||
|
|
||||||
val os: org.gradle.internal.os.OperatingSystem by lazy {
|
val os: org.gradle.internal.os.OperatingSystem by lazy {
|
||||||
org.gradle.internal.os.OperatingSystem.current()
|
org.gradle.internal.os.OperatingSystem.current()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ val linuxExecutableAarch64: TaskProvider<Exec> by tasks.registering(Exec::class)
|
|||||||
*/
|
*/
|
||||||
val alpineExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
val alpineExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
||||||
configureExecutable(
|
configureExecutable(
|
||||||
buildInfo.os.isLinux && buildInfo.arch == "amd64",
|
buildInfo.os.isLinux && buildInfo.arch == "amd64" && buildInfo.hasMuslToolchain,
|
||||||
file("$buildDir/executable/pkl-alpine-linux-amd64"),
|
file("$buildDir/executable/pkl-alpine-linux-amd64"),
|
||||||
listOf(
|
listOf(
|
||||||
"--static",
|
"--static",
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ val testLinuxExecutableAarch64 by tasks.registering(Test::class) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val testAlpineExecutableAmd64 by tasks.registering(Test::class) {
|
val testAlpineExecutableAmd64 by tasks.registering(Test::class) {
|
||||||
enabled = buildInfo.os.isLinux && buildInfo.arch == "amd64"
|
enabled = buildInfo.os.isLinux && buildInfo.arch == "amd64" && buildInfo.hasMuslToolchain
|
||||||
dependsOn(":pkl-cli:alpineExecutableAmd64")
|
dependsOn(":pkl-cli:alpineExecutableAmd64")
|
||||||
|
|
||||||
inputs.dir("src/test/files/LanguageSnippetTests/input")
|
inputs.dir("src/test/files/LanguageSnippetTests/input")
|
||||||
|
|||||||
Reference in New Issue
Block a user