Skip to content

Build things with JDK 17, but preserve Java 8 compat anyway #3137

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

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

alexarchambault
Copy link
Member

@alexarchambault alexarchambault commented Nov 4, 2024

Right now, publishing fails because:

  • Mill 0.12.x publish tasks require JDK >= 11
  • using Java >= 11 but building for Java 8 requires passing --require 8 to javac and scalac
  • we're using "unsupported" JDK APIs (sun.misc.Signal stuff), and neither javac nor scalac accept options to enable access to it alongside --release 8 (javac doesn't accept --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED alongside --release, and scalac doesn't allow passing such an option altogether anyway, see Support alternative JVM system images (via -system, like javac) scala/scala#10801)

To work around that, this PR:

  • uses JDK 17 everywhere on the CI
  • passes --release 8 to scalac
  • moves the (Java) file using unsupported JDK APIs to a separate pure Java cache-util module
  • passes -source 8 -target 8 -bootclasspath some-jdk-8/jre/lib/rt.jar to javac in order to allow access to unsupported JDK APIs

@alexarchambault alexarchambault changed the title Build things with JDK 17, but ensure Java 8 compat anyway Build things with JDK 17, but preserve Java 8 compat anyway Nov 4, 2024
@alexarchambault alexarchambault marked this pull request as ready for review November 5, 2024 14:12
@alexarchambault alexarchambault merged commit ac9d2b3 into coursier:main Nov 5, 2024
22 checks passed
@alexarchambault alexarchambault deleted the fix-publish branch November 5, 2024 14:23
@som-snytt
Copy link

Scala 2:

  -Yrelease:<packages>                  Expose platform packages hidden under --release

in case that is useful. Not ported to Scala 3 (yet?), but maybe because there was no feedback.

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.

2 participants