Description of the feature request:
Java 17 is expected to ship during the middle of September. It's the first LTS Java release since Java 11. Once it's out, teams using Bazel will want to migrate to Java 17, and Bazel needs to support this out-of-the-box.
While Bazel ships with toolchains to support different Java versions, there's nothing for java 17 yet (understandably), and it's not obvious how to hook in a custom JDK. The recommended way to do this is via the hermetic toolchains, but this feature only works in Bazel 5. Back-porting that to Bazel 4 seems complicated.
The alternative is a snippet much like:
build --host_javabase=@forked_jdk//java:java17-runtime
build --javabase=@forked_jdk//java:java17-runtime
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_java17
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_java17
Here, @forked_jdk points to a custom JDK (assume it's something like "OpenJDK with some patches" such as Amazon Corretto)
The key missing piece is @bazel_tools//tools/jdk:toolchain_java17. The last toolchain_javaXX was for Java 11. If that was added, then we'd be able to make the jump to Java 17 quickly.
Feature requests: what underlying problem are you trying to solve with this feature?
People validating their builds on Java 17 need their build tool to properly support Java 17
Description of the feature request:
Java 17 is expected to ship during the middle of September. It's the first LTS Java release since Java 11. Once it's out, teams using Bazel will want to migrate to Java 17, and Bazel needs to support this out-of-the-box.
While Bazel ships with toolchains to support different Java versions, there's nothing for java 17 yet (understandably), and it's not obvious how to hook in a custom JDK. The recommended way to do this is via the hermetic toolchains, but this feature only works in Bazel 5. Back-porting that to Bazel 4 seems complicated.
The alternative is a snippet much like:
Here,
@forked_jdkpoints to a custom JDK (assume it's something like "OpenJDK with some patches" such as Amazon Corretto)The key missing piece is
@bazel_tools//tools/jdk:toolchain_java17. The lasttoolchain_javaXXwas for Java 11. If that was added, then we'd be able to make the jump to Java 17 quickly.Feature requests: what underlying problem are you trying to solve with this feature?
People validating their builds on Java 17 need their build tool to properly support Java 17