Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: upgrade Protobuf and gRPC in WORKSPACE#17882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| # See https://github.com/bazelbuild/bazelisk | ||
| USE_BAZEL_VERSION=6.5.0 | ||
| USE_BAZEL_VERSION=7.7.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,13 @@ | ||
| # New protobuf requires C++17 | ||
| build --repo_env=BAZEL_CXXOPTS="-std=c++17" | ||
| # Workaround for rules_python precompilation bug with directory outputs: | ||
| # Newer rules_python (v0.40.0+) attempts to precompile (.py -> .pyc) sources. | ||
| # GAPIC code generator rules (e.g., //tests/integration:asset_py_gapic) output a | ||
| # directory structure of generated code instead of discrete individual files. | ||
| # This triggers: "Error in add: Cannot add directories to Args#add since they may expand to multiple values". | ||
| # Disabling precompilation bypasses the bug without affecting runtime behavior. | ||
| build --@rules_python//python/config_settings:precompile=force_disabled | ||
| # Disable Bzlmod to use legacy WORKSPACE file repository resolution | ||
| common --noenable_bzlmod |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -12,10 +12,39 @@ | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| load("@rules_gapic//:gapic.bzl", "proto_custom_library", "unzipped_srcjar") | ||
| load("@rules_gapic//:gapic.bzl", "proto_custom_library", "unzipped_srcjar", "CustomProtoInfo") | ||
| load("@rules_python//python:defs.bzl", "py_library") | ||
| load("@gapic_generator_python_pip_deps//:requirements.bzl", "requirement") | ||
| # Load modern rules_proto Starlark ProtoInfo provider. | ||
| # Needed because modern rules_proto targets output Starlark ProtoInfo, whereas | ||
| # rules_gapic's proto_custom_library expects rules_gapic's CustomProtoInfo provider. | ||
| load("@rules_proto//proto:defs.bzl", StarlarkProtoInfo = "ProtoInfo") | ||
| # Compatibility adapter rule to convert modern rules_proto Starlark ProtoInfo | ||
| # into rules_gapic CustomProtoInfo provider required by proto_custom_library. | ||
| def _gapic_compat_proto_library_impl(ctx): | ||
| dep = ctx.attr.dep | ||
| starlark_proto = dep[StarlarkProtoInfo] | ||
| return [ | ||
| dep[DefaultInfo], | ||
| # Construct CustomProtoInfo provider needed by rules_gapic's proto_custom_library. | ||
| # Must not return ProtoInfo here so proto_custom_library selects CustomProtoInfo (which has transitive_imports). | ||
| CustomProtoInfo( | ||
| direct_sources = starlark_proto.direct_sources, | ||
| check_deps_sources = starlark_proto.check_deps_sources, | ||
| # Map modern transitive_sources to CustomProtoInfo's transitive_imports field | ||
| transitive_imports = starlark_proto.transitive_sources, | ||
| ), | ||
| ] | ||
parthea marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| gapic_compat_proto_library = rule( | ||
| implementation = _gapic_compat_proto_library_impl, | ||
| attrs = { | ||
| "dep": attr.label(mandatory = True, providers = [StarlarkProtoInfo]), | ||
| } | ||
| ) | ||
| def _gapic_test_file_impl(ctx): | ||
| generated_test_file = ctx.actions.declare_file(ctx.label.name) | ||
| @@ -46,6 +75,22 @@ def py_gapic_library( | ||
| rest_numeric_enums = False, | ||
| deps = [], | ||
| **kwargs): | ||
| # We extract and propagate 'testonly' and 'tags' from kwargs to prevent Bazel dependency analysis | ||
| # errors and ensure wildcard builds (e.g. manual tags) behave correctly. | ||
| testonly = kwargs.get("testonly", False) | ||
| tags = kwargs.get("tags", []) | ||
| compat_srcs = [] | ||
| for i, src in enumerate(srcs): | ||
| compat_name = "%s_compat_src_%d" % (name, i) | ||
| gapic_compat_proto_library( | ||
| name = compat_name, | ||
| dep = src, | ||
| testonly = testonly, | ||
| tags = tags, | ||
| ) | ||
| compat_srcs.append(":%s" % compat_name) | ||
parthea marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| srcjar_target_name = "%s_srcjar" % name | ||
| srcjar_output_suffix = ".srcjar" | ||
| @@ -67,9 +112,11 @@ def py_gapic_library( | ||
| if rest_numeric_enums: | ||
| opt_args = opt_args + ["rest-numeric-enums"] | ||
| # Point deps to compat_srcs so proto_custom_library receives targets providing | ||
| # the CustomProtoInfo provider instead of raw Starlark ProtoInfo targets. | ||
| proto_custom_library( | ||
| name = srcjar_target_name, | ||
| deps = srcs, | ||
| deps = compat_srcs, | ||
| plugin = Label("@gapic_generator_python//:gapic_plugin"), | ||
| plugin_args = plugin_args, | ||
| plugin_file_args = file_args, | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.