No user facing changes

PiperOrigin-RevId: 588501289
This commit is contained in:
MediaPipe Team 2023-12-06 12:01:55 -08:00 committed by Copybara-Service
parent 0a3f27d1ce
commit 78af80027a

View File

@ -76,10 +76,12 @@ def _get_proto_provider(dep):
""" """
if ProtoInfo in dep: if ProtoInfo in dep:
return dep[ProtoInfo] return dep[ProtoInfo]
elif hasattr(dep, "proto"): elif hasattr(dep, "proto"):
return dep.proto return dep.proto
else: else:
fail("cannot happen, rule definition requires .proto or ProtoInfo") fail("cannot happen, rule definition requires .proto" +
" or ProtoInfo")
def _encode_binary_proto_impl(ctx): def _encode_binary_proto_impl(ctx):
"""Implementation of the encode_binary_proto rule.""" """Implementation of the encode_binary_proto rule."""
@ -142,7 +144,10 @@ _encode_binary_proto = rule(
cfg = "exec", cfg = "exec",
), ),
"deps": attr.label_list( "deps": attr.label_list(
providers = [[ProtoInfo], ["proto"]], providers = [
[ProtoInfo],
["proto"],
],
), ),
"input": attr.label( "input": attr.label(
mandatory = True, mandatory = True,
@ -182,7 +187,10 @@ def _generate_proto_descriptor_set_impl(ctx):
all_protos = depset(transitive = [ all_protos = depset(transitive = [
_get_proto_provider(dep).transitive_sources _get_proto_provider(dep).transitive_sources
for dep in ctx.attr.deps for dep in ctx.attr.deps
if ProtoInfo in dep or hasattr(dep, "proto") if (
ProtoInfo in dep or
hasattr(dep, "proto")
)
]) ])
descriptor = ctx.outputs.output descriptor = ctx.outputs.output
@ -213,7 +221,10 @@ generate_proto_descriptor_set = rule(
cfg = "exec", cfg = "exec",
), ),
"deps": attr.label_list( "deps": attr.label_list(
providers = [[ProtoInfo], ["proto"]], providers = [
[ProtoInfo],
["proto"],
],
), ),
}, },
outputs = {"output": "%{name}.proto.bin"}, outputs = {"output": "%{name}.proto.bin"},