Skip to content
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

[6.2.0]Add version to JavaRuntimeInfo. #17898

Closed
wants to merge 15 commits into from

Conversation

ShreeM01
Copy link
Contributor

  1. As suggested in Use @argument files in the Java binary wrapper script #6354 (comment), add a JDK version attribute to the java_runtime rule. This will allow changing behavior based on the Java runtime's version.

  2. As an application of the above, pass -Djava.security.manager=allow to Java tests on JDK 17+. This makes the Bazel Java test runner to work on JDK 19. Fixes Bazel@HEAD on JDK 17: GoogleTestSecurityManager WARNING: System::setSecurityManager will be removed in a future release #14502.

  3. To make the above generally useful, the remote_java_repository and local_java_repository must set the new version attribute in the java_runtime rules that they create. This means the old static jdk.BUILD file no longer suffices. Move the contents of jdk.BUILD into a Starlark file, so the version can be interpolated in by JDK repository rules and macros. (This isn't the nicest, but local_java_repository is not a repository rule, so the template cannot be in a non-Starlark file.)

Closes #17775.
Commit: 7556e11

PiperOrigin-RevId: 518860040
Change-Id: I8223b6407dd09528a4e5a6bf12354e5fc68278c6

benjaminp and others added 4 commits March 27, 2023 17:33
1. As suggested in bazelbuild#6354 (comment), add a JDK version attribute to the java_runtime rule. This will allow changing behavior based on the Java runtime's version.

2. As an application of the above, pass -Djava.security.manager=allow to Java tests on JDK 17+. This makes the Bazel Java test runner to work on JDK 19. Fixes bazelbuild#14502.

3. To make the above generally useful, the remote_java_repository and local_java_repository must set the new version attribute in the java_runtime rules that they create. This means the old static jdk.BUILD file no longer suffices. Move the contents of jdk.BUILD into a Starlark file, so the version can be interpolated in by JDK repository rules and macros. (This isn't the nicest, but local_java_repository is not a repository rule, so the template cannot be in a non-Starlark file.)

Closes bazelbuild#17775.

PiperOrigin-RevId: 518860040
Change-Id: I8223b6407dd09528a4e5a6bf12354e5fc68278c6
@ShreeM01 ShreeM01 requested a review from keertk March 28, 2023 02:01
@keertk
Copy link
Member

keertk commented Mar 28, 2023

Hi @hvadehra could you take a look at this PR + failures please? It was requested here: #14502 (comment)

It's a little messy because several changes that are part of this commit were not in the release-6.2.0 branch yet (e.g. creating /java/bazel_java_binary.bzl and JavaConfiguredTargetsTest.java, many updates to tools/jdk/jdk_build_file.bzl, etc.).

Please feel free to send another PR instead with additional cherry-picks if that's cleaner. Thank you!

@keertk keertk added awaiting-review PR is awaiting review from an assigned reviewer team-Rules-Java Issues for Java rules labels Mar 28, 2023
@keertk keertk requested review from hvadehra and removed request for keertk March 28, 2023 04:45
@hvadehra
Copy link
Member

Yeah, it looks like it could be a lot simpler. I'll send a new PR your way.

@keertk
Copy link
Member

keertk commented Mar 29, 2023

Great, thank you!

@keertk keertk closed this Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review PR is awaiting review from an assigned reviewer team-Rules-Java Issues for Java rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants