Register all remote JDK toolchains defined

Previously, a few remote JDKs were introduced in rules_java_dependencies() but not registered in rules_java_toolchains()

PiperOrigin-RevId: 541698359
Change-Id: I87cda41fb72d79954f002f9d429305b04d6bf3c6
diff --git a/MODULE.bazel b/MODULE.bazel
index c9318f0..6f25a2a 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -29,31 +29,40 @@
 register_toolchains("@local_jdk//:runtime_toolchain_definition")
 
 # Declare all remote jdk toolchain config repos
-JDK_VERSIONS = [
-    "11",
-    "17",
-    "20",
-]
+JDKS = {
+    # Must match JDK repos defined in remote_jdk11_repos()
+    "11": [
+        "linux",
+        "linux_aarch64",
+        "linux_ppc64le",
+        "linux_s390x",
+        "macos",
+        "macos_aarch64",
+        "win",
+        "win_arm64",
+    ],
+    # Must match JDK repos defined in remote_jdk17_repos()
+    "17": [
+        "linux",
+        "linux_aarch64",
+        "linux_ppc64le",
+        "linux_s390x",
+        "macos",
+        "macos_aarch64",
+        "win",
+        "win_arm64",
+    ],
+    # Must match JDK repos defined in remote_jdk20_repos()
+    "20": [
+        "linux",
+        "linux_aarch64",
+        "macos",
+        "macos_aarch64",
+        "win",
+    ],
+}
 
-PLATFORMS = [
-    "linux",
-    "macos",
-    "macos_aarch64",
-    "win",
-]
-
-# Remote JDK repos for those Linux platforms are only defined for JDK 11 and JDK 17.
-EXTRA_REMOTE_JDK11_REPOS = [
-    "remotejdk11_linux_aarch64",
-    "remotejdk11_linux_ppc64le",
-    "remotejdk11_linux_s390x",
-]
-
-EXTRA_REMOTE_JDK17_REPOS = [
-    "remotejdk17_linux_s390x",
-]
-
-REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform) for version in JDK_VERSIONS for platform in PLATFORMS] + EXTRA_REMOTE_JDK11_REPOS + EXTRA_REMOTE_JDK17_REPOS
+REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform) for version in JDKS for platform in JDKS[version]]
 
 [use_repo(
     toolchains,
diff --git a/java/repositories.bzl b/java/repositories.bzl
index 2071746..eaef6d7 100644
--- a/java/repositories.bzl
+++ b/java/repositories.bzl
@@ -540,21 +540,16 @@
     Args:
         name: The name of this macro (not used)
     """
-    JDK_VERSIONS = ["11", "17", "20"]
-    PLATFORMS = ["linux", "macos", "macos_aarch64", "win"]
+    JDKS = {
+        # Must match JDK repos defined in remote_jdk11_repos()
+        "11": ["linux", "linux_aarch64", "linux_ppc64le", "linux_s390x", "macos", "macos_aarch64", "win", "win_arm64"],
+        # Must match JDK repos defined in remote_jdk17_repos()
+        "17": ["linux", "linux_aarch64", "linux_ppc64le", "linux_s390x", "macos", "macos_aarch64", "win", "win_arm64"],
+        # Must match JDK repos defined in remote_jdk20_repos()
+        "20": ["linux", "linux_aarch64", "macos", "macos_aarch64", "win"],
+    }
 
-    # Remote JDK repos for those Linux platforms are only defined for JDK 11 and JDK 17.
-    EXTRA_REMOTE_JDK11_REPOS = [
-        "remotejdk11_linux_aarch64",
-        "remotejdk11_linux_ppc64le",
-        "remotejdk11_linux_s390x",
-    ]
-
-    EXTRA_REMOTE_JDK17_REPOS = [
-        "remotejdk17_linux_s390x",
-    ]
-
-    REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform) for version in JDK_VERSIONS for platform in PLATFORMS] + EXTRA_REMOTE_JDK11_REPOS + EXTRA_REMOTE_JDK17_REPOS
+    REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform) for version in JDKS for platform in JDKS[version]]
 
     native.register_toolchains("//toolchains:all")
     native.register_toolchains("@local_jdk//:runtime_toolchain_definition")