Skip to content

Commit 4ecdabf

Browse files
authored
Upgrade Graal to 24 for AOT builds (#63)
Also, tidy up the part of build.sbt that works out the options to pass on to Graal. I initially wanted to use this occasion to enable COH in Graal, but it seems they were faster than me, they are already way ahead of everyone with 4-byte headers: https://www.graalvm.org/jdk24/reference-manual/native-image/optimizations-and-performance/ObjectHeaderSize/ Nice.
1 parent 4881238 commit 4ecdabf

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

.github/workflows/aot-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
- uses: graalvm/setup-graalvm@v1
1818
with:
19-
java-version: '23'
19+
java-version: '24'
2020
distribution: 'graalvm'
2121
github-token: ${{ secrets.GITHUB_TOKEN }}
2222
native-image-job-reports: 'true'

.github/workflows/aot-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
- uses: graalvm/setup-graalvm@v1
1919
with:
20-
java-version: '23'
20+
java-version: '24'
2121
distribution: 'graalvm'
2222
github-token: ${{ secrets.GITHUB_TOKEN }}
2323
native-image-job-reports: 'true'

build.sbt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ addCommandAlias("fixAll", "scalafixAll; scalafmtAll")
1313
def isDevBuild: Boolean =
1414
sys.env.get("DEV_BUILD").exists(s => s != "0" && s != "false")
1515

16-
lazy val baseGraalOptions = Seq(
16+
lazy val graalOptions = Seq(
1717
// If running on Scala <3.8 and JDK >=24, we need to allow unsafe memory access.
1818
// Otherwise, we get annoying warnings on startup.
1919
// https://github.com/scala/scala3/issues/9013
2020
// Remove this after moving to Scala 3.8
21-
if (scalaV.split('.')(1).toInt < 8) Some("-J--sun-misc-unsafe-memory-access=allow") else None,
21+
if (scalaV.split('.')(1).toInt < 8) Seq("-J--sun-misc-unsafe-memory-access=allow") else Nil,
22+
// Do a fast build if it's a dev build
23+
// For the release build, optimize for size and make a build report
24+
if (isDevBuild) Seq("-Ob") else Seq("-Os", "--emit build-report"),
2225
).flatten
2326

2427
lazy val root = (project in file("."))
@@ -55,6 +58,5 @@ lazy val root = (project in file("."))
5558
Compile / mainClass := Some("eu.neverblink.jelly.cli.App"),
5659
// Do a fast build if it's a dev build
5760
// For the release build, optimize for size and make a build report
58-
graalVMNativeImageOptions := (if (isDevBuild) Seq("-Ob")
59-
else Seq("-Os", "--emit build-report")) ++ baseGraalOptions,
61+
graalVMNativeImageOptions := graalOptions,
6062
)

0 commit comments

Comments
 (0)