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 #14700.

PiperOrigin-RevId: 427737536
  • Loading branch information
niyas-sait authored and copybara-github committed Feb 10, 2022
1 parent 207c31b commit b602425
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 1 deletion.
34 changes: 34 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,14 @@ dist_http_archive(
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
)

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,

)

dist_http_archive(
name = "remotejdk17_linux_for_testing",
build_file = "@local_jdk//:BUILD.bazel",
Expand Down Expand Up @@ -504,6 +512,14 @@ dist_http_archive(
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_BAZEL_FILE_WIN,
)

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 @@ -595,6 +611,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 = "openjdk11_windows_arm64_archive",
build_file_content = """
java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility:public'])
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_linux_archive",
Expand Down Expand Up @@ -631,6 +656,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
15 changes: 15 additions & 0 deletions distdir_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,8 @@ DIST_DEPS = {
},
"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",
Expand All @@ -460,6 +462,19 @@ DIST_DEPS = {
],
"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"],
},
"remotejdk17_linux": {
"aliases": [
"remotejdk17_linux_for_testing",
Expand Down
4 changes: 4 additions & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,12 @@ filegroup(
"@openjdk11_darwin_archive//:WORKSPACE",
"@openjdk11_linux_archive//:WORKSPACE",
"@openjdk11_windows_archive//:WORKSPACE",
"@openjdk11_windows_arm64_archive//:WORKSPACE",
"@openjdk17_darwin_aarch64_archive//:WORKSPACE",
"@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 @@ -677,10 +679,12 @@ 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",
"@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 @@ -101,10 +101,12 @@ gen_workspace_stanza(
"remotejdk11_macos",
"remotejdk11_macos_aarch64",
"remotejdk11_win",
"remotejdk11_win_arm64",
"remotejdk17_linux",
"remotejdk17_macos",
"remotejdk17_macos_aarch64",
"remotejdk17_win",
"remotejdk17_win_arm64",
],
template = "jdk.WORKSPACE.tmpl",
visibility = ["//:__pkg__"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ maybe(
version = "11",
)

# This must be kept in sync with the top-level WORKSPACE file.
maybe(
remote_java_repository,
{remotejdk11_win_arm64}
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:arm64",
],
version = "11",
)

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

maybe(
remote_java_repository,
{remotejdk17_win_arm64}
target_compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:arm64",
],
version = "17",
)

maybe(
http_archive,
{remote_java_tools}
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,10 +64,12 @@ class TestBase(unittest.TestCase):
'remotejdk11_macos_for_testing',
'remotejdk11_macos_aarch64_for_testing',
'remotejdk11_win_for_testing',
'remotejdk11_win_arm64_for_testing',
'remotejdk17_linux_for_testing',
'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 @@ -54,10 +54,12 @@ gen_workspace_stanza(
"openjdk11_darwin_archive",
"openjdk11_darwin_aarch64_archive",
"openjdk11_windows_archive",
"openjdk11_windows_arm64_archive",
"openjdk17_linux_archive",
"openjdk17_darwin_archive",
"openjdk17_darwin_aarch64_archive",
"openjdk17_windows_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 @@ -40,6 +40,12 @@ http_archive(
build_file_content = "java_runtime(name = 'runtime', srcs = glob(['**']), 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 @@ -76,3 +82,12 @@ java_runtime(name = 'runtime', srcs = glob(['**']), visibility = ['//visibility
exports_files(["WORKSPACE"], visibility = ["//visibility:public"])
""",
)

# 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"])
""",
)
4 changes: 4 additions & 0 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,12 @@ EOF
"openjdk11_darwin_aarch64_archive"
"openjdk11_linux_archive"
"openjdk11_windows_archive"
"openjdk11_windows_arm64_archive"
"openjdk17_darwin_archive"
"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 All @@ -314,10 +316,12 @@ EOF
"remotejdk11_macos_for_testing"
"remotejdk11_macos_aarch64_for_testing"
"remotejdk11_win_for_testing"
"remotejdk11_win_arm64_for_testing"
"remotejdk17_linux_for_testing"
"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,13 +443,15 @@ _JDKS = [
"remotejdk11_macos",
"remotejdk11_macos_aarch64",
"remotejdk11_win",
"remotejdk11_win_arm64",
"remotejdk11_linux_aarch64",
"remotejdk11_linux",
"remotejdk11_linux_ppc64le",
"remotejdk11_linux_s390x",
"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 @@ -210,6 +210,6 @@ java_import(

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

0 comments on commit b602425

Please sign in to comment.