Skip to content

Select Scala toolchain by version and add JVM flags to the toolchain - #113

Merged
jjudd merged 1 commit into
lucid-masterfrom
jjudd-toolchain-changes
Jul 29, 2026
Merged

jjudd merged 1 commit into
lucid-masterfrom
jjudd-toolchain-changes

Conversation

@jjudd

@jjudd jjudd commented Jun 12, 2026

Copy link
Copy Markdown

Currently there is no good way to provide JVM flags to our Scala toolchain. This change adds the ability to specify JVM flags used when invoking the Scala toolchain. This is particularly relevant for JDK 25 where lots of warnings about Unsafe appear without specifying certain JVM flags.

Currently the Scala toolchain is selected by toolchain name. This causes challenges because the Scala toolchain from the consuming workspace may not match the toolchain name of another ruleset. This causes the Scala toolchain from that other ruleset to be used, but the JDK toolchain from the consuming workspace is used.

This can cause problems where a JDK 25 toolchain is used with a Scala toolchain that doesn't provide JVM flags needed to silence warnings that appear when calling the Scala compiler.

Changing the Scala toolchain to be selected by version causes the consuming workspace's Scala toolchains to be used, just like the JDK toolchain and other Bazel toolchains.

@jjudd
jjudd requested a review from jadenPete June 12, 2026 16:12
@jjudd
jjudd force-pushed the jjudd-toolchain-changes branch from d2087da to 98c2bdd Compare June 12, 2026 19:00
Comment thread rules/register_toolchain.bzl
Comment thread rules/scalafmt.bzl
Comment thread rules/scalafmt/register_toolchain.bzl
Comment thread tests/format/scalafmt/BUILD
Comment thread tests/javac_options/replace_source_target_with_release_test.bzl
Comment thread tests/jvm_flags/BUILD
Comment thread docs/newdocs/scala_versions.md
Comment thread docs/newdocs/scala_versions.md Outdated
Currently there is no good way to provide JVM flags to our Scala
toolchain. This change adds the ability to specify JVM flags used when
invoking the Scala toolchain. This is particularly relevant for JDK 25
where lots of warnings about Unsafe appear without specifying certain
JVM flags.

Currently the Scala toolchain is selected by toolchain name. This causes
challenges because the Scala toolchain from the consuming workspace may
not match the toolchain name of another ruleset. This causes the Scala
toolchain from that other ruleset to be used, but the JDK toolchain from
the consuming workspace is used.

This can cause problems where a JDK 25 toolchain is used with a Scala
toolchain that doesn't provide JVM flags needed to silence warnings that
appear when calling the Scala compiler.

Changing the Scala toolchain to be selected by version causes the
consuming workspace's Scala toolchains to be used, just like the JDK
toolchain and other Bazel toolchains.
@jjudd
jjudd force-pushed the jjudd-toolchain-changes branch from 98c2bdd to db82da0 Compare July 29, 2026 19:59
@jjudd
jjudd merged commit 17cf890 into lucid-master Jul 29, 2026
1 check passed
@jjudd
jjudd deleted the jjudd-toolchain-changes branch July 29, 2026 21:50
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