mirror of
https://github.com/apple/pkl.git
synced 2026-04-28 11:17:17 +02:00
Don't install GraalVM for an architecture that can't be built (#452)
This fixes an issue where the build native tasks will try to install GraalVM for an architecture that it can't build.
This commit is contained in:
@@ -135,13 +135,10 @@ tasks.check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Exec.configureExecutable(
|
fun Exec.configureExecutable(
|
||||||
isEnabled: Boolean,
|
|
||||||
graalVm: BuildInfo.GraalVm,
|
graalVm: BuildInfo.GraalVm,
|
||||||
outputFile: Provider<RegularFile>,
|
outputFile: Provider<RegularFile>,
|
||||||
extraArgs: List<String> = listOf()
|
extraArgs: List<String> = listOf()
|
||||||
) {
|
) {
|
||||||
enabled = isEnabled
|
|
||||||
|
|
||||||
inputs.files(sourceSets.main.map { it.output }).withPropertyName("mainSourceSets").withPathSensitivity(PathSensitivity.RELATIVE)
|
inputs.files(sourceSets.main.map { it.output }).withPropertyName("mainSourceSets").withPathSensitivity(PathSensitivity.RELATIVE)
|
||||||
inputs.files(configurations.runtimeClasspath).withPropertyName("runtimeClasspath").withNormalizer(ClasspathNormalizer::class)
|
inputs.files(configurations.runtimeClasspath).withPropertyName("runtimeClasspath").withNormalizer(ClasspathNormalizer::class)
|
||||||
inputs.files(file(graalVm.baseDir).resolve("bin/native-image")).withPropertyName("graalVmNativeImage").withPathSensitivity(PathSensitivity.ABSOLUTE)
|
inputs.files(file(graalVm.baseDir).resolve("bin/native-image")).withPropertyName("graalVmNativeImage").withPathSensitivity(PathSensitivity.ABSOLUTE)
|
||||||
@@ -218,39 +215,48 @@ fun Exec.configureExecutable(
|
|||||||
* Builds the pkl CLI for macOS/amd64.
|
* Builds the pkl CLI for macOS/amd64.
|
||||||
*/
|
*/
|
||||||
val macExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
val macExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
||||||
dependsOn(":installGraalVmAmd64")
|
if (buildInfo.os.isMacOsX) {
|
||||||
configureExecutable(
|
dependsOn(":installGraalVmAmd64")
|
||||||
buildInfo.os.isMacOsX,
|
configureExecutable(
|
||||||
buildInfo.graalVmAmd64,
|
buildInfo.graalVmAmd64,
|
||||||
layout.buildDirectory.file("executable/pkl-macos-amd64")
|
layout.buildDirectory.file("executable/pkl-macos-amd64")
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the pkl CLI for macOS/aarch64.
|
* Builds the pkl CLI for macOS/aarch64.
|
||||||
*/
|
*/
|
||||||
val macExecutableAarch64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
val macExecutableAarch64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
||||||
dependsOn(":installGraalVmAarch64")
|
if (buildInfo.os.isMacOsX) {
|
||||||
configureExecutable(
|
dependsOn(":installGraalVmAarch64")
|
||||||
buildInfo.os.isMacOsX,
|
configureExecutable(
|
||||||
buildInfo.graalVmAarch64,
|
buildInfo.graalVmAarch64,
|
||||||
layout.buildDirectory.file("executable/pkl-macos-aarch64"),
|
layout.buildDirectory.file("executable/pkl-macos-aarch64"),
|
||||||
listOf(
|
listOf(
|
||||||
"-H:+AllowDeprecatedBuilderClassesOnImageClasspath"
|
"-H:+AllowDeprecatedBuilderClassesOnImageClasspath"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
} else {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the pkl CLI for linux/amd64.
|
* Builds the pkl CLI for linux/amd64.
|
||||||
*/
|
*/
|
||||||
val linuxExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
val linuxExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
||||||
dependsOn(":installGraalVmAmd64")
|
if (buildInfo.os.isLinux && buildInfo.arch == "amd64") {
|
||||||
configureExecutable(
|
dependsOn(":installGraalVmAmd64")
|
||||||
buildInfo.os.isLinux && buildInfo.arch == "amd64",
|
configureExecutable(
|
||||||
buildInfo.graalVmAmd64,
|
buildInfo.graalVmAmd64,
|
||||||
layout.buildDirectory.file("executable/pkl-linux-amd64")
|
layout.buildDirectory.file("executable/pkl-linux-amd64")
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,12 +266,15 @@ val linuxExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
|||||||
* ARM instances.
|
* ARM instances.
|
||||||
*/
|
*/
|
||||||
val linuxExecutableAarch64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
val linuxExecutableAarch64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
||||||
dependsOn(":installGraalVmAarch64")
|
if (buildInfo.os.isLinux && buildInfo.arch == "aarch64") {
|
||||||
configureExecutable(
|
dependsOn(":installGraalVmAarch64")
|
||||||
buildInfo.os.isLinux && buildInfo.arch == "aarch64",
|
configureExecutable(
|
||||||
buildInfo.graalVmAarch64,
|
buildInfo.graalVmAarch64,
|
||||||
layout.buildDirectory.file("executable/pkl-linux-aarch64")
|
layout.buildDirectory.file("executable/pkl-linux-aarch64")
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -275,18 +284,21 @@ val linuxExecutableAarch64: TaskProvider<Exec> by tasks.registering(Exec::class)
|
|||||||
* Details: https://www.graalvm.org/22.0/reference-manual/native-image/ARM64/
|
* Details: https://www.graalvm.org/22.0/reference-manual/native-image/ARM64/
|
||||||
*/
|
*/
|
||||||
val alpineExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
val alpineExecutableAmd64: TaskProvider<Exec> by tasks.registering(Exec::class) {
|
||||||
dependsOn(":installGraalVmAmd64")
|
if (buildInfo.os.isLinux && buildInfo.arch == "amd64" && buildInfo.hasMuslToolchain) {
|
||||||
configureExecutable(
|
dependsOn(":installGraalVmAmd64")
|
||||||
buildInfo.os.isLinux && buildInfo.arch == "amd64" && buildInfo.hasMuslToolchain,
|
configureExecutable(
|
||||||
buildInfo.graalVmAmd64,
|
buildInfo.graalVmAmd64,
|
||||||
layout.buildDirectory.file("executable/pkl-alpine-linux-amd64"),
|
layout.buildDirectory.file("executable/pkl-alpine-linux-amd64"),
|
||||||
listOf(
|
listOf(
|
||||||
"--static",
|
"--static",
|
||||||
"--libc=musl",
|
"--libc=musl",
|
||||||
"-H:CCompilerOption=-Wl,-z,stack-size=10485760",
|
"-H:CCompilerOption=-Wl,-z,stack-size=10485760",
|
||||||
"-Dorg.pkl.compat=alpine"
|
"-Dorg.pkl.compat=alpine"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
} else {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.assembleNative {
|
tasks.assembleNative {
|
||||||
|
|||||||
Reference in New Issue
Block a user