fix: add missing load() statements for Bazel 9 compatibility#1155
Open
00fish0 wants to merge 2 commits intoalibaba:mainfrom
Open
fix: add missing load() statements for Bazel 9 compatibility#115500fish0 wants to merge 2 commits intoalibaba:mainfrom
00fish0 wants to merge 2 commits intoalibaba:mainfrom
Conversation
… 9 removed built-in cc_binary, cc_test, and cc_library rules.\nThey must now be explicitly loaded from @rules_cc//cc:defs.bzl.\n\n- BUILD.bazel: add missing \"cc_test\" to existing load()\n- src/coro_rpc/examples/file_transfer/BUILD.bazel: add load() for \"cc_binary\"\n- src/struct_json/examples/BUILD.bazel: add load() for \"cc_binary\"
There was a problem hiding this comment.
Pull request overview
Adds explicit load() statements for rules_cc C++ rules to keep the build working under Bazel 9, where cc_* rules are no longer built-ins.
Changes:
- Load
cc_testfrom@rules_cc//cc:defs.bzlin the rootBUILD.bazel. - Add missing
cc_binaryloads to exampleBUILD.bazelfiles that definecc_binarytargets.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| BUILD.bazel | Loads cc_test from rules_cc to avoid Bazel 9 removed-builtin rule errors. |
| src/coro_rpc/examples/file_transfer/BUILD.bazel | Adds missing cc_binary load for Bazel 9 compatibility. |
| src/struct_json/examples/BUILD.bazel | Adds missing cc_binary load for Bazel 9 compatibility. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
for detail, goto summary download Artifacts |
|
for detail, goto summary download Artifacts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Bazel 9.0.0 removed the built-in
cc_binary,cc_test, andcc_libraryrules. They must now be explicitly loaded from@rules_cc//cc:defs.bzlvia aload()statement. This causes the CI build to fail with:Warnings:
Changes
BUILD.bazel: Added missing"cc_test"to the existingload()statement (was only loadingcc_binaryandcc_library).src/coro_rpc/examples/file_transfer/BUILD.bazel: Addedload("@rules_cc//cc:defs.bzl", "cc_binary")— was completely missing.src/struct_json/examples/BUILD.bazel: Addedload("@rules_cc//cc:defs.bzl", "cc_binary")— was completely missing.Verification
Local
bazel build //...with Bazel 9.0.0 confirms all packages load successfully after this fix.