Skip to content

Commit 0981b93

Browse files
Update graalvm to v1 (major) (#9393)
* Update graalvm to v1 * Fixup nativeImage build * use JDK 25 for GraalVM --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Yuri Schimke <yuri@schimke.ee>
1 parent 72e9c52 commit 0981b93

3 files changed

Lines changed: 45 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
- uses: graalvm/setup-graalvm@v1
7575
with:
7676
distribution: 'graalvm'
77-
java-version: 21
77+
java-version: 25
7878
github-token: ${{ secrets.GITHUB_TOKEN }}
7979
native-image-job-reports: true
8080

@@ -276,7 +276,7 @@ jobs:
276276
- uses: graalvm/setup-graalvm@v1
277277
with:
278278
distribution: 'graalvm'
279-
java-version: 24
279+
java-version: 25
280280
github-token: ${{ secrets.GITHUB_TOKEN }}
281281
native-image-job-reports: true
282282

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ de-mannodermaus-junit5 = "2.0.1"
2323
dokka = "2.2.0"
2424
eclipse-osgi = "3.24.100"
2525
graalvm = "25.0.2"
26-
graalvm-plugin = "0.11.5"
26+
graalvm-plugin = "1.0.0"
2727
guava = "33.5.0-jre"
2828
hamcrest-library = "3.0"
2929
http-client5 = "5.6"

okcurl/build.gradle.kts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import kotlinx.validation.ApiValidationExtension
22
import okhttp3.buildsupport.testJavaVersion
33
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension
4+
import org.graalvm.buildtools.gradle.tasks.BuildNativeImageTask
45
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
56
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
67
import ru.vyarus.gradle.plugin.animalsniffer.AnimalSnifferExtension
8+
import java.nio.file.Files
79

810
plugins {
911
kotlin("jvm")
@@ -90,6 +92,46 @@ configure<GraalVMExtension> {
9092
} else {
9193
buildArgs("--no-fallback")
9294
}
95+
96+
javaLauncher.set(
97+
javaToolchains.launcherFor {
98+
languageVersion.set(JavaLanguageVersion.of(25))
99+
vendor.set(JvmVendorSpec.GRAAL_VM)
100+
},
101+
)
102+
}
103+
}
104+
}
105+
106+
// https://github.com/gradle/gradle/issues/28583
107+
tasks.named<BuildNativeImageTask>("nativeCompile") {
108+
// Gradle's "Copy" task cannot handle symbolic links, see https://github.com/gradle/gradle/issues/3982. That is why
109+
// links contained in the GraalVM distribution archive get broken during provisioning and are replaced by empty
110+
// files. Address this by recreating the links in the toolchain directory.
111+
val toolchainDir =
112+
options.get().javaLauncher.get().executablePath.asFile.parentFile.run {
113+
if (name == "bin") parentFile else this
114+
}
115+
116+
val toolchainFiles = toolchainDir.walkTopDown().filter { it.isFile }
117+
val emptyFiles = toolchainFiles.filter { it.length() == 0L }
118+
119+
// Find empty toolchain files that are named like other toolchain files and assume these should have been links.
120+
val links =
121+
toolchainFiles.mapNotNull { file ->
122+
emptyFiles.singleOrNull { it != file && it.name == file.name }?.let {
123+
file to it
124+
}
125+
}
126+
127+
// Fix up symbolic links.
128+
links.forEach { (target, link) ->
129+
logger.quiet("Fixing up '$link' to link to '$target'.")
130+
131+
if (link.delete()) {
132+
Files.createSymbolicLink(link.toPath(), target.toPath())
133+
} else {
134+
logger.warn("Unable to delete '$link'.")
93135
}
94136
}
95137
}

0 commit comments

Comments
 (0)