Skip to content

Commit

Permalink
[windows/arm64] Add missing JDK toolchain for java build
Browse files Browse the repository at this point in the history
Extend configurations to add JDK 11 and 17 for windows/arm64 platforms.

This should fix the Java builds on windows/arm64

Closes bazelbuild#14700.

PiperOrigin-RevId: 427737536
  • Loading branch information
niyas-sait committed Feb 11, 2022
1 parent 8b35aab commit 6d0063e
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 1 deletion.
25 changes: 25 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,14 @@ http_archive(
urls = ["https://mirror.bazel.build/openjdk/azul-zulu11.50.19-ca-jdk11.0.12/zulu11.50.19-ca-jdk11.0.12-win_x64.zip"],
)

dist_http_archive(
name = "remotejdk11_win_arm64_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,

)

# This must be kept in sync with src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
http_archive(
name = "remotejdk15_linux_for_testing",
Expand Down Expand Up @@ -733,6 +741,14 @@ http_archive(
],
)

dist_http_archive(
name = "remotejdk17_win_arm64_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,

)

# 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 @@ -1020,6 +1036,15 @@ exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
],
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
dist_http_archive(
name = "openjdk17_windows_arm64_archive",
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)

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

stardoc_repositories()
Expand Down
28 changes: 28 additions & 0 deletions distdir_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,34 @@ DIST_DEPS = {
"test_WORKSPACE_files",
],
},
"remotejdk17_win_arm64": {
"aliases": [
"remotejdk17_win_arm64_for_testing",
"openjdk17_windows_arm64_archive",
"openjdk_win_arm64_vanilla",
],
"archive": "zulu17.30.15-ca-jdk17.0.1-win_aarch64.zip",
"sha256": "811d7e7591bac4f081dfb00ba6bd15b6fc5969e1f89f0f327ef75147027c3877",
"strip_prefix": "zulu17.30.15-ca-jdk17.0.1-win_aarch64",
"urls": [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.30.15-ca-jdk17.0.1-win_aarch64.zip",
"https://cdn.azul.com/zulu/bin/zulu17.30.15-ca-jdk17.0.1-win_aarch64.zip",
],
"used_in": ["test_WORKSPACE_files"],
},
"remotejdk11_win_arm64": {
"aliases": [
"remotejdk11_win_arm64_for_testing",
"openjdk11_windows_arm64_archive",
],
"archive": "microsoft-jdk-11.0.13.8.1-windows-aarch64.zip",
"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",
],
"used_in": ["test_WORKSPACE_files"],
},
}

# Add aliased names
Expand Down
4 changes: 4 additions & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ filegroup(
"@openjdk11_darwin_archive//:WORKSPACE",
"@openjdk11_linux_archive//:WORKSPACE",
"@openjdk11_windows_archive//:WORKSPACE",
"@openjdk11_windows_arm64_archive//:WORKSPACE",
"@openjdk15_darwin_aarch64_archive//:WORKSPACE",
"@openjdk15_darwin_archive//:WORKSPACE",
"@openjdk15_linux_archive//:WORKSPACE",
Expand All @@ -667,6 +668,7 @@ filegroup(
"@openjdk17_darwin_archive//:WORKSPACE",
"@openjdk17_linux_archive//:WORKSPACE",
"@openjdk17_windows_archive//:WORKSPACE",
"@openjdk17_windows_arm64_archive//:WORKSPACE",
"@openjdk_linux_aarch64_minimal//file",
"@openjdk_linux_minimal//file",
"@openjdk_macos_aarch64_minimal//file",
Expand All @@ -687,6 +689,7 @@ filegroup(
"@remotejdk11_linux_s390x_for_testing//:WORKSPACE",
"@remotejdk11_macos_aarch64_for_testing//:WORKSPACE",
"@remotejdk11_macos_for_testing//:WORKSPACE",
"@remotejdk11_win_arm64_for_testing//:WORKSPACE",
"@remotejdk11_win_for_testing//:WORKSPACE",
"@remotejdk15_linux_for_testing//:WORKSPACE",
"@remotejdk15_macos_aarch64_for_testing//:WORKSPACE",
Expand All @@ -699,6 +702,7 @@ filegroup(
"@remotejdk17_linux_for_testing//:WORKSPACE",
"@remotejdk17_macos_aarch64_for_testing//:WORKSPACE",
"@remotejdk17_macos_for_testing//:WORKSPACE",
"@remotejdk17_win_arm64_for_testing//:WORKSPACE",
"@remotejdk17_win_for_testing//:WORKSPACE",
"@rules_cc//:WORKSPACE",
"@rules_java//:WORKSPACE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ gen_workspace_stanza(
"remote_java_tools_linux",
"remote_java_tools_windows",
"remote_java_tools_darwin",
"remotejdk11_win_arm64",
"remotejdk17_win_arm64",
"rules_cc",
"rules_java",
"rules_proto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ maybe(
version = "11",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
name = "remotejdk11_win_arm64",
exec_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",
],
version = "11",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
Expand Down Expand Up @@ -336,6 +352,22 @@ maybe(
version = "17",
)

maybe(
remote_java_repository,
name = "remotejdk17_win_arm64",
exec_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:arm64",
],
sha256 = "811d7e7591bac4f081dfb00ba6bd15b6fc5969e1f89f0f327ef75147027c3877",
strip_prefix = "zulu17.30.15-ca-jdk17.0.1-win_aarch64",
urls = [
"https://mirror.bazel.build/cdn.azul.com/zulu/bin/zulu17.30.15-ca-jdk17.0.1-win_aarch64.zip",
"https://cdn.azul.com/zulu/bin/zulu17.30.15-ca-jdk17.0.1-win_aarch64.zip",
],
version = "17",
)

{remote_java_tools}
{remote_java_tools_linux}
{remote_java_tools_windows}
Expand Down
2 changes: 2 additions & 0 deletions src/test/py/bazel/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class TestBase(unittest.TestCase):
'remotejdk11_macos_for_testing',
'remotejdk11_macos_aarch64_for_testing',
'remotejdk11_win_for_testing',
'remotejdk11_win_arm64_for_testing',
'remotejdk15_linux_for_testing',
'remotejdk15_macos_for_testing',
'remotejdk15_macos_aarch64_for_testing',
Expand All @@ -76,6 +77,7 @@ class TestBase(unittest.TestCase):
'remotejdk17_macos_for_testing',
'remotejdk17_macos_aarch64_for_testing',
'remotejdk17_win_for_testing',
'remotejdk17_win_arm64_for_testing',
'remote_java_tools_for_testing',
'remote_java_tools_darwin_for_testing',
'remote_java_tools_linux_for_testing',
Expand Down
2 changes: 2 additions & 0 deletions src/test/shell/bazel/testdata/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ gen_workspace_stanza(
"remote_java_tools_test_linux",
"remote_java_tools_test_windows",
"remote_java_tools_test_darwin",
"openjdk11_windows_arm64_archive",
"openjdk17_windows_arm64_archive",
],
template = "jdk_http_archives.tmpl",
visibility = ["//:__pkg__"],
Expand Down
15 changes: 15 additions & 0 deletions src/test/shell/bazel/testdata/jdk_http_archives.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
],
)

# This must be kept in sync with the top-level WORKSPACE file.
http_archive(
{openjdk11_windows_arm64_archive}
build_file_content = "java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])",
)

#################################### JDK 17 ####################################
# This must be kept in sync with the top-level WORKSPACE file.
http_archive(
Expand Down Expand Up @@ -226,3 +232,12 @@ exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
"https://cdn.azul.com/zulu/bin/zulu17.28.13-ca-jdk17.0.0-win_x64.zip",
],
)

# This must be kept in sync with src/test/shell/bazel/testdata/jdk_http_archives.
http_archive(
{openjdk17_windows_arm64_archive}
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)
3 changes: 3 additions & 0 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ EOF
"openjdk11_darwin_aarch64_archive"
"openjdk11_linux_archive"
"openjdk11_windows_archive"
"openjdk11_windows_arm64_archive"
"openjdk15_darwin_archive"
"openjdk15_darwin_aarch64_archive"
"openjdk15_linux_archive"
Expand All @@ -301,6 +302,7 @@ EOF
"openjdk17_darwin_aarch64_archive"
"openjdk17_linux_archive"
"openjdk17_windows_archive"
"openjdk17_windows_arm64_archive"
"openjdk_linux_aarch64_minimal"
"openjdk_linux_minimal"
"openjdk_macos_x86_64_minimal"
Expand Down Expand Up @@ -334,6 +336,7 @@ EOF
"remotejdk17_macos_for_testing"
"remotejdk17_macos_aarch64_for_testing"
"remotejdk17_win_for_testing"
"remotejdk17_win_arm64_for_testing"
"rules_cc"
"rules_java"
"rules_proto"
Expand Down
2 changes: 2 additions & 0 deletions tools/jdk/BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ _JDKS = [
"remotejdk11_macos",
"remotejdk11_macos_aarch64",
"remotejdk11_win",
"remotejdk11_win_arm64",
"remotejdk11_linux_aarch64",
"remotejdk11_linux",
"remotejdk11_linux_ppc64le",
Expand All @@ -458,6 +459,7 @@ _JDKS = [
"remotejdk17_macos",
"remotejdk17_macos_aarch64",
"remotejdk17_win",
"remotejdk17_win_arm64",
"remotejdk17_linux",
]

Expand Down
2 changes: 1 addition & 1 deletion tools/jdk/jdk.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,6 @@ java_import(

config_setting(
name = "windows",
values = {"cpu": "x64_windows"},
constraint_values = ["@platforms//os:windows"],
visibility = ["//visibility:private"],
)

0 comments on commit 6d0063e

Please sign in to comment.