From a14237d796cea64b59103960ec61247ebd9dbedc Mon Sep 17 00:00:00 2001 From: hvd Date: Thu, 23 Mar 2023 22:56:26 -0700 Subject: [PATCH] Update rules_java and remove references to "remote_java_tools_darwin" This is the last step of https://github.com/bazelbuild/bazel/issues/17780 This updates rules_java to v5.5.0 for bazel and bazel_tools and cleans up any remaining references to remote_java_tools_darwin, remote_java_tools_test_darwin, and remote_java_tools_darwin_for_testing Closes #17843. PiperOrigin-RevId: 519059189 Change-Id: Ic04f3a2e5cc12e6b7731f6d8a3551553e172e000 --- MODULE.bazel | 2 +- WORKSPACE | 14 -------------- distdir_deps.bzl | 3 --- src/BUILD | 2 -- src/MODULE.tools | 5 +++-- .../devtools/build/lib/bazel/rules/java/BUILD | 1 - .../build/lib/bazel/rules/java/jdk.WORKSPACE.tmpl | 5 ----- src/test/py/bazel/test_base.py | 1 - src/test/shell/bazel/bazel_coverage_java_test.sh | 9 +++++++-- src/test/shell/bazel/bazel_java17_test.sh | 6 +++++- src/test/shell/bazel/bazel_java_test.sh | 9 +++++++-- src/test/shell/bazel/testdata/BUILD | 1 - .../shell/bazel/testdata/jdk_http_archives.tmpl | 4 ---- src/test/shell/testenv.sh.tmpl | 2 -- 14 files changed, 23 insertions(+), 41 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 8119b84bb1cea3..13f72661aec232 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -16,7 +16,7 @@ bazel_dep(name = "stardoc", version = "0.5.3", repo_name = "io_bazel_skydoc") bazel_dep(name = "zstd-jni", version = "1.5.2-3") bazel_dep(name = "zlib", version = "1.2.13") bazel_dep(name = "rules_cc", version = "0.0.6") -bazel_dep(name = "rules_java", version = "5.4.1") +bazel_dep(name = "rules_java", version = "5.5.0") bazel_dep(name = "rules_proto", version = "5.3.0-21.7") bazel_dep(name = "rules_jvm_external", version = "4.5") bazel_dep(name = "rules_python", version = "0.19.0") diff --git a/WORKSPACE b/WORKSPACE index 17de7859fdfcbc..5ce619875e6d48 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -428,13 +428,6 @@ 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_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_x86_64_for_testing", @@ -470,13 +463,6 @@ 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", - 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_x86_64", diff --git a/distdir_deps.bzl b/distdir_deps.bzl index 202572ed0ca622..b38f2c082bb915 100644 --- a/distdir_deps.bzl +++ b/distdir_deps.bzl @@ -436,10 +436,7 @@ DIST_DEPS = { }, "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_x86_64-v12.0.zip", diff --git a/src/BUILD b/src/BUILD index 15700067740e5c..2dd60920b58b63 100644 --- a/src/BUILD +++ b/src/BUILD @@ -564,13 +564,11 @@ filegroup( "@bazel_skylib//:WORKSPACE", "@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", diff --git a/src/MODULE.tools b/src/MODULE.tools index 0eef9469a5db6f..2081aa437be655 100644 --- a/src/MODULE.tools +++ b/src/MODULE.tools @@ -1,7 +1,7 @@ module(name = "bazel_tools") bazel_dep(name = "rules_cc", version = "0.0.6") -bazel_dep(name = "rules_java", version = "5.4.1") +bazel_dep(name = "rules_java", version = "5.5.0") bazel_dep(name = "rules_license", version = "0.0.3") bazel_dep(name = "rules_proto", version = "4.0.0") bazel_dep(name = "rules_python", version = "0.4.0") @@ -24,7 +24,8 @@ use_repo( "remote_java_tools", "remote_java_tools_linux", "remote_java_tools_windows", - "remote_java_tools_darwin", + "remote_java_tools_darwin_x86_64", + "remote_java_tools_darwin_arm64", ) sh_configure_extension = use_extension("//tools/sh:sh_configure.bzl", "sh_configure_extension") diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BUILD b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BUILD index 654f1dc2f84e02..85c579e66929ba 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BUILD +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/BUILD @@ -92,7 +92,6 @@ gen_workspace_stanza( "remote_java_tools", "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", diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.tmpl b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.tmpl index 98d48bd7840fd9..88651965828cf4 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.tmpl +++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE.tmpl @@ -263,11 +263,6 @@ maybe( {remote_java_tools_windows} ) -maybe( - http_archive, -{remote_java_tools_darwin} -) - maybe( http_archive, {remote_java_tools_darwin_x86_64} diff --git a/src/test/py/bazel/test_base.py b/src/test/py/bazel/test_base.py index a183c9d8b184ab..ad623e8b8dc444 100644 --- a/src/test/py/bazel/test_base.py +++ b/src/test/py/bazel/test_base.py @@ -79,7 +79,6 @@ class TestBase(unittest.TestCase): 'remotejdk19_macos_aarch64_for_testing', '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', diff --git a/src/test/shell/bazel/bazel_coverage_java_test.sh b/src/test/shell/bazel/bazel_coverage_java_test.sh index a7b0e31619be8f..8a110aed4645c7 100755 --- a/src/test/shell/bazel/bazel_coverage_java_test.sh +++ b/src/test/shell/bazel/bazel_coverage_java_test.sh @@ -43,7 +43,8 @@ if [[ "${JAVA_TOOLS_PREBUILT_ZIP}" != "released" ]]; then inplace-sed "/override_repository=remote_java_tools=/d" "$TEST_TMPDIR/bazelrc" inplace-sed "/override_repository=remote_java_tools_linux=/d" "$TEST_TMPDIR/bazelrc" inplace-sed "/override_repository=remote_java_tools_windows=/d" "$TEST_TMPDIR/bazelrc" - inplace-sed "/override_repository=remote_java_tools_darwin=/d" "$TEST_TMPDIR/bazelrc" + inplace-sed "/override_repository=remote_java_tools_darwin_x86_64=/d" "$TEST_TMPDIR/bazelrc" + inplace-sed "/override_repository=remote_java_tools_darwin_arm64=/d" "$TEST_TMPDIR/bazelrc" fi JAVA_TOOLS_PREBUILT_ZIP_FILE_URL=${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL:-} @@ -80,7 +81,11 @@ http_archive( urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] ) http_archive( - name = "remote_java_tools_darwin", + name = "remote_java_tools_darwin_x86_64", + urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] +) +http_archive( + name = "remote_java_tools_darwin_arm64", urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] ) EOF diff --git a/src/test/shell/bazel/bazel_java17_test.sh b/src/test/shell/bazel/bazel_java17_test.sh index 89f40e95598bf1..7b7d1c7852bab7 100755 --- a/src/test/shell/bazel/bazel_java17_test.sh +++ b/src/test/shell/bazel/bazel_java17_test.sh @@ -91,7 +91,11 @@ http_archive( urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] ) http_archive( - name = "remote_java_tools_darwin", + name = "remote_java_tools_darwin_x86_64", + urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] +) +http_archive( + name = "remote_java_tools_darwin_arm64", urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] ) EOF diff --git a/src/test/shell/bazel/bazel_java_test.sh b/src/test/shell/bazel/bazel_java_test.sh index a30ba12f961930..051fd17b6ae179 100755 --- a/src/test/shell/bazel/bazel_java_test.sh +++ b/src/test/shell/bazel/bazel_java_test.sh @@ -82,7 +82,8 @@ if [[ "${JAVA_TOOLS_PREBUILT_ZIP}" != "released" ]]; then inplace-sed "/override_repository=remote_java_tools=/d" "$TEST_TMPDIR/bazelrc" inplace-sed "/override_repository=remote_java_tools_linux=/d" "$TEST_TMPDIR/bazelrc" inplace-sed "/override_repository=remote_java_tools_windows=/d" "$TEST_TMPDIR/bazelrc" - inplace-sed "/override_repository=remote_java_tools_darwin=/d" "$TEST_TMPDIR/bazelrc" + inplace-sed "/override_repository=remote_java_tools_darwin_x86_64=/d" "$TEST_TMPDIR/bazelrc" + inplace-sed "/override_repository=remote_java_tools_darwin_arm64=/d" "$TEST_TMPDIR/bazelrc" fi JAVA_TOOLS_PREBUILT_ZIP_FILE_URL=${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL:-} @@ -129,7 +130,11 @@ http_archive( urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] ) http_archive( - name = "remote_java_tools_darwin", + name = "remote_java_tools_darwin_x86_64", + urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] +) +http_archive( + name = "remote_java_tools_darwin_arm64", urls = ["${JAVA_TOOLS_PREBUILT_ZIP_FILE_URL}"] ) EOF diff --git a/src/test/shell/bazel/testdata/BUILD b/src/test/shell/bazel/testdata/BUILD index 9d79c9b8669233..a7374f946d95de 100644 --- a/src/test/shell/bazel/testdata/BUILD +++ b/src/test/shell/bazel/testdata/BUILD @@ -49,7 +49,6 @@ gen_workspace_stanza( "remote_java_tools_test", "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", diff --git a/src/test/shell/bazel/testdata/jdk_http_archives.tmpl b/src/test/shell/bazel/testdata/jdk_http_archives.tmpl index 9d390b3b6baa94..cd9079ab2712e5 100644 --- a/src/test/shell/bazel/testdata/jdk_http_archives.tmpl +++ b/src/test/shell/bazel/testdata/jdk_http_archives.tmpl @@ -11,10 +11,6 @@ http_archive( {remote_java_tools_test_windows} ) -http_archive( - {remote_java_tools_test_darwin} -) - http_archive( {remote_java_tools_test_darwin_x86_64} ) diff --git a/src/test/shell/testenv.sh.tmpl b/src/test/shell/testenv.sh.tmpl index b9a258f3d39525..83be581d142c29 100755 --- a/src/test/shell/testenv.sh.tmpl +++ b/src/test/shell/testenv.sh.tmpl @@ -295,11 +295,9 @@ EOF "openjdk19_windows_archive" "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"