Expose the remote JDK legal/ directory as a `jdk-legal` filegroup (#393) Fixes #390. The BUILD file generated for remote JDK repositories exposes `bin`, `conf`, `include`, `lib` and `jmods` through filegroups, but the downloaded `legal/` directory is not reachable from any target. Projects that redistribute the JDK, for example by packaging it into a container image, need those notices: OpenJDK bundles third-party components whose licenses require them to accompany copies. This adds a `jdk-legal` filegroup over `legal/**`, following the naming and `allow_empty` convention of the existing `jdk-*` filegroups. It is not added to the `java_runtime` srcs, so runtime runfiles are unchanged. Closes #393 COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/393 from simonepri:export-jdk-legal 01b04b6fe730fda2d0892657d4848d543e1df6f0 PiperOrigin-RevId: 1031244443 Change-Id: Icc59bdbe59f1b9c039db0e74467d239c27834a98
diff --git a/toolchains/jdk_build_file.bzl b/toolchains/jdk_build_file.bzl index c0ed160..f1d10df 100644 --- a/toolchains/jdk_build_file.bzl +++ b/toolchains/jdk_build_file.bzl
@@ -63,6 +63,14 @@ ) filegroup( + name = "jdk-legal", + srcs = glob( + ["legal/**"], + allow_empty = True, + ), +) + +filegroup( name = "jdk-lib", srcs = glob( ["lib/**", "release"],