Skip to content

fix: upgrade Protobuf and gRPC in WORKSPACE#17882

Draft
parthea wants to merge 8 commits into
mainfrom
upgrade-protobuf-bazel
Draft

fix: upgrade Protobuf and gRPC in WORKSPACE#17882
parthea wants to merge 8 commits into
mainfrom
upgrade-protobuf-bazel

Conversation

@parthea

@parthea parthea commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
  • Upgrade Dependencies: Upgrade Protobuf to v35.1, rules_python to v1.1.0, and gRPC to v1.83.0
  • Hermetic Python & CI: Register hermetic Python toolchains (3.10–3.13) in WORKSPACE with ignore_root_user_error = True for Github Actions compatibility.
  • ProtoInfo Compatibility: Add gapic_compat_proto_library in py_gapic.bzl to bridge modern rules_proto Starlark ProtoInfo with rules_gapic 's CustomProtoInfo.
  • Disable Python precompilation for generated directory outputs.

@parthea
parthea force-pushed the upgrade-protobuf-bazel branch from ef2531f to 1300086 Compare July 23, 2026 19:26

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades Bazel to version 7.7.1, restructures the WORKSPACE to load modern dependencies first (including Protobuf 35.1, rules_python v1.1.0, and gRPC), and introduces a compatibility wrapper rule in py_gapic.bzl to bridge legacy CustomProtoInfo with modern ProtoInfo. Feedback highlights two critical improvements in py_gapic.bzl: first, the compatibility wrapper should forward the original ProtoInfo provider alongside CustomProtoInfo to prevent downstream resolution failures; second, the testonly attribute must be propagated to the dynamically generated compatibility targets to avoid Bazel dependency analysis errors.

Comment thread packages/gapic-generator/rules_python_gapic/py_gapic.bzl
Comment thread packages/gapic-generator/rules_python_gapic/py_gapic.bzl
@parthea
parthea force-pushed the upgrade-protobuf-bazel branch 5 times, most recently from e7f6983 to 299b32e Compare July 23, 2026 20:34
@parthea
parthea force-pushed the upgrade-protobuf-bazel branch from 299b32e to 1cb12cf Compare July 23, 2026 21:16
@parthea parthea changed the title for testing purposes fix: upgrade Protobuf and gRPC in WORKSPACE Jul 23, 2026
@parthea

parthea commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Bazel build configuration, upgrading several dependencies including Bazel (to 7.7.1), rules_python (to 1.1.0), and gRPC (to 1.83.0). It also introduces a compatibility adapter rule (gapic_compat_proto_library) to bridge modern Starlark ProtoInfo with rules_gapic's CustomProtoInfo. Feedback on these changes highlights three key issues: first, the temporary gRPC patch applied in the main WORKSPACE is missing from repositories.bzl, which will break downstream builds; second, defaulting testonly to None instead of False in the compatibility adapter can trigger Starlark evaluation errors; and third, using python3 -c in patch_cmds compromises Bazel's hermeticity and cross-platform compatibility, suggesting the use of a standard patch file instead.

Comment thread packages/gapic-generator/repositories.bzl
Comment thread packages/gapic-generator/rules_python_gapic/py_gapic.bzl Outdated
Comment thread packages/gapic-generator/WORKSPACE Outdated
@parthea

parthea commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades Bazel to version 7.7.1 and updates several key dependencies in the WORKSPACE file, including Protobuf, rules_python, rules_cc, bazel_skylib, and gRPC. It also registers multi-version hermetic Python toolchains and introduces a compatibility adapter rule (gapic_compat_proto_library) in py_gapic.bzl to bridge modern rules_proto Starlark ProtoInfo with rules_gapic's CustomProtoInfo. A critical issue was identified in the adapter implementation where the CustomProtoInfo provider is instantiated with a non-existent transitive_descriptor_sets field, which will cause a Bazel analysis-phase error.

Comment thread packages/gapic-generator/rules_python_gapic/py_gapic.bzl Outdated
@parthea

parthea commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades Bazel to version 7.7.1 and updates several dependencies in the WORKSPACE file, including Protobuf, rules_python, rules_cc, and gRPC. It also introduces a compatibility adapter rule gapic_compat_proto_library in py_gapic.bzl to bridge modern rules_proto Starlark ProtoInfo with rules_gapic's expected CustomProtoInfo provider. The review feedback suggests forwarding the DefaultInfo provider in the compatibility adapter to preserve default outputs and runfiles, and recommends using Label() instead of a hardcoded workspace name when referencing the gRPC patch file in repositories.bzl.

Comment thread packages/gapic-generator/rules_python_gapic/py_gapic.bzl
Comment thread packages/gapic-generator/repositories.bzl Outdated
@parthea

parthea commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request upgrades Bazel to 7.7.1 and updates several dependencies, including Protobuf to 35.1, rules_python to 1.1.0, and gRPC to 1.83.0 (with a temporary patch). It also introduces a compatibility adapter rule, gapic_compat_proto_library, to bridge modern Starlark ProtoInfo with rules_gapic's expected CustomProtoInfo. The feedback suggests propagating the tags attribute to the dynamically created helper targets in the py_gapic_library macro to ensure wildcard builds behave correctly.

Comment thread packages/gapic-generator/rules_python_gapic/py_gapic.bzl Outdated
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.

1 participant