Skip to content

Commit

Permalink
Add a Java 17 toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
cushon committed Sep 28, 2021
1 parent 9bec271 commit d7707e0
Show file tree
Hide file tree
Showing 10 changed files with 452 additions and 2 deletions.
116 changes: 116 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,62 @@ http_archive(
],
)

# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
http_archive(
name = "remotejdk17_linux_for_testing",
build_file = "@local_jdk//:BUILD.bazel",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
sha256 = "37c4f8e48536cceae8c6c20250d6c385e176972532fd35759fa7d6015c965f56",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-linux_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-linux_x64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-linux_x64.tar.gz",
],
)

# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
http_archive(
name = "remotejdk17_macos_for_testing",
build_file = "@local_jdk//:BUILD.bazel",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
sha256 = "6029b1fe6853cecad22ab99ac0b3bb4fb8c903dd2edefa91c3abc89755bbd47d",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-macosx_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_x64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_x64.tar.gz",
],
)

# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
http_archive(
name = "remotejdk17_macos_aarch64_for_testing",
build_file = "@local_jdk//:BUILD.bazel",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
sha256 = "6b17f01f767ee7abf4704149ca4d86423aab9b16b68697b7d36e9b616846a8b0",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-macosx_aarch64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_aarch64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_aarch64.tar.gz",
],
)

# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
http_archive(
name = "remotejdk17_win_for_testing",
build_file = "@local_jdk//:BUILD.bazel",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
sha256 = "f4437011239f3f0031c794bb91c02a6350bc941d4196bdd19c9f157b491815a3",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-win_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-win_x64.zip",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-win_x64.zip",
],
)

# Used in src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
dist_http_archive(
name = "remote_java_tools_for_testing",
Expand Down Expand Up @@ -906,6 +962,66 @@ exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
],
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
http_archive(
name = "openjdk17_linux_archive",
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
sha256 = "37c4f8e48536cceae8c6c20250d6c385e176972532fd35759fa7d6015c965f56",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-linux_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-linux_x64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-linux_x64.tar.gz",
],
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
http_archive(
name = "openjdk17_darwin_archive",
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
sha256 = "6029b1fe6853cecad22ab99ac0b3bb4fb8c903dd2edefa91c3abc89755bbd47d",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-macosx_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_x64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_x64.tar.gz",
],
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
http_archive(
name = "openjdk17_darwin_aarch64_archive",
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
sha256 = "6b17f01f767ee7abf4704149ca4d86423aab9b16b68697b7d36e9b616846a8b0",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-macosx_aarch64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_aarch64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_aarch64.tar.gz",
],
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
http_archive(
name = "openjdk17_windows_archive",
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
sha256 = "f4437011239f3f0031c794bb91c02a6350bc941d4196bdd19c9f157b491815a3",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-win_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-win_x64.zip",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-win_x64.zip",
],
)

load("@io_bazel_skydoc//:setup.bzl", "stardoc_repositories")

stardoc_repositories()
Expand Down
8 changes: 8 additions & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ filegroup(
"@openjdk16_darwin_archive//:WORKSPACE",
"@openjdk16_linux_archive//:WORKSPACE",
"@openjdk16_windows_archive//:WORKSPACE",
"@openjdk17_darwin_aarch64_archive//:WORKSPACE",
"@openjdk17_darwin_archive//:WORKSPACE",
"@openjdk17_linux_archive//:WORKSPACE",
"@openjdk17_windows_archive//:WORKSPACE",
"@openjdk_linux_aarch64_minimal//file",
"@openjdk_linux_minimal//file",
"@openjdk_macos_aarch64_minimal//file",
Expand Down Expand Up @@ -686,6 +690,10 @@ filegroup(
"@remotejdk16_macos_aarch64_for_testing//:WORKSPACE",
"@remotejdk16_macos_for_testing//:WORKSPACE",
"@remotejdk16_win_for_testing//:WORKSPACE",
"@remotejdk17_linux_for_testing//:WORKSPACE",
"@remotejdk17_macos_aarch64_for_testing//:WORKSPACE",
"@remotejdk17_macos_for_testing//:WORKSPACE",
"@remotejdk17_win_for_testing//:WORKSPACE",
"@rules_cc//:WORKSPACE",
"@rules_java//:WORKSPACE",
"@rules_pkg//:WORKSPACE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,74 @@ maybe(
version = "16",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
name = "remotejdk17_linux",
exec_compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
],
sha256 = "37c4f8e48536cceae8c6c20250d6c385e176972532fd35759fa7d6015c965f56",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-linux_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-linux_x64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-linux_x64.tar.gz",
],
version = "17",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
name = "remotejdk17_macos",
exec_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
],
sha256 = "6029b1fe6853cecad22ab99ac0b3bb4fb8c903dd2edefa91c3abc89755bbd47d",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-macosx_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_x64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_x64.tar.gz",
],
version = "17",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
name = "remotejdk17_macos_aarch64",
exec_compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:aarch64",
],
sha256 = "6b17f01f767ee7abf4704149ca4d86423aab9b16b68697b7d36e9b616846a8b0",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-macosx_aarch64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_aarch64.tar.gz",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-macosx_aarch64.tar.gz",
],
version = "17",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
name = "remotejdk17_win",
exec_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
],
sha256 = "f4437011239f3f0031c794bb91c02a6350bc941d4196bdd19c9f157b491815a3",
strip_prefix = "zulu17.28.13-ca-jdk17.0.0-win_x64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-win_x64.zip",
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-win_x64.zip",
],
version = "17",
)

{remote_java_tools}
{remote_java_tools_linux}
{remote_java_tools_windows}
Expand Down
4 changes: 4 additions & 0 deletions src/test/py/bazel/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class TestBase(unittest.TestCase):
'remotejdk16_macos_for_testing',
'remotejdk16_macos_aarch64_for_testing',
'remotejdk16_win_for_testing',
'remotejdk17_linux_for_testing',
'remotejdk17_macos_for_testing',
'remotejdk17_macos_aarch64_for_testing',
'remotejdk17_win_for_testing',
'remote_java_tools_for_testing',
'remote_java_tools_darwin_for_testing',
'remote_java_tools_linux_for_testing',
Expand Down
20 changes: 19 additions & 1 deletion src/test/shell/bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,24 @@ sh_test(
tags = ["local"],
)

sh_test(
name = "bazel_java17_test",
srcs = ["bazel_java17_test.sh"],
args = [
# java_tools zip to test
"src/java_tools.zip",
"src/java_tools_prebuilt.zip",
],
data = [
":test-deps",
"//src:java_tools_prebuilt_zip",
"//src:java_tools_zip",
"//src/test/shell/bazel/testdata:jdk_http_archives_filegroup",
"@bazel_tools//tools/bash/runfiles",
],
tags = ["local"],
)

sh_test(
name = "bazel_java_test",
# TODO(iirina): Investigate if the 'large' and 'eternal' values still apply.
Expand All @@ -241,7 +259,7 @@ sh_test(
exec_compatible_with = ["//:highcpu_machine"],
)

JAVA_VERSIONS = ("11", "15", "16")
JAVA_VERSIONS = ("11", "15", "16", "17")

# TODO(davido): Enable test coverage for JDK 16 toolchain when this issue is fixed:
# https://github.com/bazelbuild/bazel/issues/13358
Expand Down
Loading

0 comments on commit d7707e0

Please sign in to comment.