Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ JDKS = {
"win",
"win_arm64",
],
"27": [
"linux",
"linux_aarch64",
"linux_ppc64le",
"linux_riscv64",
"linux_s390x",
"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]]
Expand Down
17 changes: 17 additions & 0 deletions java/bazel/repositories_util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,22 @@ _RELEASE_CONFIGS = {
},
},
},
"27": {
"zulu": {
"release": "27.28.101-ca-jdk27.0.0",
"platforms": {
"linux": ["aarch64", "x86_64"],
"macos": ["aarch64", "x86_64"],
"windows": ["x86_64"],
},
},
"adoptium": {
"release": "27+35",
"platforms": {
"linux": ["ppc64le", "riscv64", "s390x"],
},
},
},
}

_STRIP_PREFIX_OVERRIDES = {
Expand Down Expand Up @@ -197,6 +213,7 @@ def _flatten_configs():
urls, strip_prefix = _adoptopenjdk_remote_jdk_repo(version, os, cpu, release)
else:
fail("unexpected distribution:", distrib)

result.append(struct(
name = name,
version = version,
Expand Down
2 changes: 2 additions & 0 deletions java/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ load(
"remote_jdk17_repos",
"remote_jdk21_repos",
"remote_jdk25_repos",
"remote_jdk27_repos",
"remote_jdk8_repos",
)
load("//toolchains:extensions.bzl", _java_repository = "java_repository")
Expand All @@ -34,6 +35,7 @@ def _toolchains_impl(module_ctx):
remote_jdk17_repos()
remote_jdk21_repos()
remote_jdk25_repos()
remote_jdk27_repos()

if bazel_features.external_deps.extension_metadata_has_reproducible:
return module_ctx.extension_metadata(reproducible = True)
Expand Down
71 changes: 71 additions & 0 deletions java/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,72 @@ _REMOTE_JDK_CONFIGS_LIST = [
urls = ["https://github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.2+10/OpenJDK25U-jdk_s390x_linux_hotspot_25.0.2_10.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin25-binaries/releases/download/jdk-25.0.2+10/OpenJDK25U-jdk_s390x_linux_hotspot_25.0.2_10.tar.gz"],
version = "25",
),
struct(
name = "remotejdk27_linux_aarch64",
target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:aarch64"],
sha256 = "9fa5bf865783c43840101fcdc3a5222b60daf4fe11f26806247bf807c08aba38",
strip_prefix = "zulu27.28.101-ca-jdk27.0.0-linux_aarch64",
urls = ["https://cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-linux_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-linux_aarch64.tar.gz"],
version = "27",
),
struct(
name = "remotejdk27_linux",
target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:x86_64"],
sha256 = "ccbc15c4edbedfdcc03c2d29a2aa2c6daf9e6ffb4cda7dd5ece0fcbb37350267",
strip_prefix = "zulu27.28.101-ca-jdk27.0.0-linux_x64",
urls = ["https://cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-linux_x64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-linux_x64.tar.gz"],
version = "27",
),
struct(
name = "remotejdk27_macos_aarch64",
target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:aarch64"],
sha256 = "0d8f1d1912fa938ebd95499eb1e8a2a987725fe42aa0dd98497bb604748a8d07",
strip_prefix = "zulu27.28.101-ca-jdk27.0.0-macosx_aarch64",
urls = ["https://cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-macosx_aarch64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-macosx_aarch64.tar.gz"],
version = "27",
patch_cmds = ["ln -s Contents/Home/* ."],
),
struct(
name = "remotejdk27_macos",
target_compatible_with = ["@platforms//os:macos", "@platforms//cpu:x86_64"],
sha256 = "b5d64393a228ad8680e5936cb114243118d3f6d87b668f0280ef8c15d674439c",
strip_prefix = "zulu27.28.101-ca-jdk27.0.0-macosx_x64",
urls = ["https://cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-macosx_x64.tar.gz", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-macosx_x64.tar.gz"],
version = "27",
patch_cmds = ["ln -s Contents/Home/* ."],
),
struct(
name = "remotejdk27_win",
target_compatible_with = ["@platforms//os:windows", "@platforms//cpu:x86_64"],
sha256 = "99395b64049c2754005746c4f4b66fdb80c98c3cabaa14d4b25a7f8815c997b8",
strip_prefix = "zulu27.28.101-ca-jdk27.0.0-win_x64",
urls = ["https://cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-win_x64.zip", "https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu27.28.101-ca-jdk27.0.0-win_x64.zip"],
version = "27",
),
struct(
name = "remotejdk27_linux_ppc64le",
target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:ppc64le"],
sha256 = "49a350d6e0fe41f7ee94ffaf101f0951f35042e86c52efa8a751a38fcb2126bb",
strip_prefix = "jdk-27+35",
urls = ["https://github.com/adoptium/temurin27-binaries/releases/download/jdk-27+35/OpenJDK27U-jdk_ppc64le_linux_hotspot_27_35.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin27-binaries/releases/download/jdk-27+35/OpenJDK27U-jdk_ppc64le_linux_hotspot_27_35.tar.gz"],
version = "27",
),
struct(
name = "remotejdk27_linux_riscv64",
target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:riscv64"],
sha256 = "270d74d7732adbaa7af4e153154126c144e6000bb736fd0985421f75075555aa",
strip_prefix = "jdk-27+35",
urls = ["https://github.com/adoptium/temurin27-binaries/releases/download/jdk-27+35/OpenJDK27U-jdk_riscv64_linux_hotspot_27_35.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin27-binaries/releases/download/jdk-27+35/OpenJDK27U-jdk_riscv64_linux_hotspot_27_35.tar.gz"],
version = "27",
),
struct(
name = "remotejdk27_linux_s390x",
target_compatible_with = ["@platforms//os:linux", "@platforms//cpu:s390x"],
sha256 = "5bc83a1453c2b68963218717f138512ce10d7553a68432082e6553ac31fa829b",
strip_prefix = "jdk-27+35",
urls = ["https://github.com/adoptium/temurin27-binaries/releases/download/jdk-27+35/OpenJDK27U-jdk_s390x_linux_hotspot_27_35.tar.gz", "https://mirror.bazel.build/github.com/adoptium/temurin27-binaries/releases/download/jdk-27+35/OpenJDK27U-jdk_s390x_linux_hotspot_27_35.tar.gz"],
version = "27",
),
]

def _make_version_to_remote_jdks():
Expand Down Expand Up @@ -462,6 +528,10 @@ def remote_jdk25_repos():
"""Imports OpenJDK 25 repositories."""
_remote_jdk_repos_for_version("25")

def remote_jdk27_repos():
"""Imports OpenJDK 27 repositories."""
_remote_jdk_repos_for_version("27")

def rules_java_dependencies():
"""DEPRECATED: No-op, kept for backwards compatibility"""
print("DEPRECATED: use rules_java_dependencies() from rules_java_deps.bzl") # buildifier: disable=print
Expand All @@ -478,6 +548,7 @@ def rules_java_toolchains(name = "toolchains"):
remote_jdk17_repos()
remote_jdk21_repos()
remote_jdk25_repos()
remote_jdk27_repos()
java_tools_repos()

native.register_toolchains(
Expand Down
16 changes: 16 additions & 0 deletions toolchains/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,16 @@ RELEASES = (8, 9, 10, 11, 17, 21, 25)
for release in RELEASES
]

# The default configuration runs javac on JDK 25, which rejects source/target 27.
# Use JDK 27 here without changing the compiler JDK for older language versions.
default_java_toolchain(
name = "toolchain_jdk_27",
configuration = DEFAULT_TOOLCHAIN_CONFIGURATION,
java_runtime = ":remotejdk_27",
source_version = "27",
target_version = "27",
)

default_java_toolchain(
name = "prebuilt_toolchain",
configuration = PREBUILT_TOOLCHAIN_CONFIGURATION,
Expand Down Expand Up @@ -427,6 +437,12 @@ java_runtime_version_alias(
visibility = ["//visibility:public"],
)

java_runtime_version_alias(
name = "remotejdk_27",
runtime_version = "remotejdk_27",
visibility = ["//visibility:public"],
)

java_runtime_version_alias(
name = "jdk_8",
runtime_version = "8",
Expand Down