Skip to content

Commit

Permalink
Separate prebuilt darwin java_tools for x86_64 and arm64
Browse files Browse the repository at this point in the history
This is step 1 of #17780

Closes #17767.

PiperOrigin-RevId: 517115807
Change-Id: If2bb85a8a15fd126ab52e5738e3d9558da813090
  • Loading branch information
hvadehra authored and copybara-github committed Mar 16, 2023
1 parent f861499 commit 36c167b
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 7 deletions.
28 changes: 28 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,20 @@ dist_http_archive(
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
)

# Used in src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
dist_http_archive(
name = "remote_java_tools_darwin_x86_64_for_testing",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
)

# Used in src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.
dist_http_archive(
name = "remote_java_tools_darwin_arm64_for_testing",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
)

# Used in src/test/shell/bazel/testdata/jdk_http_archives.
dist_http_archive(
name = "remote_java_tools_test",
Expand Down Expand Up @@ -463,6 +477,20 @@ dist_http_archive(
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
)

# Used in src/test/shell/bazel/testdata/jdk_http_archives.
dist_http_archive(
name = "remote_java_tools_test_darwin_x86_64",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
)

# Used in src/test/shell/bazel/testdata/jdk_http_archives.
dist_http_archive(
name = "remote_java_tools_test_darwin_arm64",
patch_cmds = EXPORT_WORKSPACE_IN_BUILD_FILE,
patch_cmds_win = EXPORT_WORKSPACE_IN_BUILD_FILE_WIN,
)

dist_http_archive(
name = "openjdk11_linux_archive",
build_file_content = """
Expand Down
23 changes: 21 additions & 2 deletions distdir_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -434,12 +434,31 @@ DIST_DEPS = {
],
"package_version": "11.12",
},
"remote_java_tools_darwin": {
"remote_java_tools_darwin_x86_64": {
"aliases": [
"remote_java_tools_darwin",
"remote_java_tools_test_darwin",
"remote_java_tools_test_darwin_x86_64",
"remote_java_tools_darwin_for_testing",
"remote_java_tools_darwin_x86_64_for_testing",
],
"archive": "java_tools_darwin-v11.12.zip",
"archive": "java_tools_darwin_x86_64-v11.12.zip",
"sha256": "aed319892b638efabd08405b8f835770e13e2465d20459876c5f457f2b6426f3",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v11.12/java_tools_darwin-v11.12.zip",
"https://github.com/bazelbuild/java_tools/releases/download/java_v11.12/java_tools_darwin-v11.12.zip",
],
"used_in": [
"test_WORKSPACE_files",
],
"package_version": "11.12",
},
"remote_java_tools_darwin_arm64": {
"aliases": [
"remote_java_tools_test_darwin_arm64",
"remote_java_tools_darwin_arm64_for_testing",
],
"archive": "java_tools_darwin_arm64-v11.12.zip",
"sha256": "aed319892b638efabd08405b8f835770e13e2465d20459876c5f457f2b6426f3",
"urls": [
"https://mirror.bazel.build/bazel_java_tools/releases/java/v11.12/java_tools_darwin-v11.12.zip",
Expand Down
4 changes: 4 additions & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,14 @@ filegroup(
"@com_google_protobuf//:WORKSPACE",
"@remote_coverage_tools//:WORKSPACE",
"@remote_java_tools_darwin_for_testing//:WORKSPACE",
"@remote_java_tools_darwin_x86_64_for_testing//:WORKSPACE",
"@remote_java_tools_darwin_arm64_for_testing//:WORKSPACE",
"@remote_java_tools_for_testing//:WORKSPACE",
"@remote_java_tools_linux_for_testing//:WORKSPACE",
"@remote_java_tools_test//:WORKSPACE",
"@remote_java_tools_test_darwin//:WORKSPACE",
"@remote_java_tools_test_darwin_x86_64//:WORKSPACE",
"@remote_java_tools_test_darwin_arm64//:WORKSPACE",
"@remote_java_tools_test_linux//:WORKSPACE",
"@remote_java_tools_test_windows//:WORKSPACE",
"@remote_java_tools_windows_for_testing//:WORKSPACE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ gen_workspace_stanza(
"remote_java_tools_linux",
"remote_java_tools_windows",
"remote_java_tools_darwin",
"remote_java_tools_darwin_x86_64",
"remote_java_tools_darwin_arm64",
"rules_cc",
"rules_java",
"rules_proto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,16 @@ maybe(
{remote_java_tools_darwin}
)

maybe(
http_archive,
{remote_java_tools_darwin_x86_64}
)

maybe(
http_archive,
{remote_java_tools_darwin_arm64}
)

maybe(
http_archive,
{rules_java}
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 @@ -80,6 +80,8 @@ class TestBase(unittest.TestCase):
'remotejdk19_win_for_testing',
'remote_java_tools_for_testing',
'remote_java_tools_darwin_for_testing',
'remote_java_tools_darwin_x86_64_for_testing',
'remote_java_tools_darwin_arm64_for_testing',
'remote_java_tools_linux_for_testing',
'remote_java_tools_windows_for_testing',
'remote_coverage_tools',
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 @@ -50,6 +50,8 @@ gen_workspace_stanza(
"remote_java_tools_test_linux",
"remote_java_tools_test_windows",
"remote_java_tools_test_darwin",
"remote_java_tools_test_darwin_x86_64",
"remote_java_tools_test_darwin_arm64",
"openjdk11_linux_archive",
"openjdk11_linux_s390x_archive",
"openjdk11_darwin_archive",
Expand Down
8 changes: 8 additions & 0 deletions src/test/shell/bazel/testdata/jdk_http_archives.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ http_archive(
{remote_java_tools_test_darwin}
)

http_archive(
{remote_java_tools_test_darwin_x86_64}
)

http_archive(
{remote_java_tools_test_darwin_arm64}
)

#################################### JDK 11 ####################################
# This must be kept in sync with the top-level WORKSPACE file.
http_archive(
Expand Down
4 changes: 4 additions & 0 deletions src/test/shell/testenv.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,12 @@ EOF
"remote_coverage_tools"
"remote_java_tools_for_testing"
"remote_java_tools_darwin_for_testing"
"remote_java_tools_darwin_x86_64_for_testing"
"remote_java_tools_darwin_arm64_for_testing"
"remote_java_tools_test"
"remote_java_tools_test_darwin"
"remote_java_tools_test_darwin_x86_64"
"remote_java_tools_test_darwin_arm64"
"remote_java_tools_test_linux"
"remote_java_tools_test_windows"
"remote_java_tools_linux_for_testing"
Expand Down
15 changes: 10 additions & 5 deletions tools/jdk/BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ cc_library(
)
for OS in [
"linux",
"darwin",
"darwin_x86_64",
"darwin_arm64",
"windows",
]
]
Expand All @@ -148,7 +149,8 @@ alias(
name = "ijar_prebuilt_binary_or_cc_binary",
actual = select({
"//src/conditions:linux_x86_64": ":ijar_prebuilt_binary_linux",
"//src/conditions:darwin": ":ijar_prebuilt_binary_darwin",
"//src/conditions:darwin_x86_64": ":ijar_prebuilt_binary_darwin_x86_64",
"//src/conditions:darwin_arm64": ":ijar_prebuilt_binary_darwin_arm64",
"//src/conditions:windows": ":ijar_prebuilt_binary_windows",
"//conditions:default": "@remote_java_tools//:ijar_cc_binary",
}),
Expand All @@ -158,7 +160,8 @@ alias(
name = "ijar_prebuilt_binary",
actual = select({
"//src/conditions:linux_x86_64": ":ijar_prebuilt_binary_linux",
"//src/conditions:darwin": ":ijar_prebuilt_binary_darwin",
"//src/conditions:darwin_x86_64": ":ijar_prebuilt_binary_darwin_x86_64",
"//src/conditions:darwin_arm64": ":ijar_prebuilt_binary_darwin_arm64",
"//src/conditions:windows": ":ijar_prebuilt_binary_windows",
}),
)
Expand All @@ -178,7 +181,8 @@ alias(
name = "singlejar_prebuilt_or_cc_binary",
actual = select({
"//src/conditions:linux_x86_64": ":prebuilt_singlejar_linux",
"//src/conditions:darwin": ":prebuilt_singlejar_darwin",
"//src/conditions:darwin_x86_64": ":prebuilt_singlejar_darwin_x86_64",
"//src/conditions:darwin_arm64": ":prebuilt_singlejar_darwin_arm64",
"//src/conditions:windows": ":prebuilt_singlejar_windows",
"//conditions:default": "@remote_java_tools//:singlejar_cc_bin",
}),
Expand All @@ -188,7 +192,8 @@ alias(
name = "prebuilt_singlejar",
actual = select({
"//src/conditions:linux_x86_64": ":prebuilt_singlejar_linux",
"//src/conditions:darwin": ":prebuilt_singlejar_darwin",
"//src/conditions:darwin_x86_64": ":prebuilt_singlejar_darwin_x86_64",
"//src/conditions:darwin_arm64": ":prebuilt_singlejar_darwin_arm64",
"//src/conditions:windows": ":prebuilt_singlejar_windows",
}),
)
Expand Down

0 comments on commit 36c167b

Please sign in to comment.