-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
Upgrade rules_java to 7.10.0 #1226
Conversation
Does this also retain compatibility down to Bazel 5.4.0? The tests seem to suggest it, but not your description. What were the breakages you saw with |
As WORKSPACE file suggests, the compatibility with Bazel 5.4.0 is retained by depending on a different version of rules_java. The blocker to use a single
https://buildkite.com/bazel/rules-jvm-external/builds/4484#0191b7b6-2483-4346-8d95-0976f9832b80 |
@@ -1,11 +1,6 @@ | |||
java_library( | |||
name = "rules_jvm_external", | |||
srcs = glob(["*.java"]), | |||
javacopts = [ |
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.
We use this to keep ourselves honest. Our users should still be able to target and use Java 11 in their builds. Without this, it'd be easy for us to accidentally rely on features that aren't available until later versions of the JDK.
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 believe that produced .jar as well as source code limitations are already controlled with --java_language_version and --java_release_version.
Demo for a source version: #1231
Manual check for class version:
$ bazel build //private/tools/java/com/github/bazelbuild/rules_jvm_external
$ unzip bazel-bin/private/tools/java/com/github/bazelbuild/rules_jvm_external/librules_jvm_external.jar
$ javap -verbose com/github/bazelbuild/rules_jvm_external/ByteStreams.class | grep "major"
major version: 55
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.
But the bootclasspath differs: without bazelbuild/rules_java#182, it's determined by --java_runtime_version
, not --java_language_version
. This makes it harder to e.g. test on JDK 21, but at the same time have compile-time assurance that the output is compatible with Java 11.
I did further investigation, what's going on.
For cc @fmeum |
Techincally I might be able to make |
As it happens, I'm planning to extract both of those rules out very shortly.
|
Alright. I don't want to block this, because it's a good upgrade to have. I'm going to assume that I would note that loading things like |
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.
Looks adequate to me. I'm a little uneasy, but let's see what happens once this is landed.
javacopts = [ | ||
"--release", | ||
"11", | ||
"-Xlint:-options", |
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.
This flag was added in #950, so this looks safe to remove.
rules_java 7.10.0 work with Bazel 7 down to Bazel 6.2.0. This makes it possible to load symbols like JavaInfo from rules_java also on older Bazel versions (previous Java releases didn't have Java/common/java_info.bzl file). A single rules_java version for multiple Bazel releases should also simplify things.
Remove the flag --release, because it breaks on the combination of Bazel 6.x and rules_java 7.10.0, most likely because of incompatible changes in the turbine. The flag is not necessary, because the release is already controlled --java_release_version flag.