Skip to content

Commit b301bef

Browse files
authored
fix: allow proto files to be included in the output of py_gapic_assembly_pkg (#2349)
1 parent df4d16f commit b301bef

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

rules_python_gapic/py_gapic_pkg.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ def _py_gapic_src_pkg_impl(ctx):
1919
dir_srcs = []
2020
py_srcs = []
2121
for dep in ctx.attr.deps:
22+
# Check if this is a `proto_library` dependency which has `ProtoInfo`
23+
# See https://bazel.build/versions/6.5.0/rules/lib/ProtoInfo
24+
if ProtoInfo in dep:
25+
# Add `*.proto` files to the output which exist in `direct_sources`
26+
# https://bazel.build/versions/6.5.0/rules/lib/ProtoInfo#direct_sources
27+
for source in dep[ProtoInfo].direct_sources:
28+
py_srcs.append(source)
2229
for f in dep.files.to_list():
2330
if f.is_directory:
2431
dir_srcs.append(f)

0 commit comments

Comments
 (0)