Upgrade to Bazel 7.7.0, rules_python 1.0.0, and protobuf 29.5#47
Draft
rjhuijsman wants to merge 3 commits intomainfrom
Draft
Upgrade to Bazel 7.7.0, rules_python 1.0.0, and protobuf 29.5#47rjhuijsman wants to merge 3 commits intomainfrom
rjhuijsman wants to merge 3 commits intomainfrom
Conversation
Bazel 7 introduces several breaking changes that required updates:
- `.bazeliskrc`: Bump version from 5.4.1 to 7.7.0.
- `.bazelrc`: Add `common --enable_bzlmod=false`. Bazel 7 enables
bzlmod by default; disabling it keeps the WORKSPACE-based build
working until we are ready to migrate to MODULE.bazel.
- `WORKSPACE.bazel`: Remove the `external = False` argument from
`repos()`. This parameter no longer exists (see repos.bzl below).
- `bazel/repos.bzl`: Bazel 7 removes the `repo_mapping` parameter
from repository rules (`http_archive`, `git_repository`, etc.),
so all explicit `repo_mapping = {}` arguments are removed.
`native.existing_rules()` is deprecated in Bazel 7; the
conditional self-registration pattern (`if external:`) is replaced
throughout with `maybe()` from `@bazel_tools`. `rules_python` is
upgraded from 0.27.0 to 1.0.0 (required by protobuf 29.x). The
`com_google_protobuf` `git_repository` is replaced with an
`http_archive` for protobuf 29.5 (better reproducibility and
avoids git fetch overhead).
- `bazel/deps.bzl`, `bazel/py_toolchains.bzl`: Remove `repo_mapping`
parameter (no longer accepted by the called functions).
- `bazel/pypi_repos.bzl`: rules_python 1.0.0 removed the
`@python3_10_12//:defs.bzl` `interpreter` symbol. Replace with
the `"@python3_10_12_host//:python"` label string.
- `rules.bzl`: Update `ProtoInfo` import from
`@rules_proto//proto:defs.bzl` to
`@com_google_protobuf//bazel/common:proto_info.bzl` (moved in
protobuf 29.x). Also fix a latent output-directory bug: in Bazel 7,
`output_files[0].path` for directory-typed outputs already includes
the workspace root for external repos; the old code appended it a
second time, doubling the path and breaking protoc invocations when
this rule is used from an external consumer.
- `tests/python/BUILD.bazel`: protobuf 29.x moved `py_proto_library`
to `@com_google_protobuf//bazel:py_proto_library.bzl` and changed
the attribute from `srcs` to `deps`.
- `tests/cpp/BUILD.bazel`: protobuf 29.x moved `cc_proto_library` to
`@com_google_protobuf//bazel:cc_proto_library.bzl`.
- `requirements.in`, `requirements_lock.txt`: Bump the minimum
protobuf Python runtime from `>=3` to `>=5.29.5` to match the
gencode version produced by protobuf 29.5, and regenerate the
lock file accordingly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Current Aviator status
This pull request is currently open (not queued). How to mergeTo merge this PR, comment
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
Trailing comma in multi-line function call required by buildifier. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
On resource-constrained CI runners (e.g., macOS arm64), the default 600s timeout for whl_library extraction may be insufficient when running concurrently with intensive C++ compilation. Increase to 1800s to avoid spurious timeouts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
This PR upgrades the Bazel build to Bazel 7.7.0 as part of a coordinated
upgrade across the entire monorepo. It also upgrades
rules_pythonfrom0.27.0 to 1.0.0 and
protobuffrom an older version to 29.5.Why things had to change
Bazel 7.7.0 (
.bazeliskrc)Bumped
USE_BAZEL_VERSIONfrom 5.4.1 to 7.7.0.bzlmod disabled (
.bazelrc)Bazel 7 enables bzlmod by default. Added
common --enable_bzlmod=falseto keep the existing WORKSPACE-based build working until the project
is ready to migrate to
MODULE.bazel.repo_mappingparameter removed (bazel/repos.bzl,bazel/deps.bzl,bazel/py_toolchains.bzl)Bazel 7 removed the
repo_mappingparameter from repository rules(
http_archive,git_repository, etc.). All explicitrepo_mapping = {}arguments have been removed.
native.existing_rules()deprecated;externalparameter removed (bazel/repos.bzl,WORKSPACE.bazel)Bazel 7 deprecates
native.existing_rules(). The pattern of acceptingan
externalparameter to conditionally register the repo's owngit_repository(so downstream consumers could pull it in) is replacedthroughout with
maybe()from@bazel_tools//tools/build_defs/repo:utils.bzl,which already skips registration if the repo already exists.
rules_python 1.0.0 (
bazel/repos.bzl,bazel/pypi_repos.bzl)Upgraded from 0.27.0 to 1.0.0, required by protobuf 29.x which loads
rules_pythoninternally. In 1.0.0, the@python3_10_12//:defs.bzlinterpretersymbol no longer exists; it is replaced by the label string"@python3_10_12_host//:python".protobuf 29.5 (
bazel/repos.bzl)Upgraded to protobuf 29.5 (switching from a
git_repositoryto a morereproducible
http_archive). This required downstream changes:rules.bzl:ProtoInfomoved from@rules_proto//proto:defs.bzlto
@com_google_protobuf//bazel/common:proto_info.bzl. Also fixed alatent output-directory bug exposed by Bazel 7:
output_files[0].pathfor directory-typed outputs already includes the workspace root for
external repos, so the old code that appended
workspace_rootagainwas doubling the path and breaking
protocinvocations when this ruleis consumed from an external workspace.
tests/python/BUILD.bazel:py_proto_librarymoved to@com_google_protobuf//bazel:py_proto_library.bzl; attribute renamedfrom
srcstodeps.tests/cpp/BUILD.bazel:cc_proto_librarymoved to@com_google_protobuf//bazel:cc_proto_library.bzl.requirements.in/requirements_lock.txt: The Python protobufruntime must match the gencode version. Protobuf 29.5 produces gencode
for runtime
>=5.29.5; the old>=3lower bound caused aVersionErrorat import time.Test plan
bazel test //...in this repo passesbazel test //...in the monorepo passes (consumes this as a submodule)