Skip to content

Commit cc999b6

Browse files
Merge pull request #30341 from redpanda-data/stephan/update-bazel-version
bazel: Update to v9
2 parents 9fa838b + aa11945 commit cc999b6

7 files changed

Lines changed: 691 additions & 1776 deletions

File tree

.bazelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
common --registry=https://bcr.bazel.build
22
common --extra_toolchains=@current_llvm_toolchain//:all
33

4+
# Store repositories also in the remote cache to speed up fetches and avoid
5+
# flakiness due to Github
6+
startup --experimental_remote_repo_contents_cache
7+
8+
# Bazel 9 removes native C++ rule symbols. Autoload them for external rulesets
9+
# that have not migrated all generated BUILD/Starlark files to explicit loads.
10+
common --incompatible_autoload_externally=+@rules_cc
11+
12+
# Bazel 9 no longer enables this rules_cc toolchain feature by default. Keep
13+
# external dependency headers on -isystem include paths so their warnings are
14+
# not promoted by Redpanda's -Werror settings.
15+
build --features=external_include_paths
16+
build --host_features=external_include_paths
17+
418
# Fail the build if MODULE.bazel declares a direct dependency on a version
519
# that doesn't match what the resolved module graph actually uses.
620
common --check_direct_dependencies=error

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.4.1
1+
9.1.0

MODULE.bazel

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use_repo(
1818
)
1919

2020
bazel_dep(name = "gazelle", version = "0.45.0")
21-
bazel_dep(name = "abseil-cpp", version = "20250814.0")
21+
bazel_dep(name = "abseil-cpp", version = "20250814.1")
2222
bazel_dep(name = "bazel_skylib", version = "1.8.2")
2323
bazel_dep(name = "crc32c", version = "1.1.0")
2424
bazel_dep(name = "fmt", version = "12.1.0")
@@ -47,15 +47,15 @@ single_version_override(
4747

4848
bazel_dep(name = "re2", version = "2024-07-02.bcr.1")
4949
bazel_dep(name = "rules_cc", version = "0.2.17")
50-
bazel_dep(name = "rules_foreign_cc", version = "0.12.0")
50+
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
5151
bazel_dep(name = "rules_go", version = "0.59.0")
5252
bazel_dep(name = "rules_pkg", version = "1.0.1")
5353
bazel_dep(name = "rules_proto", version = "7.1.0")
54-
bazel_dep(name = "rules_python", version = "1.6.0")
55-
bazel_dep(name = "rules_rust", version = "0.60.0")
54+
bazel_dep(name = "rules_python", version = "1.7.0")
55+
bazel_dep(name = "rules_rust", version = "0.70.0")
5656
bazel_dep(name = "snappy", version = "1.2.1")
5757
bazel_dep(name = "yaml-cpp", version = "0.8.0")
58-
bazel_dep(name = "zlib", version = "1.3.1.bcr.6")
58+
bazel_dep(name = "zlib", version = "1.3.1.bcr.8")
5959
bazel_dep(name = "zstd", version = "1.5.7")
6060
bazel_dep(name = "patchelf", version = "0.18.0")
6161
bazel_dep(name = "bzip2", version = "1.0.8.bcr.2")
@@ -69,9 +69,9 @@ single_version_override(
6969
],
7070
)
7171

72-
bazel_dep(name = "rules_shell", version = "0.4.1", dev_dependency = True)
72+
bazel_dep(name = "rules_shell", version = "0.6.1", dev_dependency = True)
7373

74-
bazel_dep(name = "protovalidate", version = "1.0.0")
74+
bazel_dep(name = "protovalidate", version = "1.2.0")
7575

7676
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
7777
python.toolchain(
@@ -385,7 +385,7 @@ use_repo(crate, "crates")
385385
# ====================================
386386
# OCI Base Images
387387
# ====================================
388-
bazel_dep(name = "rules_oci", version = "2.0.1", dev_dependency = True)
388+
bazel_dep(name = "rules_oci", version = "2.3.0", dev_dependency = True)
389389

390390
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci", dev_dependency = True)
391391

MODULE.bazel.lock

Lines changed: 632 additions & 1763 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel/clang_tidy/plugins/BUILD

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
22
load("@rules_cc//cc:cc_library.bzl", "cc_library")
3-
load("//bazel:internal.bzl", "redpanda_copts")
3+
load("//bazel:internal.bzl", "filtered_filegroup", "redpanda_copts")
44

5-
# convenience wrapper around a filegroup to satisfy layering checks.
5+
filtered_filegroup(
6+
name = "llvm_plugin_hdrs",
7+
srcs = ["@current_llvm_toolchain_llvm//:all_includes"],
8+
path_includes = [
9+
"/include/clang/",
10+
"/include/clang-c/",
11+
"/include/clang-tidy/",
12+
"/include/llvm/",
13+
"/include/llvm-c/",
14+
],
15+
)
16+
17+
# Convenience wrapper around a filegroup to satisfy layering checks.
618
cc_library(
719
name = "libclang_hdrs",
8-
hdrs = ["@current_llvm_toolchain_llvm//:all_includes"],
20+
hdrs = [":llvm_plugin_hdrs"],
921
tags = ["no-clang-tidy-headers"],
1022
visibility = ["//visibility:public"],
1123
)

bazel/internal.bzl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,19 @@ def antithesis_deps():
2626
"//bazel:antithesis_enabled": ["//bazel/antithesis:instrumentation"],
2727
"//conditions:default": [],
2828
})
29+
30+
def _filtered_filegroup_impl(ctx):
31+
return [DefaultInfo(files = depset([
32+
f
33+
for src in ctx.attr.srcs
34+
for f in src[DefaultInfo].files.to_list()
35+
if any([include in f.path for include in ctx.attr.path_includes])
36+
]))]
37+
38+
filtered_filegroup = rule(
39+
implementation = _filtered_filegroup_impl,
40+
attrs = {
41+
"path_includes": attr.string_list(mandatory = True),
42+
"srcs": attr.label_list(allow_files = True, mandatory = True),
43+
},
44+
)

tools/run-cov

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,11 @@ def main():
11841184
workspace_root = find_workspace_root()
11851185
if workspace_root:
11861186
os.chdir(workspace_root)
1187-
toolchain_bin = find_toolchain_bin()
1187+
# When running inside a Bazel test action (sandboxed), calling `bazel`
1188+
# subprocesses can hang trying to connect back to the parent Bazel server.
1189+
# With --reuse we only need the demangler for real coverage data, not
1190+
# fixture tests, so skip the nested `bazel info` call entirely.
1191+
toolchain_bin = None if args.reuse else find_toolchain_bin()
11881192

11891193
# Get LCOV data
11901194
if not args.reuse:

0 commit comments

Comments
 (0)