Skip to content

03-30-26 Bazel cleanup#6458

Merged
fhanau merged 2 commits intomainfrom
felix/033026-bazel-cleanup
Mar 30, 2026
Merged

03-30-26 Bazel cleanup#6458
fhanau merged 2 commits intomainfrom
felix/033026-bazel-cleanup

Conversation

@fhanau
Copy link
Copy Markdown
Contributor

@fhanau fhanau commented Mar 30, 2026

[build] Fix and enable bazel incompatible_use_default_test_toolchain
This will be required with Bazel 10

=> This proved to be too difficult to figure out now, I was able to fix the build with the flag enabled but it looks like bazel might end up building host tools for the target platform?

[build] Update protobuf to v34, restrict autoloads further
Update protobuf, which allows us to use prebuilt protoc (in the common case, exceptions for perfetto may apply), and drop a bunch of the remaining autoloads (after adding an override for rules_go at least). Also add missing loads for sqlite3.

[build] Flip --incompatible_repo_env_ignores_action_env
Enable incompatible_repo_env_ignores_action_env, which is already the default in Bazel 9. BAZEL_COMPILER, CC, BAZEL_USE_LLVM_NATIVE_COVERAGE, GCOV, AR, and BAZEL_LLVM_COV variables are only provided as repo_env now. ASAN_OPTIONS and UBSAN_OPTIONS are only provided as action_env. COVERAGE_GCOV_PATH might be needed for both and continues to be provided as both repo and action env.

@fhanau fhanau requested review from mikea and npaun March 30, 2026 16:48
@fhanau fhanau requested review from a team as code owners March 30, 2026 16:48
@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 30, 2026

I've completed my review. The changes are well-structured across three logical commits and look correct. Let me verify there are no issues:

  1. Autoload reduction (.bazelrc line 19): Removed cc_import, cc_shared_library, cc_test, cc_toolchain from autoloads. Verified: none of these are used as native rules in the codebase — cc_test is explicitly loaded from @rules_cc, and cc_toolchain is accessed via find_cc_toolchain. Safe.

  2. incompatible_use_default_test_toolchain: The old workaround (--@bazel_tools//tools/test:incompatible_use_default_test_toolchain=False) is removed, and instead --extra_execution_platforms=//:macOS_x86 is added for macos-cross-x86_64. The platform is properly defined. This is the correct fix.

  3. action_envrepo_env migration: BAZEL_COMPILER, CC, AR, BAZEL_USE_LLVM_NATIVE_COVERAGE, GCOV, BAZEL_LLVM_COV are moved to repo_env. host_action_env lines are removed (as repo_env applies to both host and target). ASAN_OPTIONS and UBSAN_OPTIONS correctly remain as action_env. COVERAGE_GCOV_PATH is provided in both action_env and repo_env as noted in the PR description.

  4. sqlite3 MODULE.bazel: Uses a newer version's MODULE.bazel (3.51.2.bcr.1) for proper rules_cc imports, with matching integrity hash. The actual sqlite source remains 3.47.0. The BUILD.sqlite3 file now has explicit load() statements for cc_binary and cc_library to match.

  5. rules_go override: Added with repo_name = None to satisfy protobuf's transitive dependency without polluting workerd's namespace. Well documented.

  6. perfetto protobuf bump: 33.4 → 34.1, consistent with the rest of the changes.

  7. Documentation updates: README.md and fuzzilli/README.md correctly updated to use --repo_env.

LGTM

github run

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@fhanau fhanau force-pushed the felix/033026-bazel-cleanup branch from baafc59 to 5432e59 Compare March 30, 2026 17:01
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 30, 2026

Merging this PR will not alter performance

✅ 70 untouched benchmarks
⏩ 129 skipped benchmarks1


Comparing felix/033026-bazel-cleanup (2b78130) with main (2ed69c4)

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

fhanau added 2 commits March 30, 2026 17:27
Update protobuf, which allows us to use prebuilt protoc (in the common case,
exceptions for perfetto may apply), and drop a bunch of the remaining autoloads
(after adding some repo overrides at least). Also add missing loads for sqlite3.
Enable incompatible_repo_env_ignores_action_env, which is already the default in
Bazel 9. BAZEL_COMPILER, CC, BAZEL_USE_LLVM_NATIVE_COVERAGE, GCOV, AR, and
BAZEL_LLVM_COV variables are only provided as repo_env now. ASAN_OPTIONS and
UBSAN_OPTIONS are only provided as action_env. COVERAGE_GCOV_PATH might be
needed for both and continues to be provided as both repo and action env.
@fhanau fhanau force-pushed the felix/033026-bazel-cleanup branch from 5432e59 to 2b78130 Compare March 30, 2026 21:27
@fhanau fhanau merged commit 8834137 into main Mar 30, 2026
22 checks passed
@fhanau fhanau deleted the felix/033026-bazel-cleanup branch March 30, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants