add target_compatible_with to cc_proto_library rule
cc_proto_library has multiple subtypes (such as cc_lite_proto_library)
that can have different target requirements. This commit adds target
compatibility support for these rules.
Bug: 215229742
Test: ci/bp2build.sh
Change-Id: Ifbb801d2bd3d6c71790890704a6d55cdf34ddd05
diff --git a/rules/cc_proto.bzl b/rules/cc_proto.bzl
index 5793d16..6577b77 100644
--- a/rules/cc_proto.bzl
+++ b/rules/cc_proto.bzl
@@ -159,6 +159,7 @@
name,
deps = [],
plugin = None,
+ target_compatible_with = [],
out_format = None,
proto_dep = None):
proto_lib_name = name + "_proto_gen"
@@ -191,16 +192,19 @@
proto_dep,
],
local_includes = ["."],
+ target_compatible_with = target_compatible_with,
)
def cc_lite_proto_library(
name,
deps = [],
- plugin = None):
+ plugin = None,
+ target_compatible_with = []):
_cc_proto_library(
name,
deps = deps,
plugin = plugin,
+ target_compatible_with = target_compatible_with,
out_format = "lite",
proto_dep = "//external/protobuf:libprotobuf-cpp-lite",
)
@@ -208,10 +212,12 @@
def cc_proto_library(
name,
deps = [],
- plugin = None):
+ plugin = None,
+ target_compatible_with = []):
_cc_proto_library(
name,
deps = deps,
plugin = plugin,
+ target_compatible_with = target_compatible_with,
proto_dep = "//external/protobuf:libprotobuf-cpp-full",
)