Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] feat: java/graalvm 21+ support #3

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft

[WIP] feat: java/graalvm 21+ support #3

wants to merge 29 commits into from

Conversation

sgammon
Copy link
Member

@sgammon sgammon commented Jan 6, 2025

Summary

Note: Filed upstream as apple#876

This PR updates dependencies and build process for Pkl to bring GraalVM and Truffle support up to their latest versions; today, Pkl builds against Java 17+, and requires Java 17+ to run.

After merging this PR, Pkl would build against Java 23, test against Java 21, and imply no change to bytecode (i.e. still only requiring Java 17+ to run or transitively compile against Pkl).

Java 21 adds a lot of features, and JPMS enforcement (and related deprecations) are a concern. This PR takes care of those but does not modularize Pkl itself.

Warning

This PR adds Github Actions jobs for building and testing Pkl. These should be rebased away before any contemplated merge; they are here only to exercise tests on this fork.

This PR does not contemplate modularization support for Pkl (JPMS).

Rationale

  • JVM 21 support: Needed for modern Java projects to embed Pkl; needed for modern GraalVM native-image binaries built with embedded Pkl.

  • GVM 23 toolchain: Support for the latest release version of GraalVM and Truffle brings many improvements to the compiler and polyglot implementation

  • JVM 21-pinned test toolchain: Tests run under JVM 21. It's annoying to have two JDKs here, but JDK 23 is best, and JDK 21 is needed for JVM execution of Truffle implementation tests, due to a dependency on sun.misc.Unsafe.ensureInitialized, which was removed in JDK 22.

  • Gradle 8.12: Needed for Gradle to be able to understand class targets as high as 65, which corresponds to JVM 23.

  • Shadow 8.3.5: Necessitated by a plugin ID change (com.github.johnrengelman.shadowcom.gradleup.shadow), to enable support for JVM 21+

  • Truffle SVM Dependency: Certain superclasses used by Pkl (notably, AbstractTruffleException and TruffleFeature) have moved to the new org.graalvm.nativeimage:truffle-runtime-svm coordinate.

  • Non-relocations for Truffle/GraalVM classes. After the Truffle Unchained transition, Truffle languages and runtime artifacts must be present on the Java module path. By definition, this precludes use in "relocated" form.

Known Issues

  • Uber JARs ("Fat JARs")
    • Breakages due to Truffle symbols (fixed: added to non-relocations)
  • Failing Tests (pkl-core)
    • Disabled while fixing: analyzeInvalidHttpModule.pkl
    • Failed test: :pkl-core:test:errors > analyzeInvalidHttpModule.pkl
    • Failed test: :pkl-core:testJavaExecutable:errors > analyzeInvalidHttpModule.pkl
  • Failing Tests (pkl-doc)
    • Tests need to run under JVM 21 (before JVM 22)
  • Failing Tests (pkl-executor)
    • Tests need to run under JVM 21 (before JVM 22)

Pre-merge Checklist

  • Drop GHA workflow scaffolding
  • Closely review Gradle lockfiles
  • Review decisions for Uber JAR class inclusion

Changelog

  • fix: support up to graalvm/jdk 23 (latest)
  • fix: don't use gu tool for modern graalvm versions
  • fix: coordinate change for shadow plugin (com.gradleup.shadow)
  • fix: build with --add-modules=jdk.unsupported where needed
  • fix: use jdk21 to run the tests (needed for Unsafe.ensureInitialized)
  • fix: truffle svm dependency is required after graalvm 24.0.0
  • chore: bump graalvm → 24.1.1
  • chore: bump shadow → 8.3.5
  • chore: update gradle → 8.12
  • chore: update lockfiles

- fix: support up to graalvm/jdk 23 (latest)
- fix: don't use `gu` tool for modern graalvm versions
- fix: coordinate change for `shadow` plugin (`com.gradleup.shadow`)
- fix: build with `--add-modules=jdk.unsupported` where needed
- fix: use jdk21 to run the tests (needed for `Unsafe.ensureInitialized`)
- fix: truffle svm dependency is required after graalvm `24.0.0`
- chore: bump graalvm → `24.1.0`
- chore: bump shadow → `8.3.5`

Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
@sgammon sgammon self-assigned this Jan 6, 2025
sgammon added 26 commits January 5, 2025 18:05
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
Signed-off-by: Sam Gammon <[email protected]>
@sgammon sgammon mentioned this pull request Jan 6, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant