Skip to content

Commit

Permalink
[Release] Upmerge v1.55.x branch into master (grpc#33277)
Browse files Browse the repository at this point in the history
Change was created by the release automation script. See go/grpc-release

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->

---------

Co-authored-by: Yash Tibrewal <[email protected]>
Co-authored-by: Esun Kim <[email protected]>
Co-authored-by: Mark D. Roth <[email protected]>
Co-authored-by: Yousuk Seung <[email protected]>
Co-authored-by: Craig Tiller <[email protected]>
Co-authored-by: Richard Belleville <[email protected]>
Co-authored-by: gnossen <[email protected]>
  • Loading branch information
8 people authored May 30, 2023
1 parent c5ade30 commit 10001d1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
42 changes: 27 additions & 15 deletions bazel/protobuf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,36 @@ load("@rules_proto//proto:defs.bzl", "ProtoInfo")
_PROTO_EXTENSION = ".proto"
_VIRTUAL_IMPORTS = "/_virtual_imports/"

_WELL_KNOWN_PROTOS_BASE = [
"any_proto",
"api_proto",
"compiler_plugin_proto",
"descriptor_proto",
"duration_proto",
"empty_proto",
"field_mask_proto",
"source_context_proto",
"struct_proto",
"timestamp_proto",
"type_proto",
"wrappers_proto",
]

def well_known_proto_libs():
return [
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:api_proto",
"@com_google_protobuf//:compiler_plugin_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:source_context_proto",
"@com_google_protobuf//:struct_proto",
"@com_google_protobuf//:timestamp_proto",
"@com_google_protobuf//:type_proto",
"@com_google_protobuf//:wrappers_proto",
]
return ["@com_google_protobuf//:" + b for b in _WELL_KNOWN_PROTOS_BASE]

def is_well_known(label):
return label in well_known_proto_libs()
# Bazel surfaces labels as their undelying identity, even if they are referenced
# via aliases. Bazel also does not currently provide a way to find the real label
# underlying an alias. So the implementation detail that the WKTs present at the
# top level of the protobuf repo are actually backed by targets in the
# //src/google/protobuf package leaks through here.
# We include both the alias path and the underlying path to be resilient to
# reversions of this change as well as for continuing compatiblity with repos
# that happen to pull in older versions of protobuf.
all_wkt_targets = (["@com_google_protobuf//:" + b for b in _WELL_KNOWN_PROTOS_BASE] +
["@com_google_protobuf//src/google/protobuf:" + b for b in _WELL_KNOWN_PROTOS_BASE])
return label in all_wkt_targets

def get_proto_root(workspace_root):
"""Gets the root protobuf directory.
Expand Down
5 changes: 4 additions & 1 deletion bazel/python_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ def _gen_py_aspect_impl(target, context):
# Early return for well-known protos.
if is_well_known(str(context.label)):
return [
PyProtoInfo(py_info = context.attr._protobuf_library[PyInfo]),
PyProtoInfo(
py_info = context.attr._protobuf_library[PyInfo],
generated_py_srcs = [],
),
]

protos = []
Expand Down
10 changes: 0 additions & 10 deletions test/distrib/bazel/python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ py_test(
srcs = ["helloworld.py"],
main = "helloworld.py",
python_version = "PY3",
tags = [
# TODO(jtattermusch): Remove the "manual" tag to run on CI again once
# https://github.com/grpc/grpc/issues/32778 is fixed.
"manual",
],
deps = [
":duration_py_pb2",
":helloworld_py_pb2",
Expand Down Expand Up @@ -113,11 +108,6 @@ py_test(
srcs = ["helloworld_moved.py"],
main = "helloworld_moved.py",
python_version = "PY3",
tags = [
# TODO(jtattermusch): Remove the "manual" tag to run on CI again once
# https://github.com/grpc/grpc/issues/32778 is fixed.
"manual",
],
deps = [
":duration_py_pb2",
":helloworld_moved_py_pb2",
Expand Down

0 comments on commit 10001d1

Please sign in to comment.