bazel icon indicating copy to clipboard operation
bazel copied to clipboard

Wire up `oneversion` tool in `java_tools`

Open fmeum opened this issue 9 months ago • 8 comments

  • Add a prebuilt one_version tool as well as sources to java_tools.
  • Avoid passing --whitelist to one_version if no allowlist is configured in the toolchain as it isn't supported by the Bazel version of oneversion yet.
  • Document the one_version flags.
  • Clean up tests not updated after recent rules_java releases.

Work towards #1071

fmeum avatar May 06 '24 12:05 fmeum

@bazel-io fork 7.2.0

fmeum avatar May 28 '24 21:05 fmeum

To confirm, does this change take effect without a java_tools release?

Wyverald avatar May 29 '24 00:05 Wyverald

To confirm, does this change take effect without a java_tools release?

It includes some changes that only take effect with a new java_tools version, but users can just update rules_java themselves after 7.2.0. So while the changes to builtins would need to get into 7.2.0, a new rules_java release doesn't necessarily have to be cut in time.

fmeum avatar May 29 '24 06:05 fmeum

I resolved the conflict.

fmeum avatar May 29 '24 07:05 fmeum

@fmeum CI appears to be unhappy with this on Windows

hvadehra avatar May 29 '24 11:05 hvadehra

The error is:

C:/b/6j5uj2r5/execroot/_main/_tmp/9473ac4eeda27d9bad5e0103440c98fe/root/4wfnognp/external/rules_java~~toolchains~remotejdk11_win/lib/jrt-fs.jar (Permission denied)

It's not clear to me how this PR could cause this and it didn't occur before I rebased onto master. Will try to reproduce this locally.

fmeum avatar May 29 '24 11:05 fmeum

@fmeum Could you please take a look at the failing checks?

satyanandak avatar May 30 '24 04:05 satyanandak

@meteorcloudy Do you happen to have an idea what could be causing such an error?

fmeum avatar May 30 '24 10:05 fmeum

I have no idea.. but let me try if I can reproduce it locally

meteorcloudy avatar May 31 '24 13:05 meteorcloudy

I can only confirm the permission denied error is caused by running the test_one_version test case, if I remove that one without changing other code, the test will pass.

It looks like something was still holding a file handle to java.dll after the test was done. I have no idea what exactly, but adding bazel shutdown to the tear_down function seems to fix the problem. https://github.com/bazelbuild/bazel/blob/25a9d531793e811acaa2c42fe99a1cfa578e75cd/src/test/shell/bazel/bazel_java_test.sh#L90-L92

meteorcloudy avatar May 31 '24 15:05 meteorcloudy

I also noticed all those bazel_java_test are quite slow, but not sharded..

meteorcloudy avatar May 31 '24 15:05 meteorcloudy

@meteorcloudy Thanks for digging into this, I added bazel shutdown and hope that the tests will pass.

fmeum avatar May 31 '24 15:05 fmeum

@satyanandak CI is green

fmeum avatar May 31 '24 17:05 fmeum

@sgowroji The merge commit broke the pipeline, I think that you need to regenerate the lockfile again.

fmeum avatar Jun 03 '24 11:06 fmeum

@fmeum It's taken care internally while importing through CL.

sgowroji avatar Jun 03 '24 11:06 sgowroji

@keertk Could we get a new release of javatools to pick up this change?

fmeum avatar Aug 05 '24 11:08 fmeum

@fmeum yes sure - is there an urgency? If not, we'll get to it later this week once Bazel 7.3 is out.

keertk avatar Aug 05 '24 12:08 keertk

@fmeum yes sure - is there an urgency? If not, we'll get to it later this week once Bazel 7.3 is out.

It's not urgent, it would just be great to get into 7.4.0.

fmeum avatar Aug 05 '24 13:08 fmeum