-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Expose vanilla java toolchain #5984
Conversation
To use the latest supported language level from the --host_javabase, use VanillaJavaBuilder (which should work with most host JDKs) and leave the source/target/bootclasspath unset so they default to the latest supported versions. With this in place, new java_runtime can be used, e.g.: java_runtime( name = "jdk11", java_home = "/usr/lib64/jvm/java-11", visibility = ["//visibility:public"], ) Now the JDK11 can be used with the language level 11: $ bazel build --host_javabase=:jdk11 \ --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \ --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla \ :a Related: bazelbuild#5723
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks entirely reasonable, but I'll leave the final judgement to @cushon .
Seems reasonable to me too, but |
Can you share your requirements with the "incompatible changes policy" thread on bazel-discuss@? I'm not opposed to creating a target for VanillaJavaBuilder, it currently it's unsupported and not something I really recommend taking a dependency on. It's also not a complete solution to let you build old versions of your code with new versions of Bazel, since from the discussion in the thread there's only going to be ~1 release of compatibility for breaking changes. |
@cushon Any suggestion how to proceed here? Now, that Guice 4.2.1 was released with proper JDK 10 support, the only missing link in the chain to support Gerrit build with JDK 10 (and next week with JDK 11), is the missing easy and supported way to use Vanilla Java Builder exposed by vanilla_toolchain in Bazel. I understand, your POV, to not committed to maintain that halb backed support for new toolchain. Still I would like to avoid adding it to gerrit as well. Any further ideas? What about adding it to another place? Like to bazel_skylib? We use it already:
|
Sorry for the delay. I think it's fine to add this for now, I don't have any better ideas until using JDK 10 and 11 with Bazel is fully supported. |
To use the latest supported language level from the --host_javabase, use
VanillaJavaBuilder (which should work with most host JDKs) and leave the
source/target/bootclasspath unset so they default to the latest
supported versions.
With this in place, new java_runtime can be used, e.g.:
java_runtime(
name = "jdk11",
java_home = "/usr/lib64/jvm/java-11",
visibility = ["//visibility:public"],
)
Now the JDK11 can be used with the language level 11:
$ bazel build --host_javabase=:jdk11
--host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
--java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
:a
Related: #5723