Make jmods available from the jdk BUILD file Copybara Import from https://github.com/bazelbuild/rules_java/pull/184 BEGIN_PUBLIC Make jmods available from the jdk BUILD file (#184) The PR at https://github.com/bazelbuild/rules_java/pull/135 looks dormant, this makes the change requested at https://github.com/bazelbuild/rules_java/pull/135#issuecomment-1797985514 I don't need the entire change here, having the jmods as a filegroup is sufficient for using jlink, but @cushon suggested adding the files as sources to the java_runtime as well, if I understood him correctly, so I did that too. If that's not necessary, let me know and I'll remove that part. Closes #184 END_PUBLIC COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/184 from srdo-humio:stig/jdk-with-jmods e1513dbb7e67fe7da4782eb602a8564da19e9bf5 PiperOrigin-RevId: 631308886 Change-Id: I455d1ff6abd8d5b92e0e25f92caed796fe019aec
diff --git a/toolchains/jdk_build_file.bzl b/toolchains/jdk_build_file.bzl index 00b774c..1e08f37 100644 --- a/toolchains/jdk_build_file.bzl +++ b/toolchains/jdk_build_file.bzl
@@ -92,4 +92,26 @@ java = glob(["bin/java.exe", "bin/java"], allow_empty = True)[0], version = {RUNTIME_VERSION}, ) + +filegroup( + name = "jdk-jmods", + srcs = glob( + ["jmods/**"], + allow_empty = True, + ), +) + +java_runtime( + name = "jdk-with-jmods", + srcs = [ + ":jdk-bin", + ":jdk-conf", + ":jdk-include", + ":jdk-lib", + ":jdk-jmods", + ":jre", + ], + java = glob(["bin/java.exe", "bin/java"], allow_empty = True)[0], + version = {RUNTIME_VERSION}, +) """