diff --git a/mediapipe/framework/tool/mediapipe_graph.bzl b/mediapipe/framework/tool/mediapipe_graph.bzl index 45d98b1eb..ef5182a53 100644 --- a/mediapipe/framework/tool/mediapipe_graph.bzl +++ b/mediapipe/framework/tool/mediapipe_graph.bzl @@ -67,7 +67,8 @@ def data_as_c_string( name, srcs, outs = None, - testonly = None): + testonly = None, + compatible_with = None): """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 @@ -79,6 +80,7 @@ def data_as_c_string( outs: A list containing a single item, the name of the output text file. Defaults to the rule name. 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: fail("srcs must be a single-element list") @@ -92,6 +94,7 @@ def data_as_c_string( cmd = "$(location %s) \"$<\" > \"$@\"" % encode_as_c_string, tools = [encode_as_c_string], testonly = testonly, + compatible_with = compatible_with, ) def mediapipe_simple_subgraph( @@ -208,6 +211,7 @@ def mediapipe_options_library( deps = [], visibility = None, testonly = None, + compatible_with = None, **kwargs): """Registers options protobuf metadata for defining options packets. @@ -217,6 +221,7 @@ def mediapipe_options_library( deps: any additional protobuf dependencies. visibility: The list of packages the subgraph should be visible to. 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. """ @@ -224,16 +229,19 @@ def mediapipe_options_library( name = proto_lib + "_transitive", deps = [proto_lib], testonly = testonly, + compatible_with = compatible_with, ) direct_descriptor_set( name = proto_lib + "_direct", deps = [proto_lib], testonly = testonly, + compatible_with = compatible_with, ) data_as_c_string( name = name + "_inc", srcs = [proto_lib + "_transitive-transitive-descriptor-set.proto.bin"], outs = [proto_lib + "_descriptors.inc"], + compatible_with = compatible_with, ) native.genrule( name = name + "_type_name", @@ -245,6 +253,7 @@ def mediapipe_options_library( tools = ["//mediapipe/framework/tool:message_type_util"], visibility = visibility, testonly = testonly, + compatible_with = compatible_with, ) expand_template( name = name + "_cc", @@ -256,6 +265,7 @@ def mediapipe_options_library( "{{DESCRIPTOR_INC_FILE_PATH}}": native.package_name() + "/" + proto_lib + "_descriptors.inc", }, testonly = testonly, + compatible_with = compatible_with, ) native.cc_library( name = proto_lib.replace("_proto", "_options_registry"), @@ -274,6 +284,7 @@ def mediapipe_options_library( visibility = visibility, testonly = testonly, features = ["-no_undefined"], + compatible_with = compatible_with, **kwargs ) mediapipe_reexport_library(