Closed
Conversation
Motivation: These changes are required for P4Runtime to build successfuly for downstream users who depend on it in their own projects. This was dicovered while upstreaming P4Runtime v1.5.0 to the BCR, see bazelbuild/bazel-central-registry#7594. - Upgrade googleapis and replace the switched_rules extension with the new per-language modules (googleapis-cc, googleapis-go, googleapis-python, googleapis-grpc-cc). The old switched_rules extension only processes use_languages() calls from the root module, which breaks BCR presubmit and downstream users who don't call it themselves. - Upgrade grpc 1.68.0 -> 1.76.0, protobuf 29.1 -> 33.5, bazel_skylib 1.7.1 -> 1.9.0, rules_go 0.59.0 -> 0.60.0. - Remove rules_proto and gazelle deps (no longer needed). - Load proto_library from @protobuf//bazel:proto_library.bzl instead of the deprecated @rules_proto//proto:defs.bzl. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com>
…her Bazel workspace. Details: - In Bazel, it is possible and not uncommon that a project builds from its own workspace, but fails to build when depended on from another workspace. - We have an example project in example/using-bzlmod that we build in our CI script to ensure both direct and transitive builds work. - Despite this, in bazelbuild/bazel-central-registry#7594, P4Runtime did not build even though our CI script passed. - The gap: our example project exercises some, but not all @p4runtime targets in a transitive fashion. - The solution: run bazel build @p4runtime//... from the example workspace to close the gap. - The proof: I reproduced the issue seen in bazelbuild/bazel-central-registry#7594 in #591. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com>
Bazel 9 removed native C++ rules from the global namespace by default (native.cc_binary, native.cc_library). Two gRPC 1.76.0 bundled files still use these: - bazel/cython_library.bzl uses native.cc_binary - third_party/address_sorting/address_sorting.bzl uses native.cc_library Use --incompatible_autoload_externally=+cc_library,+cc_binary to restore the autoload for those rules. This flag is a no-op in Bazel 7/8 where the rules remain native. Note: the flag is a workspace-local setting and is therefore not propagated to downstream users, who will need to add it themselves until a fixed gRPC BCR release ships. Also: - Bump re2 to 2025-11-05.bcr.1 (BCR grpc 1.76.0 pulls in re2 2024-07-02.bcr.1 whose BUILD uses cc_test without load(), which is another Bazel 9 error; the 2025-11-05 release fixes that). - Remove the <9.0.0 upper bound from bazel_compatibility. - Update .bazelversion to 9.0.0. - Add 9.x to the CI matrix and remove the "once we support Bazel 9" TODO. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
a580e32 to
c90a487
Compare
Bazel 8 is expected to work (it is between two tested versions), so there is no need to test it explicitly. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
smolkaj
added a commit
to p4lang/p4c
that referenced
this pull request
Feb 28, 2026
Bazel 9 is now released. The only blocker is that BCR `p4runtime 1.5.0` declares `bazel_compatibility < 9.0.0`. Suppress the check via `--check_bazel_compatibility=off` until a new p4runtime BCR release is cut (tracked in p4lang/p4runtime#597). Unlike `git_override`, this flag works for modules published to the BCR. Also add a Bazel version matrix to CI (7.x and 9.x), and fix macOS builds: use Command Line Tools clang to avoid requiring a full Xcode install, and set `macos_minimum_os=10.15` which is the minimum for `std::filesystem` support in libc++. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This was referenced Feb 28, 2026
smolkaj
added a commit
to smolkaj/bazel-central-registry
that referenced
this pull request
Feb 28, 2026
The 1.5.0 BCR entry declares bazel_compatibility = [">=7.0.0", "<9.0.0"], blocking downstream users from upgrading to Bazel 9. The upper bound is overly conservative; no Bazel-9-specific incompatibilities exist. This new .bcr.1 release removes it so BCR users can adopt Bazel 9. The upstream fix is tracked at p4lang/p4runtime#597. Changes from 1.5.0: - MODULE.bazel: remove upper bound, bump version to 1.5.0.bcr.1, add re2 dependency (required by gRPC on Bazel 9), update googleapis/grpc/protobuf to latest BCR versions - proto/p4/{config/v1,v1}/BUILD.bazel: load proto_library from @protobuf//bazel rather than the deprecated @rules_proto - presubmit.yml: test on Bazel 7.x and 9.x
bazel-io
pushed a commit
to bazelbuild/bazel-central-registry
that referenced
this pull request
Feb 28, 2026
## Motivation The 1.5.0 BCR entry declares `bazel_compatibility = [">=7.0.0", "<9.0.0"]`, blocking downstream users from upgrading to Bazel 9. The upper bound is overly conservative — no Bazel-9-specific incompatibilities were found. This entry adds a `.bcr.1` release that removes it so BCR users can adopt Bazel 9. The upstream fix is tracked at p4lang/p4runtime#597. ## Implementation A single patch (`fix_bazel_files.patch`) transforms the raw source tarball into the desired state, mirroring the structure of the existing `1.5.0` entry: - `MODULE.bazel`: remove upper bound and TODO comment, bump version to `1.5.0.bcr.1`, add `re2` dep (required by gRPC on Bazel 9), update `googleapis`/`grpc`/`protobuf` to latest BCR versions - `proto/p4/{config/v1,v1}/BUILD.bazel`: load `proto_library` from `@protobuf//bazel` rather than the deprecated `@rules_proto` - `presubmit.yml`: test on Bazel 7.x and 9.x
smolkaj
added a commit
to p4lang/p4c
that referenced
this pull request
Mar 1, 2026
Bazel 9 is now released. The only blocker is that BCR `p4runtime 1.5.0` declares `bazel_compatibility < 9.0.0`. Suppress the check via `--check_bazel_compatibility=off` until a new p4runtime BCR release is cut (tracked in p4lang/p4runtime#597). Unlike `git_override`, this flag works for modules published to the BCR. Also add a Bazel version matrix to CI (7.x and 9.x), and fix macOS builds: use Command Line Tools clang to avoid requiring a full Xcode install, and set `macos_minimum_os=10.15` which is the minimum for `std::filesystem` support in libc++. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
smolkaj
added a commit
to p4lang/p4c
that referenced
this pull request
Mar 1, 2026
Bazel 9 is now released. The only blocker is that BCR `p4runtime 1.5.0` declares `bazel_compatibility < 9.0.0`. Suppress the check via `--check_bazel_compatibility=off` until a new p4runtime BCR release is cut (tracked in p4lang/p4runtime#597). Unlike `git_override`, this flag works for modules published to the BCR. Also add a Bazel version matrix to CI (7.x and 9.x), and fix macOS builds: use Command Line Tools clang to avoid requiring a full Xcode install, and set `macos_minimum_os=10.15` which is the minimum for `std::filesystem` support in libc++. Signed-off-by: Steffen Smolka <steffen.smolka@gmail.com> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Member
Author
|
Superseded by #590, which now incorporates all the Bazel 9 changes. |
smolkaj
added a commit
to smolkaj/bazel-central-registry
that referenced
this pull request
Mar 1, 2026
The 1.5.0 BCR entry declares bazel_compatibility = [">=7.0.0", "<9.0.0"], blocking downstream users from upgrading to Bazel 9. The upper bound is overly conservative; no Bazel-9-specific incompatibilities exist. This new .bcr.1 release removes it so BCR users can adopt Bazel 9. The upstream fix is tracked at p4lang/p4runtime#597. Changes from 1.5.0: - MODULE.bazel: remove upper bound, bump version to 1.5.0.bcr.1, add re2 dependency (required by gRPC on Bazel 9), update googleapis/grpc/protobuf to latest BCR versions - proto/p4/{config/v1,v1}/BUILD.bazel: load proto_library from @protobuf//bazel rather than the deprecated @rules_proto - presubmit.yml: test on Bazel 7.x and 9.x
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.
Summary
<9.0.0upper bound frombazel_compatibilityand bumps.bazelversionto9.0.0.--incompatible_autoload_externally=+cc_library,+cc_binaryto both.bazelrcfiles (root and bzlmod example). Bazel 9 removed native C++ rules from the global namespace; this flag restores the autoload forcc_libraryandcc_binary. The flag is a no-op on Bazel 7/8 where the rules remain native.grpc 1.76.0bazel/cython_library.bzlstill usesnative.cc_binary(upstream fix landed after the v1.78.0 tag)grpc 1.76.0third_party/address_sorting/address_sorting.bzlstill usesnative.cc_library(not yet fixed upstream)re2to2025-11-05.bcr.1: gRPC 1.76.0 pulls inre2 2024-07-02.bcr.1whoseBUILDusescc_testwithout aload(), which is another Bazel 9 hard error; the November 2025 release fixes that.9.xto the CI matrix and removes the "once we support Bazel 9" TODO.Notes
The
--incompatible_autoload_externallyworkaround can be dropped once gRPC releases a BCR version that replacesnative.cc_*with properly-loaded rules in those two files.Test plan
ubuntu-22.04, bazel-9.xubuntu-latest, bazel-9.x🤖 Generated with Claude Code