mirror of
https://github.com/apple/pkl.git
synced 2026-03-28 03:51:14 +01:00
Upgrade GraalVM and Truffle, set up multi-JDK testing, bump development Java to 21 (#876)
This updates the GraalVM and Truffle libraries to 2024.1.2. This also updates the build logic to compile Java sources using Java 21, due to some compile-only dependencies within GraalVM/Truffle using class file version 65. However, the produced artifact is still compatible with Java 17. This also changes the Gradle build logic to use toolchains, and to test the Java libraries with JDK 17 and 21. One consequence of this change is that Truffle is no longer shaded within the fat jars. feat: support for jvm21+ toolchain feat: support for gradle toolchains feat: pass -PnativeArch=native to build with -march=native test: multi-jdk testing support test: support for jvm-test-suite plugin test: add tasks to run jpkl eval on multiple jdks test: make jdk exec tests respect multi-jdk flags and ranges fix: remove mrjar classes at >jvm17 from fatjars fix: use jdk21 to run the tests (needed for Unsafe.ensureInitialized) fix: truffle svm dependency is required after graalvm 24.0.0 fix: warnings for gvm flag usage, renamed truffle svm macro fix: build with --add-modules=jdk.unsupported where needed fix: don't use gu tool for modern graalvm versions fix: catch Throwable instead of deprecated-for-removal ThreadDeath chore: buildinfo changes for JVM targets, toolchains chore: enforce testing at exactly jdk21 chore: enforce build tooling at jdk21+ chore: bump graalvm/truffle libs → 24.1.2 chore: toolchains for buildSrc Signed-off-by: Sam Gammon <sam@elide.dev>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -324,7 +324,7 @@ public class EvaluatorImpl implements Evaluator {
|
||||
var error = new ExceptionInInitializerError(pklException);
|
||||
error.setStackTrace(e.getStackTrace());
|
||||
throw new PklBugException(error);
|
||||
} catch (ThreadDeath e) {
|
||||
} catch (Throwable e) {
|
||||
if (e.getClass()
|
||||
.getName()
|
||||
.equals("com.oracle.truffle.polyglot.PolyglotEngineImpl$CancelExecution")) {
|
||||
|
||||
@@ -34,6 +34,18 @@ import org.pkl.core.http.HttpClient
|
||||
import org.pkl.core.project.Project
|
||||
import org.pkl.core.util.IoUtils
|
||||
|
||||
// @TODO: this test fails on JDK 22+, because of an output mismatch
|
||||
private val excludedOnJvm22Plus = listOf(Regex(".*analyzeInvalidHttpModule.*"))
|
||||
|
||||
private fun currentMajorJavaVersion(): Int =
|
||||
System.getProperty("java.version").substringBefore('.').toInt()
|
||||
|
||||
private fun exclusionsForThisJvm(): List<Regex> =
|
||||
when {
|
||||
currentMajorJavaVersion() >= 22 -> excludedOnJvm22Plus
|
||||
else -> emptyList()
|
||||
}
|
||||
|
||||
abstract class AbstractLanguageSnippetTestsEngine : InputOutputTestEngine() {
|
||||
private val lineNumberRegex = Regex("(?m)^(( ║ )*)(\\d+) \\|")
|
||||
private val hiddenExtensionRegex = Regex(".*[.]([^.]*)[.]pkl")
|
||||
@@ -61,6 +73,9 @@ abstract class AbstractLanguageSnippetTestsEngine : InputOutputTestEngine() {
|
||||
if (IoUtils.isWindows()) {
|
||||
addAll(windowsExcludedTests)
|
||||
}
|
||||
|
||||
// on experimental JVM versions, exclude tests which are known to be incompatible
|
||||
addAll(exclusionsForThisJvm())
|
||||
}
|
||||
|
||||
override val inputDir: Path = snippetsDir.resolve("input")
|
||||
@@ -201,7 +216,7 @@ abstract class AbstractNativeLanguageSnippetTestsEngine : AbstractLanguageSnippe
|
||||
Regex(".*/import1b\\.pkl"),
|
||||
// URIs get rendered slightly differently (percent-encoded vs raw)
|
||||
Regex(".*日本語_error\\.pkl"),
|
||||
)
|
||||
) + exclusionsForThisJvm()
|
||||
|
||||
/** Avoid running tests for native binaries when those native binaries have not been built. */
|
||||
override fun discover(
|
||||
|
||||
Reference in New Issue
Block a user