Merge pull request #98 from linux-on-ibm-z:add_s390x_support_in_java_repos

PiperOrigin-RevId: 540548594
Change-Id: Icb1f41147b68ce483a4f4b8a151f16b424c69e1c
diff --git a/MODULE.bazel b/MODULE.bazel
index 9dd7a3c..c9318f0 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -42,14 +42,18 @@
     "win",
 ]
 
-# Remote JDK repos for those Linux platforms are only defined for JDK 11.
+# 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",
 ]
 
-REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform) for version in JDK_VERSIONS for platform in PLATFORMS] + EXTRA_REMOTE_JDK11_REPOS
+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
 
 [use_repo(
     toolchains,
diff --git a/java/repositories.bzl b/java/repositories.bzl
index 982be7f..2071746 100644
--- a/java/repositories.bzl
+++ b/java/repositories.bzl
@@ -102,6 +102,20 @@
     )
     maybe(
         remote_java_repository,
+        name = "remote_jdk8_linux_s390x",
+        target_compatible_with = [
+            "@platforms//os:linux",
+            "@platforms//cpu:s390x",
+        ],
+        sha256 = "276a431c79b7e94bc1b1b4fd88523383ae2d635ea67114dfc8a6174267f8fb2c",
+        strip_prefix = "jdk8u292-b10",
+        urls = [
+            "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_s390x_linux_hotspot_8u292b10.tar.gz",
+        ],
+        version = "8",
+    )
+    maybe(
+        remote_java_repository,
         name = "remote_jdk8_linux",
         target_compatible_with = [
             "@platforms//os:linux",
@@ -161,6 +175,7 @@
     )
     REMOTE_JDK8_REPOS = [
         "remote_jdk8_linux_aarch64",
+        "remote_jdk8_linux_s390x",
         "remote_jdk8_linux",
         "remote_jdk8_macos_aarch64",
         "remote_jdk8_macos",
@@ -528,14 +543,18 @@
     JDK_VERSIONS = ["11", "17", "20"]
     PLATFORMS = ["linux", "macos", "macos_aarch64", "win"]
 
-    # Remote JDK repos for those Linux platforms are only defined for JDK 11.
+    # 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",
     ]
 
-    REMOTE_JDK_REPOS = [("remotejdk" + version + "_" + platform) for version in JDK_VERSIONS for platform in PLATFORMS] + EXTRA_REMOTE_JDK11_REPOS
+    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
 
     native.register_toolchains("//toolchains:all")
     native.register_toolchains("@local_jdk//:runtime_toolchain_definition")