diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index f66eb711..ebe0eefb 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -13,11 +13,15 @@ build_targets_bzlmod: &build_targets_bzlmod # Enable once the issue is fixed. - "-//distro/..." +test_targets: &test_targets + - "//test/..." + buildifier: latest tasks: ubuntu2004: build_targets: *build_targets + test_targets: *test_targets macos: build_targets: *build_targets windows: diff --git a/java/bazel/BUILD.bazel b/java/bazel/BUILD.bazel new file mode 100644 index 00000000..1db01d36 --- /dev/null +++ b/java/bazel/BUILD.bazel @@ -0,0 +1,55 @@ +# Copyright 2024 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +load(":repositories_util.bzl", "FLAT_CONFIGS") + +# run this to generate _REMOTE_JDK_CONFIGS_LIST in repositories.bzl +# this downloads all the jdks and computes their sha256 sum, so can take a while +# TODO(hvd): make this a sh_binary to update the configs in place +genrule( + name = "dump_remote_jdk_configs", + outs = ["remote_jdks_config.out"], + cmd = """ +echo > $@ +while read -r config; do + TMP_FILE=$$(mktemp -q /tmp/remotejdk.XXXXXX) + IFS=\\| read -r name version urls strip_prefix target_compatible_with primary_url <<< "$$config" + echo "fetching: $$primary_url to $$TMP_FILE" > /dev/stderr + curl --silent -o $$TMP_FILE -L "$$primary_url" > /dev/stderr + sha256=`sha256sum $$TMP_FILE | cut -d' ' -f1` + echo "struct(" + echo " name = \\"$$name\\"," + echo " target_compatible_with = $$target_compatible_with," + echo " sha256 = \\"$$sha256\\"," + echo " strip_prefix = \\"$$strip_prefix\\"," + echo " urls = $$urls," + echo " version = \\"$$version\\"," + echo ")," +done <<< '{configs}' >> $@ + """.format(configs = "\n".join([ + "|".join([ + config.name, + config.version, + json.encode(config.urls), + config.strip_prefix, + json.encode(config.target_compatible_with), + config.urls[0], + ]) + for config in FLAT_CONFIGS + ])), + tags = [ + "local", + "manual", + ], + visibility = ["//visibility:private"], +) diff --git a/java/bazel/repositories_util.bzl b/java/bazel/repositories_util.bzl new file mode 100644 index 00000000..02f8a317 --- /dev/null +++ b/java/bazel/repositories_util.bzl @@ -0,0 +1,189 @@ +# Copyright 2024 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""Helper functions to register remote jdk repos""" + +visibility(["//test"]) + +_RELEASE_CONFIGS = { + "8": { + "zulu": { + "release": "8.78.0.19-ca-jdk8.0.412", + "platforms": { + "linux": ["aarch64", "x86_64"], + "macos": ["aarch64", "x86_64"], + "windows": ["x86_64"], + }, + }, + "adoptopenjdk": { + "release": "8u292-b10", + "platforms": { + "linux": ["s390x"], + }, + }, + }, + "11": { + "zulu": { + "release": "11.72.19-ca-jdk11.0.23", + "platforms": { + "linux": ["aarch64", "x86_64"], + "macos": ["aarch64", "x86_64"], + "windows": ["x86_64"], + }, + }, + "adoptium": { + "release": "11.0.15+10", + "platforms": { + "linux": ["ppc", "s390x"], + }, + }, + "microsoft": { + "release": "11.0.13.8.1", + "platforms": { + "windows": ["arm64"], + }, + }, + }, + "17": { + "zulu": { + "release": "17.50.19-ca-jdk17.0.11", + "platforms": { + "linux": ["aarch64", "x86_64"], + "macos": ["aarch64", "x86_64"], + "windows": ["arm64", "x86_64"], + }, + }, + "adoptium": { + "release": "17.0.8.1+1", + "platforms": { + "linux": ["ppc", "s390x"], + }, + }, + }, + "21": { + "zulu": { + "release": "21.34.19-ca-jdk21.0.3", + "platforms": { + "linux": ["aarch64", "x86_64"], + "macos": ["aarch64", "x86_64"], + "windows": ["x86_64"], + }, + }, + "adoptium": { + "release": "21.0.2+13", + "platforms": { + "linux": ["ppc", "s390x"], + }, + }, + "microsoft": { + "release": "21.0.0", + "platforms": { + "windows": ["arm64"], + }, + }, + }, +} + +_STRIP_PREFIX_OVERRIDES = { + "remotejdk11_win_arm64": "jdk-11.0.13+8", + "remotejdk21_win_arm64": "jdk-21+35", +} + +def _name_for_remote_jdk(version, os, cpu): + prefix = "remote_jdk" if version == "8" else "remotejdk" + os_part = "win" if (os == "windows" and version != "8") else os + if cpu == "x86_64": + suffix = "" + elif cpu == "ppc": + suffix = "_ppc64le" + else: + suffix = "_" + cpu + return prefix + version + "_" + os_part + suffix + +def _zulu_remote_jdk_repo(os, cpu, release): + arch = cpu + if cpu == "x86_64": + arch = "x64" + platform = os + ext = ".tar.gz" + if os == "macos": + platform = "macosx" + elif os == "windows": + ext = ".zip" + platform = "win" + arch = "aarch64" if arch == "arm64" else arch + archive_name = "zulu" + release + "-" + platform + "_" + arch + urls = [ + "https://cdn.azul.com/zulu/bin/" + archive_name + ext, + "https://mirror.bazel.build/openjdk/azul-zulu-" + release + "/" + archive_name + ext, + ] + return urls, archive_name + +def _adoptium_linux_remote_jdk_repo(version, cpu, release): + os = "linux" + arch = cpu + if cpu == "ppc": + arch = "ppc64le" + archive_name = "OpenJDK" + version + "U-jdk_" + arch + "_" + os + "_hotspot_" + release.replace("+", "_") + ".tar.gz" + urls = [ + "https://github.com/adoptium/temurin" + version + "-binaries/releases/download/jdk-" + release + "/" + archive_name, + "https://mirror.bazel.build/github.com/adoptium/temurin" + version + "-binaries/releases/download/jdk-" + release + "/" + archive_name, + ] + return urls, "jdk-" + release + +def _microsoft_windows_arm64_remote_jdk_repo(release): + urls = [ + "https://aka.ms/download-jdk/microsoft-jdk-" + release + "-windows-aarch64.zip", + "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-" + release + "-windows-aarch64.zip", + ] + return urls, "" + +def _adoptopenjdk_remote_jdk_repo(version, os, cpu, release): + archive = "OpenJDK" + version + "U-jdk_" + cpu + "_" + os + "_hotspot_" + release.replace("-", "") + ".tar.gz" + urls = [ + "https://github.com/AdoptOpenJDK/openjdk" + version + "-binaries/releases/download/jdk" + release + "/" + archive, + ] + return urls, "jdk" + release + +def _flatten_configs(): + result = [] + for version, all_for_version in _RELEASE_CONFIGS.items(): + for distrib, distrib_cfg in all_for_version.items(): + release = distrib_cfg["release"] + for os, cpus in distrib_cfg["platforms"].items(): + for cpu in cpus: + name = _name_for_remote_jdk(version, os, cpu) + if distrib == "zulu": + urls, strip_prefix = _zulu_remote_jdk_repo(os, cpu, release) + elif distrib == "adoptium": + if os != "linux": + fail("adoptium jdk configured but not linux") + urls, strip_prefix = _adoptium_linux_remote_jdk_repo(version, cpu, release) + elif distrib == "microsoft": + if os != "windows" or cpu != "arm64": + fail("only windows_arm64 config for microsoft is expected") + urls, strip_prefix = _microsoft_windows_arm64_remote_jdk_repo(release) + elif distrib == "adoptopenjdk": + urls, strip_prefix = _adoptopenjdk_remote_jdk_repo(version, os, cpu, release) + else: + fail("unexpected distribution:", distrib) + result.append(struct( + name = name, + version = version, + urls = urls, + strip_prefix = _STRIP_PREFIX_OVERRIDES.get(name, strip_prefix), + target_compatible_with = ["@platforms//os:" + os, "@platforms//cpu:" + cpu], + )) + return result + +FLAT_CONFIGS = _flatten_configs() diff --git a/java/repositories.bzl b/java/repositories.bzl index f9c396ab..78200589 100644 --- a/java/repositories.bzl +++ b/java/repositories.bzl @@ -72,482 +72,292 @@ def local_jdk_repo(): build_file_content = JDK_BUILD_TEMPLATE, ) -def remote_jdk8_repos(name = ""): - """Imports OpenJDK 8 repositories. - - Args: - name: The name of this macro (not used) - """ - maybe( - remote_java_repository, +# DO NOT MANUALLY UPDATE! Update java/bazel/repositories_util.bzl instead and +# run the java/bazel:dump_remote_jdk_configs target to generate this list +_REMOTE_JDK_CONFIGS_LIST = [ + struct( name = "remote_jdk8_linux_aarch64", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:aarch64", - ], - sha256 = "f4072e82faa5a09fab2accf2892d4684324fc999d614583c3ff785e87c03963f", - strip_prefix = "zulu8.50.51.263-ca-jdk8.0.275-linux_aarch64", - urls = [ - "https://mirror.bazel.build/openjdk/azul-zulu-8.50.0.51-ca-jdk8.0.275/zulu8.50.51.263-ca-jdk8.0.275-linux_aarch64.tar.gz", - "https://cdn.azul.com/zulu-embedded/bin/zulu8.50.51.263-ca-jdk8.0.275-linux_aarch64.tar.gz", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64"], + sha256 = "82c46c65d57e187ef68fdd125ef760eaeb52ebfe1be1a6a251cf5b43cbebc78a", + strip_prefix = "zulu8.78.0.19-ca-jdk8.0.412-linux_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu8.78.0.19-ca-jdk8.0.412-linux_aarch64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-8.78.0.19-ca-jdk8.0.412/zulu8.78.0.19-ca-jdk8.0.412-linux_aarch64.tar.gz"], version = "8", - ) - 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, + ), + struct( name = "remote_jdk8_linux", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], - sha256 = "1db6b2fa642950ee1b4b1ec2b6bc8a9113d7a4cd723f79398e1ada7dab1c981c", - strip_prefix = "zulu8.50.0.51-ca-jdk8.0.275-linux_x64", - urls = [ - "https://mirror.bazel.build/openjdk/azul-zulu-8.50.0.51-ca-jdk8.0.275/zulu8.50.0.51-ca-jdk8.0.275-linux_x64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu8.50.0.51-ca-jdk8.0.275-linux_x64.tar.gz", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:x86_64"], + sha256 = "9c0ac5ebffa61520fee78ead52add0f4edd3b1b54b01b6a17429b719515caf90", + strip_prefix = "zulu8.78.0.19-ca-jdk8.0.412-linux_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu8.78.0.19-ca-jdk8.0.412-linux_x64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-8.78.0.19-ca-jdk8.0.412/zulu8.78.0.19-ca-jdk8.0.412-linux_x64.tar.gz"], version = "8", - ) - maybe( - remote_java_repository, + ), + struct( name = "remote_jdk8_macos_aarch64", - target_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:aarch64", - ], - sha256 = "e5c84a46bbd985c3a53358db9c97a6fd4930f92b833c3163a0d1e47dab59768c", - strip_prefix = "zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64.tar.gz", - ], + target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:aarch64"], + sha256 = "35bc35808379400e4a70e1f7ee379778881799b93c2cc9fe1ae515c03c2fb057", + strip_prefix = "zulu8.78.0.19-ca-jdk8.0.412-macosx_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu8.78.0.19-ca-jdk8.0.412-macosx_aarch64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-8.78.0.19-ca-jdk8.0.412/zulu8.78.0.19-ca-jdk8.0.412-macosx_aarch64.tar.gz"], version = "8", - ) - maybe( - remote_java_repository, + ), + struct( name = "remote_jdk8_macos", - target_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:x86_64", - ], - sha256 = "b03176597734299c9a15b7c2cc770783cf14d121196196c1248e80c026b59c17", - strip_prefix = "zulu8.50.0.51-ca-jdk8.0.275-macosx_x64", - urls = [ - "https://mirror.bazel.build/openjdk/azul-zulu-8.50.0.51-ca-jdk8.0.275/zulu8.50.0.51-ca-jdk8.0.275-macosx_x64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu8.50.0.51-ca-jdk8.0.275-macosx_x64.tar.gz", - ], + target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:x86_64"], + sha256 = "2bfa0506196962bddb21a604eaa2b0b39eaf3383d0bdad08bdbe7f42f25d8928", + strip_prefix = "zulu8.78.0.19-ca-jdk8.0.412-macosx_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu8.78.0.19-ca-jdk8.0.412-macosx_x64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-8.78.0.19-ca-jdk8.0.412/zulu8.78.0.19-ca-jdk8.0.412-macosx_x64.tar.gz"], version = "8", - ) - maybe( - remote_java_repository, + ), + struct( name = "remote_jdk8_windows", - target_compatible_with = [ - "@platforms//os:windows", - "@platforms//cpu:x86_64", - ], - sha256 = "49759b2bd2ab28231a21ff3a3bb45824ddef55d89b5b1a05a62e26a365da0774", - strip_prefix = "zulu8.50.0.51-ca-jdk8.0.275-win_x64", - urls = [ - "https://mirror.bazel.build/openjdk/azul-zulu-8.50.0.51-ca-jdk8.0.275/zulu8.50.0.51-ca-jdk8.0.275-win_x64.zip", - "https://cdn.azul.com/zulu/bin/zulu8.50.0.51-ca-jdk8.0.275-win_x64.zip", - ], + target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"], + sha256 = "ca5499c301d5b42604d8535b8c40a7f928a796247b8c66a600333dd799798ff7", + strip_prefix = "zulu8.78.0.19-ca-jdk8.0.412-win_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu8.78.0.19-ca-jdk8.0.412-win_x64.zip", "https://mirror.bazel.build/openjdk/azul-zulu-8.78.0.19-ca-jdk8.0.412/zulu8.78.0.19-ca-jdk8.0.412-win_x64.zip"], version = "8", - ) - -def remote_jdk11_repos(): - """Imports OpenJDK 11 repositories.""" - maybe( - remote_java_repository, + ), + struct( + 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", + ), + struct( + name = "remotejdk11_linux_aarch64", + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64"], + sha256 = "be7d7574253c893eb58f66e985c75adf48558c41885827d1f02f827e109530e0", + strip_prefix = "zulu11.72.19-ca-jdk11.0.23-linux_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu11.72.19-ca-jdk11.0.23-linux_aarch64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-11.72.19-ca-jdk11.0.23/zulu11.72.19-ca-jdk11.0.23-linux_aarch64.tar.gz"], + version = "11", + ), + struct( name = "remotejdk11_linux", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], - sha256 = "a34b404f87a08a61148b38e1416d837189e1df7a040d949e743633daf4695a3c", - strip_prefix = "zulu11.66.15-ca-jdk11.0.20-linux_x64", - urls = [ - "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", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:x86_64"], + sha256 = "0a4d1bfc7a96a7f9f5329b72b9801b3c53366417b4753f1b658fa240204c7347", + strip_prefix = "zulu11.72.19-ca-jdk11.0.23-linux_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu11.72.19-ca-jdk11.0.23-linux_x64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-11.72.19-ca-jdk11.0.23/zulu11.72.19-ca-jdk11.0.23-linux_x64.tar.gz"], version = "11", - ) - - maybe( - remote_java_repository, - name = "remotejdk11_linux_aarch64", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:aarch64", - ], - sha256 = "54174439f2b3fddd11f1048c397fe7bb45d4c9d66d452d6889b013d04d21c4de", - strip_prefix = "zulu11.66.15-ca-jdk11.0.20-linux_aarch64", - urls = [ - "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", - ], + ), + struct( + name = "remotejdk11_macos_aarch64", + target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:aarch64"], + sha256 = "40fb1918385e03814b67b7608c908c7f945ccbeddbbf5ed062cdfb2602e21c83", + strip_prefix = "zulu11.72.19-ca-jdk11.0.23-macosx_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu11.72.19-ca-jdk11.0.23-macosx_aarch64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-11.72.19-ca-jdk11.0.23/zulu11.72.19-ca-jdk11.0.23-macosx_aarch64.tar.gz"], version = "11", - ) - - maybe( - remote_java_repository, + ), + struct( + name = "remotejdk11_macos", + target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:x86_64"], + sha256 = "e5b19b82045826ae09c9d17742691bc9e40312c44be7bd7598ae418a3d4edb1c", + strip_prefix = "zulu11.72.19-ca-jdk11.0.23-macosx_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu11.72.19-ca-jdk11.0.23-macosx_x64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-11.72.19-ca-jdk11.0.23/zulu11.72.19-ca-jdk11.0.23-macosx_x64.tar.gz"], + version = "11", + ), + struct( + name = "remotejdk11_win", + target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"], + sha256 = "1295b2affe498018c45f6f15187b58c4456d51dce5eb608ee73ef7665d4566d2", + strip_prefix = "zulu11.72.19-ca-jdk11.0.23-win_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu11.72.19-ca-jdk11.0.23-win_x64.zip", "https://mirror.bazel.build/openjdk/azul-zulu-11.72.19-ca-jdk11.0.23/zulu11.72.19-ca-jdk11.0.23-win_x64.zip"], + version = "11", + ), + struct( name = "remotejdk11_linux_ppc64le", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:ppc", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:ppc"], sha256 = "a8fba686f6eb8ae1d1a9566821dbd5a85a1108b96ad857fdbac5c1e4649fc56f", strip_prefix = "jdk-11.0.15+10", - urls = [ - "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz", - "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz", - ], + urls = ["https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_ppc64le_linux_hotspot_11.0.15_10.tar.gz"], version = "11", - ) - - maybe( - remote_java_repository, + ), + struct( name = "remotejdk11_linux_s390x", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:s390x", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:s390x"], sha256 = "a58fc0361966af0a5d5a31a2d8a208e3c9bb0f54f345596fd80b99ea9a39788b", strip_prefix = "jdk-11.0.15+10", - urls = [ - "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz", - "https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz", - ], + urls = ["https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.15+10/OpenJDK11U-jdk_s390x_linux_hotspot_11.0.15_10.tar.gz"], version = "11", - ) - - maybe( - remote_java_repository, - name = "remotejdk11_macos", - target_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:x86_64", - ], - sha256 = "bcaab11cfe586fae7583c6d9d311c64384354fb2638eb9a012eca4c3f1a1d9fd", - strip_prefix = "zulu11.66.15-ca-jdk11.0.20-macosx_x64", - urls = [ - "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", - ) - - maybe( - remote_java_repository, - name = "remotejdk11_macos_aarch64", - target_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu: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.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", - ) - - maybe( - remote_java_repository, - name = "remotejdk11_win", - target_compatible_with = [ - "@platforms//os:windows", - "@platforms//cpu:x86_64", - ], - sha256 = "43408193ce2fa0862819495b5ae8541085b95660153f2adcf91a52d3a1710e83", - strip_prefix = "zulu11.66.15-ca-jdk11.0.20-win_x64", - urls = [ - "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", - ) - - maybe( - remote_java_repository, + ), + struct( name = "remotejdk11_win_arm64", - target_compatible_with = [ - "@platforms//os:windows", - "@platforms//cpu:arm64", - ], + target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:arm64"], sha256 = "b8a28e6e767d90acf793ea6f5bed0bb595ba0ba5ebdf8b99f395266161e53ec2", strip_prefix = "jdk-11.0.13+8", - urls = [ - "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-windows-aarch64.zip", - ], + urls = ["https://aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-windows-aarch64.zip", "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-11.0.13.8.1-windows-aarch64.zip"], version = "11", - ) - -def remote_jdk17_repos(): - """Imports OpenJDK 17 repositories.""" - maybe( - remote_java_repository, - name = "remotejdk17_linux", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], - sha256 = "b9482f2304a1a68a614dfacddcf29569a72f0fac32e6c74f83dc1b9a157b8340", - strip_prefix = "zulu17.44.53-ca-jdk17.0.8.1-linux_x64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_x64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_x64.tar.gz", - ], - version = "17", - ) - - maybe( - remote_java_repository, + ), + struct( name = "remotejdk17_linux_aarch64", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:aarch64", - ], - sha256 = "6531cef61e416d5a7b691555c8cf2bdff689201b8a001ff45ab6740062b44313", - strip_prefix = "zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-linux_aarch64.tar.gz", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64"], + sha256 = "518cc455c0c7b49c0ae7d809c0bb87ab371bb850d46abb8efad5010c6a06faec", + strip_prefix = "zulu17.50.19-ca-jdk17.0.11-linux_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-jdk17.0.11-linux_aarch64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-17.50.19-ca-jdk17.0.11/zulu17.50.19-ca-jdk17.0.11-linux_aarch64.tar.gz"], version = "17", - ) - - maybe( - remote_java_repository, - name = "remotejdk17_linux_s390x", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:s390x", - ], - sha256 = "ffacba69c6843d7ca70d572489d6cc7ab7ae52c60f0852cedf4cf0d248b6fc37", - strip_prefix = "jdk-17.0.8.1+1", - urls = [ - "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.8.1_1.tar.gz", - "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.8.1_1.tar.gz", - ], + ), + struct( + name = "remotejdk17_linux", + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:x86_64"], + sha256 = "a1e8ac9ae5804b84dc07cf9d8ebe1b18247d70c92c1e0de97ea10109563f4379", + strip_prefix = "zulu17.50.19-ca-jdk17.0.11-linux_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-jdk17.0.11-linux_x64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-17.50.19-ca-jdk17.0.11/zulu17.50.19-ca-jdk17.0.11-linux_x64.tar.gz"], version = "17", - ) - - maybe( - remote_java_repository, - name = "remotejdk17_linux_ppc64le", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:ppc", - ], - sha256 = "00a4c07603d0218cd678461b5b3b7e25b3253102da4022d31fc35907f21a2efd", - strip_prefix = "jdk-17.0.8.1+1", - urls = [ - "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.8.1_1.tar.gz", - "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1%2B1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.8.1_1.tar.gz", - ], + ), + struct( + name = "remotejdk17_macos_aarch64", + target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:aarch64"], + sha256 = "dd1a82d57e80cdefb045066e5c28b5bd41e57eea9c57303ec7e012b57230bb9c", + strip_prefix = "zulu17.50.19-ca-jdk17.0.11-macosx_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-jdk17.0.11-macosx_aarch64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-17.50.19-ca-jdk17.0.11/zulu17.50.19-ca-jdk17.0.11-macosx_aarch64.tar.gz"], version = "17", - ) - - maybe( - remote_java_repository, + ), + struct( name = "remotejdk17_macos", - target_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:x86_64", - ], - sha256 = "640453e8afe8ffe0fb4dceb4535fb50db9c283c64665eebb0ba68b19e65f4b1f", - strip_prefix = "zulu17.44.53-ca-jdk17.0.8.1-macosx_x64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_x64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_x64.tar.gz", - ], + target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:x86_64"], + sha256 = "b384991e93af39abe5229c7f5efbe912a7c5a6480674a6e773f3a9128f96a764", + strip_prefix = "zulu17.50.19-ca-jdk17.0.11-macosx_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-jdk17.0.11-macosx_x64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-17.50.19-ca-jdk17.0.11/zulu17.50.19-ca-jdk17.0.11-macosx_x64.tar.gz"], version = "17", - ) - - maybe( - remote_java_repository, - name = "remotejdk17_macos_aarch64", - target_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:aarch64", - ], - sha256 = "314b04568ec0ae9b36ba03c9cbd42adc9e1265f74678923b19297d66eb84dcca", - strip_prefix = "zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-macosx_aarch64.tar.gz", - ], + ), + struct( + name = "remotejdk17_win_arm64", + target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:arm64"], + sha256 = "b8833d272eb31f54f8c881139807a28a74de9deae07d2cc37688ff72043e32c9", + strip_prefix = "zulu17.50.19-ca-jdk17.0.11-win_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-jdk17.0.11-win_aarch64.zip", "https://mirror.bazel.build/openjdk/azul-zulu-17.50.19-ca-jdk17.0.11/zulu17.50.19-ca-jdk17.0.11-win_aarch64.zip"], version = "17", - ) - maybe( - remote_java_repository, + ), + struct( name = "remotejdk17_win", - target_compatible_with = [ - "@platforms//os:windows", - "@platforms//cpu:x86_64", - ], - sha256 = "192f2afca57701de6ec496234f7e45d971bf623ff66b8ee4a5c81582054e5637", - strip_prefix = "zulu17.44.53-ca-jdk17.0.8.1-win_x64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_x64.zip", - "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_x64.zip", - ], + target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"], + sha256 = "43f0f1bdecf48ba9763d46ee7784554c95b442ffdd39ebd62dc8b297cc82e116", + strip_prefix = "zulu17.50.19-ca-jdk17.0.11-win_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-jdk17.0.11-win_x64.zip", "https://mirror.bazel.build/openjdk/azul-zulu-17.50.19-ca-jdk17.0.11/zulu17.50.19-ca-jdk17.0.11-win_x64.zip"], version = "17", - ) - maybe( - remote_java_repository, - name = "remotejdk17_win_arm64", - target_compatible_with = [ - "@platforms//os:windows", - "@platforms//cpu:arm64", - ], - sha256 = "6802c99eae0d788e21f52d03cab2e2b3bf42bc334ca03cbf19f71eb70ee19f85", - strip_prefix = "zulu17.44.53-ca-jdk17.0.8.1-win_aarch64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_aarch64.zip", - "https://cdn.azul.com/zulu/bin/zulu17.44.53-ca-jdk17.0.8.1-win_aarch64.zip", - ], + ), + struct( + name = "remotejdk17_linux_ppc64le", + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:ppc"], + sha256 = "00a4c07603d0218cd678461b5b3b7e25b3253102da4022d31fc35907f21a2efd", + strip_prefix = "jdk-17.0.8.1+1", + urls = ["https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1+1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.8.1_1.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1+1/OpenJDK17U-jdk_ppc64le_linux_hotspot_17.0.8.1_1.tar.gz"], version = "17", - ) - -def remote_jdk21_repos(): - """Imports OpenJDK 21 repositories.""" - maybe( - remote_java_repository, + ), + struct( + name = "remotejdk17_linux_s390x", + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:s390x"], + sha256 = "ffacba69c6843d7ca70d572489d6cc7ab7ae52c60f0852cedf4cf0d248b6fc37", + strip_prefix = "jdk-17.0.8.1+1", + urls = ["https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1+1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.8.1_1.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.8.1+1/OpenJDK17U-jdk_s390x_linux_hotspot_17.0.8.1_1.tar.gz"], + version = "17", + ), + struct( + name = "remotejdk21_linux_aarch64", + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64"], + sha256 = "c898d4ce365c8926e22859c06be4a81bafb9fd0126088867e15a528fe99b1599", + strip_prefix = "zulu21.34.19-ca-jdk21.0.3-linux_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-linux_aarch64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-21.34.19-ca-jdk21.0.3/zulu21.34.19-ca-jdk21.0.3-linux_aarch64.tar.gz"], + version = "21", + ), + struct( name = "remotejdk21_linux", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:x86_64", - ], - sha256 = "5ad730fbee6bb49bfff10bf39e84392e728d89103d3474a7e5def0fd134b300a", - strip_prefix = "zulu21.32.17-ca-jdk21.0.2-linux_x64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_x64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_x64.tar.gz", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:x86_64"], + sha256 = "ca763d1308a6bcc768382f160733a08e591d5f595a7dd9e51b60d27d54828dcc", + strip_prefix = "zulu21.34.19-ca-jdk21.0.3-linux_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-linux_x64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-21.34.19-ca-jdk21.0.3/zulu21.34.19-ca-jdk21.0.3-linux_x64.tar.gz"], version = "21", - ) - maybe( - remote_java_repository, - name = "remotejdk21_linux_aarch64", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:aarch64", - ], - sha256 = "ce7df1af5d44a9f455617c4b8891443fbe3e4b269c777d8b82ed66f77167cfe0", - strip_prefix = "zulu21.32.17-ca-jdk21.0.2-linux_aarch64", - urls = [ - "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz", - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-linux_aarch64.tar.gz", - ], + ), + struct( + name = "remotejdk21_macos_aarch64", + target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:aarch64"], + sha256 = "4f42a561909d71868a700cf2efa1390e1b9e04863f3fa75ea30c4965e5a702f0", + strip_prefix = "zulu21.34.19-ca-jdk21.0.3-macosx_aarch64", + urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-macosx_aarch64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-21.34.19-ca-jdk21.0.3/zulu21.34.19-ca-jdk21.0.3-macosx_aarch64.tar.gz"], version = "21", - ) - maybe( - remote_java_repository, + ), + struct( + name = "remotejdk21_macos", + target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:x86_64"], + sha256 = "148006a220a18922d7a9c52ac0bad099c5b4e60334a8d02b11f8c945e9ec9a34", + strip_prefix = "zulu21.34.19-ca-jdk21.0.3-macosx_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-macosx_x64.tar.gz", "https://mirror.bazel.build/openjdk/azul-zulu-21.34.19-ca-jdk21.0.3/zulu21.34.19-ca-jdk21.0.3-macosx_x64.tar.gz"], + version = "21", + ), + struct( + name = "remotejdk21_win", + target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"], + sha256 = "fb9f0dc6a484b0b169b3b3a3c2425d5f62bebfd15cb06c1597e33f77959c72af", + strip_prefix = "zulu21.34.19-ca-jdk21.0.3-win_x64", + urls = ["https://cdn.azul.com/zulu/bin/zulu21.34.19-ca-jdk21.0.3-win_x64.zip", "https://mirror.bazel.build/openjdk/azul-zulu-21.34.19-ca-jdk21.0.3/zulu21.34.19-ca-jdk21.0.3-win_x64.zip"], + version = "21", + ), + struct( name = "remotejdk21_linux_ppc64le", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:ppc", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:ppc"], sha256 = "d08de863499d8851811c893e8915828f2cd8eb67ed9e29432a6b4e222d80a12f", strip_prefix = "jdk-21.0.2+13", - urls = [ - "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.2_13.tar.gz", - "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.2_13.tar.gz", - ], + urls = ["https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.2_13.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_ppc64le_linux_hotspot_21.0.2_13.tar.gz"], version = "21", - ) - maybe( - remote_java_repository, + ), + struct( name = "remotejdk21_linux_s390x", - target_compatible_with = [ - "@platforms//os:linux", - "@platforms//cpu:s390x", - ], + target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:s390x"], sha256 = "0d5676c50821e0d0b951bf3ffd717e7a13be2a89d8848a5c13b4aedc6f982c78", strip_prefix = "jdk-21.0.2+13", - urls = [ - "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.2_13.tar.gz", - "https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.2_13.tar.gz", - ], - version = "21", - ) - maybe( - remote_java_repository, - name = "remotejdk21_macos", - target_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:x86_64", - ], - sha256 = "3ad8fe288eb57d975c2786ae453a036aa46e47ab2ac3d81538ebae2a54d3c025", - strip_prefix = "zulu21.32.17-ca-jdk21.0.2-macosx_x64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_x64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_x64.tar.gz", - ], - version = "21", - ) - - maybe( - remote_java_repository, - name = "remotejdk21_macos_aarch64", - target_compatible_with = [ - "@platforms//os:macos", - "@platforms//cpu:aarch64", - ], - sha256 = "e8260516de8b60661422a725f1df2c36ef888f6fb35393566b00e7325db3d04e", - strip_prefix = "zulu21.32.17-ca-jdk21.0.2-macosx_aarch64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_aarch64.tar.gz", - "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-macosx_aarch64.tar.gz", - ], + urls = ["https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.2_13.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2+13/OpenJDK21U-jdk_s390x_linux_hotspot_21.0.2_13.tar.gz"], version = "21", - ) - maybe( - remote_java_repository, - name = "remotejdk21_win", - target_compatible_with = [ - "@platforms//os:windows", - "@platforms//cpu:x86_64", - ], - sha256 = "f7cc15ca17295e69c907402dfe8db240db446e75d3b150da7bf67243cded93de", - strip_prefix = "zulu21.32.17-ca-jdk21.0.2-win_x64", - urls = [ - "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-win_x64.zip", - "https://cdn.azul.com/zulu/bin/zulu21.32.17-ca-jdk21.0.2-win_x64.zip", - ], - version = "21", - ) - maybe( - remote_java_repository, + ), + struct( name = "remotejdk21_win_arm64", - target_compatible_with = [ - "@platforms//os:windows", - "@platforms//cpu:arm64", - ], + target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:arm64"], sha256 = "975603e684f2ec5a525b3b5336d6aa0b09b5b7d2d0d9e271bd6a9892ad550181", strip_prefix = "jdk-21+35", - urls = [ - "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-aarch64.zip", - "https://aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-aarch64.zip", - ], + urls = ["https://aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-aarch64.zip", "https://mirror.bazel.build/aka.ms/download-jdk/microsoft-jdk-21.0.0-windows-aarch64.zip"], version = "21", - ) + ), +] + +def _make_version_to_remote_jdks(): + result = {} + for cfg in _REMOTE_JDK_CONFIGS_LIST: + result.setdefault(cfg.version, []) + result[cfg.version].append(cfg) + return result + +# visible for testing +REMOTE_JDK_CONFIGS = _make_version_to_remote_jdks() + +def _remote_jdk_repos_for_version(version): + for item in REMOTE_JDK_CONFIGS[version]: + maybe( + remote_java_repository, + name = item.name, + target_compatible_with = item.target_compatible_with, + sha256 = item.sha256, + strip_prefix = item.strip_prefix, + urls = item.urls, + version = item.version, + ) + +def remote_jdk8_repos(name = ""): + """Imports OpenJDK 8 repositories. + + Args: + name: The name of this macro (not used) + """ + _remote_jdk_repos_for_version("8") + +def remote_jdk11_repos(): + """Imports OpenJDK 11 repositories.""" + _remote_jdk_repos_for_version("11") + +def remote_jdk17_repos(): + """Imports OpenJDK 17 repositories.""" + _remote_jdk_repos_for_version("17") + +def remote_jdk21_repos(): + """Imports OpenJDK 21 repositories.""" + _remote_jdk_repos_for_version("21") def rules_java_dependencies(): """An utility method to load all dependencies of rules_java. @@ -568,26 +378,13 @@ def rules_java_toolchains(name = "toolchains"): Args: name: The name of this macro (not used) """ - JDKS = { - # Must match JDK repos defined in remote_jdk8_repos() - "8": ["linux", "linux_aarch64", "linux_s390x", "macos", "macos_aarch64", "windows"], - # 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_jdk21_repos() - "21": ["linux", "linux_aarch64", "macos", "macos_aarch64", "win"], - } - - REMOTE_JDK_REPOS = [(("remote_jdk" if version == "8" else "remotejdk") + version + "_" + platform) for version in JDKS for platform in JDKS[version]] - native.register_toolchains( "//toolchains:all", "@local_jdk//:runtime_toolchain_definition", "@local_jdk//:bootstrap_runtime_toolchain_definition", ) - for name in REMOTE_JDK_REPOS: + for __, item in REMOTE_JDK_CONFIGS: native.register_toolchains( - "@" + name + "_toolchain_config_repo//:toolchain", - "@" + name + "_toolchain_config_repo//:bootstrap_runtime_toolchain", + "@" + item.name + "_toolchain_config_repo//:toolchain", + "@" + item.name + "_toolchain_config_repo//:bootstrap_runtime_toolchain", ) diff --git a/test/BUILD.bazel b/test/BUILD.bazel new file mode 100644 index 00000000..554df4b1 --- /dev/null +++ b/test/BUILD.bazel @@ -0,0 +1,29 @@ +# Copyright 2024 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +load("//java:repositories.bzl", "REMOTE_JDK_CONFIGS") + +sh_test( + name = "check_remote_jdk_configs_test", + srcs = ["check_remote_jdk_configs.sh"], + args = [ + ",".join([ + config.name, + config.urls[0], + config.sha256, + config.strip_prefix, + ]) + for configs in REMOTE_JDK_CONFIGS.values() + for config in configs + ], +) diff --git a/test/check_remote_jdk_configs.sh b/test/check_remote_jdk_configs.sh new file mode 100644 index 00000000..3de64be3 --- /dev/null +++ b/test/check_remote_jdk_configs.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Copyright 2024 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +echo "Checking hashes and strip_prefix for $# configs" + +for config in "$@"; do + TMP_FILE=$(mktemp -q /tmp/remotejdk.XXXXXX) + IFS=, read -r name url hash strip_prefix <<< "${config}" + echo "fetching $name from $url to ${TMP_FILE}" + curl --silent -o ${TMP_FILE} -L "$url" + actual_hash=`sha256sum ${TMP_FILE} | cut -d' ' -f1` + if [ "${hash}" != "${actual_hash}" ]; then + echo "ERROR: wrong hash for ${name}! wanted: ${hash}, got: ${actual_hash}" + exit 1 + fi + if [[ -z "${url##*.tar.gz}" ]]; then + root_dir=`tar ztf ${TMP_FILE} --exclude='*/*'` + elif [[ -z "${url##*.zip}" ]]; then + root_dir=`unzip -Z1 ${TMP_FILE} | head -n1` + else + echo "ERROR: unexpected archive type for ${name}" + exit 1 + fi + if [ "${root_dir}" != "${strip_prefix}/" ]; then + echo "ERROR: bad strip_prefix for ${name}, wanted: ${strip_prefix}/, got: ${root_dir}" + exit 1 + fi +done \ No newline at end of file