Propagate compatible_with for drishti_proto_library

PiperOrigin-RevId: 501356895
This commit is contained in:
MediaPipe Team 2023-01-11 13:00:37 -08:00 committed by Copybara-Service
parent 0e56bd38f3
commit 5612af68cd

View File

@ -67,7 +67,8 @@ def data_as_c_string(
name, name,
srcs, srcs,
outs = None, outs = None,
testonly = None): testonly = None,
compatible_with = None):
"""Encodes the data from a file as a C string literal. """Encodes the data from a file as a C string literal.
This produces a text file containing the quoted C string literal. It can be This produces a text file containing the quoted C string literal. It can be
@ -79,6 +80,7 @@ def data_as_c_string(
outs: A list containing a single item, the name of the output text file. outs: A list containing a single item, the name of the output text file.
Defaults to the rule name. Defaults to the rule name.
testonly: pass 1 if the graph is to be used only for tests. testonly: pass 1 if the graph is to be used only for tests.
compatible_with: a list of environments the rule is compatible with.
""" """
if len(srcs) != 1: if len(srcs) != 1:
fail("srcs must be a single-element list") fail("srcs must be a single-element list")
@ -92,6 +94,7 @@ def data_as_c_string(
cmd = "$(location %s) \"$<\" > \"$@\"" % encode_as_c_string, cmd = "$(location %s) \"$<\" > \"$@\"" % encode_as_c_string,
tools = [encode_as_c_string], tools = [encode_as_c_string],
testonly = testonly, testonly = testonly,
compatible_with = compatible_with,
) )
def mediapipe_simple_subgraph( def mediapipe_simple_subgraph(
@ -208,6 +211,7 @@ def mediapipe_options_library(
deps = [], deps = [],
visibility = None, visibility = None,
testonly = None, testonly = None,
compatible_with = None,
**kwargs): **kwargs):
"""Registers options protobuf metadata for defining options packets. """Registers options protobuf metadata for defining options packets.
@ -217,6 +221,7 @@ def mediapipe_options_library(
deps: any additional protobuf dependencies. deps: any additional protobuf dependencies.
visibility: The list of packages the subgraph should be visible to. visibility: The list of packages the subgraph should be visible to.
testonly: pass 1 if the graph is to be used only for tests. testonly: pass 1 if the graph is to be used only for tests.
compatible_with: a list of environments the rule is compatible with.
**kwargs: Remaining keyword args, forwarded to cc_library. **kwargs: Remaining keyword args, forwarded to cc_library.
""" """
@ -224,16 +229,19 @@ def mediapipe_options_library(
name = proto_lib + "_transitive", name = proto_lib + "_transitive",
deps = [proto_lib], deps = [proto_lib],
testonly = testonly, testonly = testonly,
compatible_with = compatible_with,
) )
direct_descriptor_set( direct_descriptor_set(
name = proto_lib + "_direct", name = proto_lib + "_direct",
deps = [proto_lib], deps = [proto_lib],
testonly = testonly, testonly = testonly,
compatible_with = compatible_with,
) )
data_as_c_string( data_as_c_string(
name = name + "_inc", name = name + "_inc",
srcs = [proto_lib + "_transitive-transitive-descriptor-set.proto.bin"], srcs = [proto_lib + "_transitive-transitive-descriptor-set.proto.bin"],
outs = [proto_lib + "_descriptors.inc"], outs = [proto_lib + "_descriptors.inc"],
compatible_with = compatible_with,
) )
native.genrule( native.genrule(
name = name + "_type_name", name = name + "_type_name",
@ -245,6 +253,7 @@ def mediapipe_options_library(
tools = ["//mediapipe/framework/tool:message_type_util"], tools = ["//mediapipe/framework/tool:message_type_util"],
visibility = visibility, visibility = visibility,
testonly = testonly, testonly = testonly,
compatible_with = compatible_with,
) )
expand_template( expand_template(
name = name + "_cc", name = name + "_cc",
@ -256,6 +265,7 @@ def mediapipe_options_library(
"{{DESCRIPTOR_INC_FILE_PATH}}": native.package_name() + "/" + proto_lib + "_descriptors.inc", "{{DESCRIPTOR_INC_FILE_PATH}}": native.package_name() + "/" + proto_lib + "_descriptors.inc",
}, },
testonly = testonly, testonly = testonly,
compatible_with = compatible_with,
) )
native.cc_library( native.cc_library(
name = proto_lib.replace("_proto", "_options_registry"), name = proto_lib.replace("_proto", "_options_registry"),
@ -274,6 +284,7 @@ def mediapipe_options_library(
visibility = visibility, visibility = visibility,
testonly = testonly, testonly = testonly,
features = ["-no_undefined"], features = ["-no_undefined"],
compatible_with = compatible_with,
**kwargs **kwargs
) )
mediapipe_reexport_library( mediapipe_reexport_library(