Skip to content

Commit 5dbdbe9

Browse files
committed
fix: downstream native-image builds
- fix: don't exclude svm classes from `cli` jar SVM (SubstrateVM) compile configuration classes must be included within the `cli` jar to prevent downstream `native-image` builds from failing. - fix: include svm exclusions in fatjar config Fat JARs cannot be used with `native-image`, so these classes can still safely be excluded here. Fixes and closes #907 Signed-off-by: Sam Gammon <sam@elide.dev>
1 parent 258eda8 commit 5dbdbe9

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

buildSrc/src/main/kotlin/pklFatJar.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
2+
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -80,6 +80,9 @@ tasks.shadowJar {
8080

8181
configurations = listOf(project.configurations.runtimeClasspath.get())
8282

83+
// not required at runtime / fat JARs can't be used in native-image builds anyway
84+
exclude("org/pkl/cli/svm/**")
85+
8386
exclude("META-INF/maven/**")
8487
exclude("META-INF/upgrade/**")
8588
exclude("META-INF/versions/19/**")

pkl-cli/pkl-cli.gradle.kts

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,7 @@ dependencies {
8181
stagedWindowsAmd64Executable(executableDir("pkl-windows-amd64.exe"))
8282
}
8383

84-
tasks.jar {
85-
manifest { attributes += mapOf("Main-Class" to "org.pkl.cli.Main") }
86-
87-
// not required at runtime
88-
exclude("org/pkl/cli/svm/**")
89-
}
84+
tasks.jar { manifest { attributes += mapOf("Main-Class" to "org.pkl.cli.Main") } }
9085

9186
tasks.javadoc { enabled = false }
9287

@@ -157,7 +152,7 @@ tasks.check { dependsOn(testStartJavaExecutable) }
157152
fun Exec.configureExecutable(
158153
graalVm: BuildInfo.GraalVm,
159154
outputFile: Provider<RegularFile>,
160-
extraArgs: List<String> = listOf()
155+
extraArgs: List<String> = listOf(),
161156
) {
162157
inputs
163158
.files(sourceSets.main.map { it.output })
@@ -240,7 +235,7 @@ val macExecutableAmd64: TaskProvider<Exec> by
240235
dependsOn(":installGraalVmAmd64")
241236
configureExecutable(
242237
buildInfo.graalVmAmd64,
243-
layout.buildDirectory.file("executable/pkl-macos-amd64")
238+
layout.buildDirectory.file("executable/pkl-macos-amd64"),
244239
)
245240
}
246241

@@ -251,7 +246,7 @@ val macExecutableAarch64: TaskProvider<Exec> by
251246
configureExecutable(
252247
buildInfo.graalVmAarch64,
253248
layout.buildDirectory.file("executable/pkl-macos-aarch64"),
254-
listOf("-H:+AllowDeprecatedBuilderClassesOnImageClasspath")
249+
listOf("-H:+AllowDeprecatedBuilderClassesOnImageClasspath"),
255250
)
256251
}
257252

@@ -261,7 +256,7 @@ val linuxExecutableAmd64: TaskProvider<Exec> by
261256
dependsOn(":installGraalVmAmd64")
262257
configureExecutable(
263258
buildInfo.graalVmAmd64,
264-
layout.buildDirectory.file("executable/pkl-linux-amd64")
259+
layout.buildDirectory.file("executable/pkl-linux-amd64"),
265260
)
266261
}
267262

@@ -281,7 +276,7 @@ val linuxExecutableAarch64: TaskProvider<Exec> by
281276
// Ensure compatibility for kernels with page size set to 4k, 16k and 64k
282277
// (e.g. Raspberry Pi 5, Asahi Linux)
283278
"-H:PageSize=65536"
284-
)
279+
),
285280
)
286281
}
287282

@@ -297,7 +292,7 @@ val alpineExecutableAmd64: TaskProvider<Exec> by
297292
configureExecutable(
298293
buildInfo.graalVmAmd64,
299294
layout.buildDirectory.file("executable/pkl-alpine-linux-amd64"),
300-
listOf("--static", "--libc=musl")
295+
listOf("--static", "--libc=musl"),
301296
)
302297
}
303298

@@ -307,7 +302,7 @@ val windowsExecutableAmd64: TaskProvider<Exec> by
307302
configureExecutable(
308303
buildInfo.graalVmAmd64,
309304
layout.buildDirectory.file("executable/pkl-windows-amd64"),
310-
listOf("-Dfile.encoding=UTF-8")
305+
listOf("-Dfile.encoding=UTF-8"),
311306
)
312307
}
313308

0 commit comments

Comments
 (0)