Merge pull request #113 from fmeum:17085-exec-constraints

PiperOrigin-RevId: 554381444
Change-Id: I95c27f8d1b918e8168814fb0409a643a6a2664a9
diff --git a/MODULE.bazel b/MODULE.bazel
index ebf3c8c..ac5cd19 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -1,6 +1,6 @@
 module(
     name = "rules_java",
-    version = "6.1.1",
+    version = "6.4.0",
     compatibility_level = 1,
 )
 
diff --git a/java/defs.bzl b/java/defs.bzl
index bbfc55f..2ba4933 100644
--- a/java/defs.bzl
+++ b/java/defs.bzl
@@ -18,7 +18,7 @@
 # Do not touch: This line marks the end of loads; needed for PR importing.
 
 _MIGRATION_TAG = "__JAVA_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__"
-version = "6.1.1"
+version = "6.4.0"
 
 def _add_tags(attrs):
     if "tags" in attrs and attrs["tags"] != None:
diff --git a/java/repositories.bzl b/java/repositories.bzl
index 4476652..7e5b939 100644
--- a/java/repositories.bzl
+++ b/java/repositories.bzl
@@ -25,50 +25,50 @@
     maybe(
         http_archive,
         name = "remote_java_tools",
-        sha256 = "e91fbced948cdafce21c29c9ce006de19a2e7fc40706aac6197096d0847ae93d",
+        sha256 = "f58a358ca694a41416a9b6a92b852935ad301d8882e5d22f4f11134f035317d5",
         urls = [
-            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.4/java_tools-v12.4.zip",
-            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.4/java_tools-v12.4.zip",
+            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools-v12.6.zip",
+            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools-v12.6.zip",
         ],
     )
 
     maybe(
         http_archive,
         name = "remote_java_tools_linux",
-        sha256 = "ed1438453d5142c0cf022a43a21255d4a764f9f221cce08c17a2285d04479a06",
+        sha256 = "64294e91fe940c77e6d35818b4c3a1f07d78e33add01e330188d907032687066",
         urls = [
-            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.4/java_tools_linux-v12.4.zip",
-            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.4/java_tools_linux-v12.4.zip",
+            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_linux-v12.6.zip",
+            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_linux-v12.6.zip",
         ],
     )
 
     maybe(
         http_archive,
         name = "remote_java_tools_windows",
-        sha256 = "11b61fa63da07380dec212448a0e44b66f3d1ee5469f1c8a2845ca8a4431d851",
+        sha256 = "63f727d44011b8c504bb4e6d89c2cd982278efb34dae8629687e9483d8f7d62d",
         urls = [
-            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.4/java_tools_windows-v12.4.zip",
-            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.4/java_tools_windows-v12.4.zip",
+            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_windows-v12.6.zip",
+            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_windows-v12.6.zip",
         ],
     )
 
     maybe(
         http_archive,
         name = "remote_java_tools_darwin_x86_64",
-        sha256 = "564ed4f744ed947f27641ac1dc256ef294f38a7b0955b70f4c9407173a838a86",
+        sha256 = "c6545e82e543cb5775d3b8909d6270b5f481864b5ff083d20bfa5dcf77ac3ef7",
         urls = [
-            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.4/java_tools_darwin_x86_64-v12.4.zip",
-            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.4/java_tools_darwin_x86_64-v12.4.zip",
+            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_darwin_x86_64-v12.6.zip",
+            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_darwin_x86_64-v12.6.zip",
         ],
     )
 
     maybe(
         http_archive,
         name = "remote_java_tools_darwin_arm64",
-        sha256 = "7c0f2b7295b1738e7192731124730bfd9a9b2034895fa99a98dd5b8fb4a96c1b",
+        sha256 = "c6ffcaf87965c436cc86fc0e9673dafc97c0761efae8225ad2691cf6cfe3d87a",
         urls = [
-            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.4/java_tools_darwin_arm64-v12.4.zip",
-            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.4/java_tools_darwin_arm64-v12.4.zip",
+            "https://mirror.bazel.build/bazel_java_tools/releases/java/v12.6/java_tools_darwin_arm64-v12.6.zip",
+            "https://github.com/bazelbuild/java_tools/releases/download/java_v12.6/java_tools_darwin_arm64-v12.6.zip",
         ],
     )
 
@@ -193,11 +193,11 @@
             "@platforms//os:linux",
             "@platforms//cpu:x86_64",
         ],
-        sha256 = "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247",
-        strip_prefix = "zulu11.56.19-ca-jdk11.0.15-linux_x64",
+        sha256 = "a34b404f87a08a61148b38e1416d837189e1df7a040d949e743633daf4695a3c",
+        strip_prefix = "zulu11.66.15-ca-jdk11.0.20-linux_x64",
         urls = [
-            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz",
-            "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz",
+            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_x64.tar.gz",
+            "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_x64.tar.gz",
         ],
         version = "11",
     )
@@ -209,11 +209,11 @@
             "@platforms//os:linux",
             "@platforms//cpu:aarch64",
         ],
-        sha256 = "fc7c41a0005180d4ca471c90d01e049469e0614cf774566d4cf383caa29d1a97",
-        strip_prefix = "zulu11.56.19-ca-jdk11.0.15-linux_aarch64",
+        sha256 = "54174439f2b3fddd11f1048c397fe7bb45d4c9d66d452d6889b013d04d21c4de",
+        strip_prefix = "zulu11.66.15-ca-jdk11.0.20-linux_aarch64",
         urls = [
-            "https://mirror.bazel.build/cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz",
-            "https://cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz",
+            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_aarch64.tar.gz",
+            "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-linux_aarch64.tar.gz",
         ],
         version = "11",
     )
@@ -257,11 +257,11 @@
             "@platforms//os:macos",
             "@platforms//cpu:x86_64",
         ],
-        sha256 = "2614e5c5de8e989d4d81759de4c333aa5b867b17ab9ee78754309ba65c7f6f55",
-        strip_prefix = "zulu11.56.19-ca-jdk11.0.15-macosx_x64",
+        sha256 = "bcaab11cfe586fae7583c6d9d311c64384354fb2638eb9a012eca4c3f1a1d9fd",
+        strip_prefix = "zulu11.66.15-ca-jdk11.0.20-macosx_x64",
         urls = [
-            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz",
-            "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz",
+            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_x64.tar.gz",
+            "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_x64.tar.gz",
         ],
         version = "11",
     )
@@ -273,11 +273,11 @@
             "@platforms//os:macos",
             "@platforms//cpu:aarch64",
         ],
-        sha256 = "6bb0d2c6e8a29dcd9c577bbb2986352ba12481a9549ac2c0bcfd00ed60e538d2",
-        strip_prefix = "zulu11.56.19-ca-jdk11.0.15-macosx_aarch64",
+        sha256 = "7632bc29f8a4b7d492b93f3bc75a7b61630894db85d136456035ab2a24d38885",
+        strip_prefix = "zulu11.66.15-ca-jdk11.0.20-macosx_aarch64",
         urls = [
-            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz",
-            "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz",
+            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_aarch64.tar.gz",
+            "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-macosx_aarch64.tar.gz",
         ],
         version = "11",
     )
@@ -289,11 +289,11 @@
             "@platforms//os:windows",
             "@platforms//cpu:x86_64",
         ],
-        sha256 = "a106c77389a63b6bd963a087d5f01171bd32aa3ee7377ecef87531390dcb9050",
-        strip_prefix = "zulu11.56.19-ca-jdk11.0.15-win_x64",
+        sha256 = "43408193ce2fa0862819495b5ae8541085b95660153f2adcf91a52d3a1710e83",
+        strip_prefix = "zulu11.66.15-ca-jdk11.0.20-win_x64",
         urls = [
-            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip",
-            "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip",
+            "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-win_x64.zip",
+            "https://cdn.azul.com/zulu/bin/zulu11.66.15-ca-jdk11.0.20-win_x64.zip",
         ],
         version = "11",
     )
diff --git a/toolchains/DumpPlatformClassPath.java b/toolchains/DumpPlatformClassPath.java
index 0832853..fafb843 100644
--- a/toolchains/DumpPlatformClassPath.java
+++ b/toolchains/DumpPlatformClassPath.java
@@ -47,7 +47,7 @@
 /**
  * Output a jar file containing all classes on the platform classpath of the given JDK release.
  *
- * <p>usage: DumpPlatformClassPath <release version> <output jar> <path to target JDK>?
+ * <p>usage: {@code DumpPlatformClassPath <output jar> <path to target JDK>}
  */
 public class DumpPlatformClassPath {
 
@@ -90,7 +90,7 @@
     // * --release takes a language level (e.g. '9') and uses the API information baked in to
     //     the host JDK (in lib/ct.sym).
 
-    // Since --system only supports JDK >= 9, first check of the target JDK defines a JDK 8
+    // Since --system only supports JDK >= 9, first check if the target JDK defines a JDK 8
     // bootclasspath.
     List<Path> bootClassPathJars = getBootClassPathJars(targetJavabase);
     if (!bootClassPathJars.isEmpty()) {
diff --git a/toolchains/local_java_repository.bzl b/toolchains/local_java_repository.bzl
index 13e5ced..45603ec 100644
--- a/toolchains/local_java_repository.bzl
+++ b/toolchains/local_java_repository.bzl
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Rules for importing and registering a local JDK."""
+"""Rules for importing a local JDK."""
 
 load("//java:defs.bzl", "java_runtime")
 load(":default_java_toolchain.bzl", "default_java_toolchain")
@@ -269,7 +269,10 @@
 )
 
 def local_java_repository(name, java_home = "", version = "", build_file = None, build_file_content = None, **kwargs):
-    """Registers a runtime toolchain for local JDK and creates an unregistered compile toolchain.
+    """Defines runtime and compile toolchains for a local JDK.
+
+    Register the toolchains defined by this macro via `register_toolchains("@<name>//:all")`, where
+    `<name>` is the value of the `name` parameter.
 
     Toolchain resolution is constrained with --java_runtime_version flag
     having value of the "name" or "version" parameter.
diff --git a/toolchains/remote_java_repository.bzl b/toolchains/remote_java_repository.bzl
index cbd8b13..86916ec 100644
--- a/toolchains/remote_java_repository.bzl
+++ b/toolchains/remote_java_repository.bzl
@@ -12,9 +12,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Rules for importing and registering JDKs from http archive.
+"""Rules for importing JDKs from http archive.
 
-Rule remote_java_repository imports and registers JDK with the toolchain resolution.
+Rule remote_java_repository imports a JDK and creates toolchain definitions for it.
 """
 
 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
@@ -33,7 +33,10 @@
 )
 
 def remote_java_repository(name, version, target_compatible_with = None, prefix = "remotejdk", **kwargs):
-    """Imports and registers a JDK from a http archive.
+    """Imports a JDK from a http archive and creates runtime toolchain definitions for it.
+
+    Register the toolchains defined by this macro via `register_toolchains("@<name>//:all")`, where
+    `<name>` is the value of the `name` parameter.
 
     Toolchain resolution is determined with target_compatible_with
     parameter and constrained with --java_runtime_version flag either having value