mirror of
https://github.com/apple/pkl.git
synced 2026-07-08 14:05:17 +02:00
Revert configuration cache (#1659)
This reverts the commits that enabled Gradle's configuration cache feature. IMO: this feature is too hard to use. We don't know if a task is valid for the configuration cache until it runs, and it's very hard to tell if something is safe when authoring Gradle code. For example, our publish tasks are currently failing; I don't know how I would fix this without running the publish task again on my dev machine. Also, some of our build scripts become more brittle because of this; for example, see https://github.com/apple/pkl/blob/bb07589eae0b3195a589559a3245cbc12c29b394/build-logic/src/main/kotlin/BuildInfo.kt#L291-L296
This commit is contained in:
@@ -67,35 +67,13 @@ dependencies {
|
||||
stagedWindowsAmd64Executable(executableFile("windows-amd64.exe"))
|
||||
}
|
||||
|
||||
val nativeImageBuildService =
|
||||
gradle.sharedServices.registerIfAbsent(
|
||||
"nativeImageBuildService",
|
||||
NativeImageBuildService::class,
|
||||
) {
|
||||
maxParallelUsages = 1
|
||||
}
|
||||
|
||||
private val nativeImageCommandName =
|
||||
if (buildInfo.os.isWindows) "native-image.cmd" else "native-image"
|
||||
|
||||
private fun NativeImageBuild.configure() {
|
||||
graalSdkLibraryName = buildInfo.libs.findLibrary("graalSdk").get().map { it.module.name }
|
||||
releaseBuild = buildInfo.isReleaseBuild
|
||||
nativeArch = buildInfo.isNativeArch
|
||||
processorDivisor = if (buildInfo.os.isMacOsX && !buildInfo.isCiBuild) 4 else 1
|
||||
buildService = nativeImageBuildService
|
||||
usesService(nativeImageBuildService)
|
||||
}
|
||||
|
||||
private fun NativeImageBuild.amd64() {
|
||||
arch = Architecture.AMD64
|
||||
nativeImageExecutable = "${buildInfo.graalVmAmd64.baseDir}/bin/$nativeImageCommandName"
|
||||
dependsOn(":installGraalVmAmd64")
|
||||
}
|
||||
|
||||
private fun NativeImageBuild.aarch64() {
|
||||
arch = Architecture.AARCH64
|
||||
nativeImageExecutable = "${buildInfo.graalVmAarch64.baseDir}/bin/$nativeImageCommandName"
|
||||
dependsOn(":installGraalVmAarch64")
|
||||
}
|
||||
|
||||
@@ -113,7 +91,6 @@ val macExecutableAmd64 by
|
||||
mainClass = executableSpec.mainClass
|
||||
amd64()
|
||||
setClasspath()
|
||||
configure()
|
||||
}
|
||||
|
||||
val macExecutableAarch64 by
|
||||
@@ -122,7 +99,6 @@ val macExecutableAarch64 by
|
||||
mainClass = executableSpec.mainClass
|
||||
aarch64()
|
||||
setClasspath()
|
||||
configure()
|
||||
}
|
||||
|
||||
val linuxExecutableAmd64 by
|
||||
@@ -131,7 +107,6 @@ val linuxExecutableAmd64 by
|
||||
mainClass = executableSpec.mainClass
|
||||
amd64()
|
||||
setClasspath()
|
||||
configure()
|
||||
}
|
||||
|
||||
val linuxExecutableAarch64 by
|
||||
@@ -140,7 +115,6 @@ val linuxExecutableAarch64 by
|
||||
mainClass = executableSpec.mainClass
|
||||
aarch64()
|
||||
setClasspath()
|
||||
configure()
|
||||
// Ensure compatibility for kernels with page size set to 4k, 16k and 64k
|
||||
// (e.g. Raspberry Pi 5, Asahi Linux)
|
||||
extraNativeImageArgs.add("-H:PageSize=65536")
|
||||
@@ -152,7 +126,6 @@ val alpineExecutableAmd64 by
|
||||
mainClass = executableSpec.mainClass
|
||||
amd64()
|
||||
setClasspath()
|
||||
configure()
|
||||
extraNativeImageArgs.addAll(listOf("--static", "--libc=musl"))
|
||||
}
|
||||
|
||||
@@ -162,7 +135,6 @@ val windowsExecutableAmd64 by
|
||||
mainClass = executableSpec.mainClass
|
||||
amd64()
|
||||
setClasspath()
|
||||
configure()
|
||||
}
|
||||
|
||||
val assembleNative by tasks.existing
|
||||
@@ -171,18 +143,18 @@ val testStartNativeExecutable by tasks.registering {
|
||||
dependsOn(assembleNative)
|
||||
|
||||
// dummy file for up-to-date checking
|
||||
val outputFile = layout.buildDirectory.file("testStartNativeExecutable/output.txt")
|
||||
val outputFile = project.layout.buildDirectory.file("testStartNativeExecutable/output.txt")
|
||||
outputs.file(outputFile)
|
||||
|
||||
val nativeExecutableFile = assembleNative.map { it.outputs.files.singleFile }
|
||||
val execOutput = providers.exec { commandLine(nativeExecutableFile.get(), "--version") }
|
||||
val pklVersion = buildInfo.pklVersionNonUnique
|
||||
val execOutput = providers.exec {
|
||||
commandLine(assembleNative.get().outputs.files.singleFile, "--version")
|
||||
}
|
||||
|
||||
doLast {
|
||||
val outputText = execOutput.standardOutput.asText.get()
|
||||
if (!outputText.contains(pklVersion)) {
|
||||
if (!outputText.contains(buildInfo.pklVersionNonUnique)) {
|
||||
throw GradleException(
|
||||
"Expected version output to contain current version ($pklVersion), but got '$outputText'"
|
||||
"Expected version output to contain current version (${buildInfo.pklVersionNonUnique}), but got '$outputText'"
|
||||
)
|
||||
}
|
||||
outputFile.get().asFile.toPath().apply {
|
||||
@@ -199,10 +171,10 @@ val requiredGlibcVersion: Version = Version.parse("2.17")
|
||||
val checkGlibc by tasks.registering {
|
||||
enabled = buildInfo.os.isLinux && !buildInfo.musl
|
||||
dependsOn(assembleNative)
|
||||
val nativeExecutableFile = assembleNative.map { it.outputs.files.singleFile }
|
||||
val requiredGlibcVersion = requiredGlibcVersion
|
||||
val exec = providers.exec { commandLine("objdump", "-T", nativeExecutableFile.get()) }
|
||||
doLast {
|
||||
val exec = providers.exec {
|
||||
commandLine("objdump", "-T", assembleNative.get().outputs.files.singleFile)
|
||||
}
|
||||
val output = exec.standardOutput.asText.get()
|
||||
val minimumGlibcVersion =
|
||||
output
|
||||
|
||||
Reference in New Issue
Block a user