From 1bb5fe73f0b35bdfebe2ce11b151c2ca179a6681 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Wed, 7 May 2025 17:10:14 -0700 Subject: [PATCH] Update to bazel 8.2.1 (#5445) - Updates incompatible flags. - `rules_flex` is no longer used, so enable its flag. - Fixes `sh_test` deps for `--incompatible_disable_autoloads_in_main_repo` - Broadens the exception for `rules_cc` and `bazel_tools` due to changes to runfiles deps; trying to avoid minutiae that shouldn't affect the decision. --- .bazelrc | 7 ++--- .bazelversion | 2 +- MODULE.bazel | 1 + MODULE.bazel.lock | 34 +++++----------------- bazel/check_deps/check_non_test_cc_deps.py | 9 ++---- common/BUILD | 1 + testing/file_test/rules.bzl | 3 +- toolchain/driver/BUILD | 1 + 8 files changed, 18 insertions(+), 40 deletions(-) diff --git a/.bazelrc b/.bazelrc index febd40f56b8f..819ff91488e1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -137,10 +137,6 @@ try-import %workspace%/user.bazelrc # common --incompatible_no_rule_outputs_param # common --incompatible_stop_exporting_language_modules -# Incompatible with `rules_flex`. -# TODO: Enable the flag once compatibility issues are fixed. -# common --incompatible_disable_starlark_host_transitions - # Incompatible with `rules_pkg`. # TODO: Enable the flag once compatibility issues are fixed. # common --incompatible_disable_target_default_provider_fields @@ -162,9 +158,11 @@ common --incompatible_config_setting_private_default_visibility common --incompatible_default_to_explicit_init_py common --incompatible_depset_for_java_output_source_jars common --incompatible_depset_for_libraries_to_link_getter +common --incompatible_disable_autoloads_in_main_repo common --incompatible_disable_native_android_rules common --incompatible_disable_native_repo_rules common --incompatible_disable_objc_library_transition +common --incompatible_disable_starlark_host_transitions common --incompatible_disable_target_provider_fields common --incompatible_disallow_ctx_resolve_tools common --incompatible_disallow_empty_glob @@ -178,6 +176,7 @@ common --incompatible_enable_apple_toolchain_resolution common --incompatible_enable_deprecated_label_apis common --incompatible_enable_proto_toolchain_resolution common --incompatible_enforce_config_setting_visibility +common --incompatible_enforce_starlark_utf8 common --incompatible_exclusive_test_sandboxed common --incompatible_fail_on_unknown_attributes common --incompatible_fix_package_group_reporoot_syntax diff --git a/.bazelversion b/.bazelversion index cd1d2e94f31d..2b0aa21219df 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -8.0.1 +8.2.1 diff --git a/MODULE.bazel b/MODULE.bazel index 7c8363084d88..35a11f23ce79 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -34,6 +34,7 @@ bazel_dep(name = "google_benchmark", version = "1.8.5") bazel_dep(name = "googletest", version = "1.15.2") bazel_dep(name = "re2", version = "2024-07-02.bcr.1") bazel_dep(name = "rules_pkg", version = "1.0.1") +bazel_dep(name = "rules_shell", version = "0.4.1") bazel_dep(name = "tree-sitter-bazel", version = "0.24.4") # The registry only has an old version. We use that here to avoid a miss but diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 623664c8b91e..a245e1b0963c 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1,5 +1,5 @@ { - "lockFileVersion": 16, + "lockFileVersion": 18, "registryFileHashes": { "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", @@ -121,6 +121,7 @@ "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac", "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc", "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87", + "https://bcr.bazel.build/modules/rules_cc/0.0.17/MODULE.bazel": "2ae1d8f4238ec67d7185d8861cb0a2cdf4bc608697c331b95bf990e69b62e64a", "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", @@ -145,10 +146,10 @@ "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab", "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", + "https://bcr.bazel.build/modules/rules_java/8.11.0/MODULE.bazel": "c3d280bc5ff1038dcb3bacb95d3f6b83da8dd27bba57820ec89ea4085da767ad", + "https://bcr.bazel.build/modules/rules_java/8.11.0/source.json": "302b52a39259a85aa06ca3addb9787864ca3e03b432a5f964ea68244397e7544", "https://bcr.bazel.build/modules/rules_java/8.3.2/MODULE.bazel": "7336d5511ad5af0b8615fdc7477535a2e4e723a357b6713af439fe8cf0195017", "https://bcr.bazel.build/modules/rules_java/8.5.1/MODULE.bazel": "d8a9e38cc5228881f7055a6079f6f7821a073df3744d441978e7a43e20226939", - "https://bcr.bazel.build/modules/rules_java/8.6.1/MODULE.bazel": "f4808e2ab5b0197f094cabce9f4b006a27766beb6a9975931da07099560ca9c2", - "https://bcr.bazel.build/modules/rules_java/8.6.1/source.json": "f18d9ad3c4c54945bf422ad584fa6c5ca5b3116ff55a5b1bc77e5c1210be5960", "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909", "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", @@ -188,7 +189,8 @@ "https://bcr.bazel.build/modules/rules_python/1.0.0/source.json": "b0162a65c6312e45e7912e39abd1a7f8856c2c7e41ecc9b6dc688a6f6400a917", "https://bcr.bazel.build/modules/rules_rust/0.45.1/MODULE.bazel": "a69d0db3a958fab2c6520961e1b2287afcc8b36690fd31bbc4f6f7391397150d", "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", - "https://bcr.bazel.build/modules/rules_shell/0.2.0/source.json": "7f27af3c28037d9701487c4744b5448d26537cc66cdef0d8df7ae85411f8de95", + "https://bcr.bazel.build/modules/rules_shell/0.4.1/MODULE.bazel": "00e501db01bbf4e3e1dd1595959092c2fadf2087b2852d3f553b5370f5633592", + "https://bcr.bazel.build/modules/rules_shell/0.4.1/source.json": "4757bd277fe1567763991c4425b483477bb82e35e777a56fd846eb5cceda324a", "https://bcr.bazel.build/modules/snappy/1.2.0/MODULE.bazel": "cc7a727b46089c7fdae0ede21b1fd65bdb14d01823da118ef5c48044f40b6b27", "https://bcr.bazel.build/modules/snappy/1.2.0/source.json": "17f5527e15d30a9d9eebf79ed73b280b56cac44f8c8fea696666d99943f84c33", "https://bcr.bazel.build/modules/stardoc/0.5.0/MODULE.bazel": "f9f1f46ba8d9c3362648eea571c6f9100680efc44913618811b58cc9c02cd678", @@ -785,28 +787,6 @@ ] } }, - "@@rules_java+//java:rules_java_deps.bzl%compatibility_proxy": { - "general": { - "bzlTransitiveDigest": "84xJEZ1jnXXwo8BXMprvBm++rRt4jsTu9liBxz0ivps=", - "usagesDigest": "jTQDdLDxsS43zuRmg1faAjIEPWdLAbDAowI1pInQSoo=", - "recordedFileInputs": {}, - "recordedDirentsInputs": {}, - "envVariables": {}, - "generatedRepoSpecs": { - "compatibility_proxy": { - "repoRuleId": "@@rules_java+//java:rules_java_deps.bzl%_compatibility_proxy_repo_rule", - "attributes": {} - } - }, - "recordedRepoMappingEntries": [ - [ - "rules_java+", - "bazel_tools", - "bazel_tools" - ] - ] - } - }, "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { "general": { "bzlTransitiveDigest": "sFhcgPbDQehmbD1EOXzX4H1q/CD5df8zwG4kp4jbvr8=", @@ -873,7 +853,7 @@ }, "@@rules_python+//python/extensions:pip.bzl%pip": { "general": { - "bzlTransitiveDigest": "rf6l36dgC9+meab17f35zE8ytj0gdbXez7fMYxBStU4=", + "bzlTransitiveDigest": "FgTk2A9rahtSLMI5sBm105z16riUZQudDlXls9pV6MM=", "usagesDigest": "/9NP3RV6/DWuNdYAsIU/8UCgCX0TdPUJr0X6O+0lrtk=", "recordedFileInputs": { "@@protobuf+//python/requirements.txt": "983be60d3cec4b319dcab6d48aeb3f5b2f7c3350f26b3a9e97486c37967c73c5", diff --git a/bazel/check_deps/check_non_test_cc_deps.py b/bazel/check_deps/check_non_test_cc_deps.py index 6a1a486cdbf9..a0c75f9e4abb 100644 --- a/bazel/check_deps/check_non_test_cc_deps.py +++ b/bazel/check_deps/check_non_test_cc_deps.py @@ -65,13 +65,8 @@ for dep in deps: if repo == "" and not rule.startswith("third_party"): continue - # An empty stub library added by rules_cc: - # https://github.com/bazelbuild/rules_cc/blob/main/BUILD - if repo == "@@rules_cc+" and rule == ":link_extra_lib": - continue - - # An utility library provided by Bazel that is under a compatible license. - if repo == "@@bazel_tools" and rule == "tools/cpp/runfiles:runfiles": + # Utility libraries provided by Bazel that are under a compatible license. + if repo in ("@@rules_cc+", "@@bazel_tools"): continue # These are stubs wrapping system libraries for LLVM. They aren't diff --git a/common/BUILD b/common/BUILD index f1a5aaa6a06a..8590d4fe0402 100644 --- a/common/BUILD +++ b/common/BUILD @@ -2,6 +2,7 @@ # Exceptions. See /LICENSE for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +load("@rules_shell//shell:sh_test.bzl", "sh_test") load("//bazel/cc_rules:defs.bzl", "cc_binary", "cc_library", "cc_test") load("//bazel/version:rules.bzl", "expand_version_build_info") diff --git a/testing/file_test/rules.bzl b/testing/file_test/rules.bzl index e629b13a4ab4..925b6177e184 100644 --- a/testing/file_test/rules.bzl +++ b/testing/file_test/rules.bzl @@ -8,6 +8,7 @@ file_test uses the tests_as_input_file rule to transform test dependencies into a file which can be accessed as a list. This avoids long argument parsing. """ +load("@rules_shell//shell:sh_test.bzl", "sh_test") load("//bazel/cc_rules:defs.bzl", "cc_test") load("//bazel/manifest:defs.bzl", "manifest", "manifest_as_cpp") @@ -51,7 +52,7 @@ def file_test( ) args = ["--explorer_test_targets_file=$(rootpath :{0})".format(tests_file)] + args - native.sh_test( + sh_test( name = name, srcs = srcs + [prebuilt_binary], deps = deps, diff --git a/toolchain/driver/BUILD b/toolchain/driver/BUILD index a1d6d0c2f0fe..9913a85fe02a 100644 --- a/toolchain/driver/BUILD +++ b/toolchain/driver/BUILD @@ -2,6 +2,7 @@ # Exceptions. See /LICENSE for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +load("@rules_shell//shell:sh_test.bzl", "sh_test") load("//bazel/cc_rules:defs.bzl", "cc_binary", "cc_library", "cc_test") load("//testing/fuzzing:rules.bzl", "cc_fuzz_test")