Squashed 'libs/protobuf/' content from commit fcd3b9a85
git-subtree-dir: libs/protobuf git-subtree-split: fcd3b9a85ef36e46643dc30176cea1a7ad62e02b
This commit is contained in:
38
build_defs/cc_proto_blacklist_test.bzl
Normal file
38
build_defs/cc_proto_blacklist_test.bzl
Normal file
@@ -0,0 +1,38 @@
|
||||
"""Contains a unittest to verify that `cc_proto_library` does not generate code for blacklisted `.proto` sources (i.e. WKPs)."""
|
||||
|
||||
load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
|
||||
|
||||
def _cc_proto_blacklist_test_impl(ctx):
|
||||
"""Verifies that there are no C++ compile actions for Well-Known-Protos.
|
||||
|
||||
Args:
|
||||
ctx: The rule context.
|
||||
|
||||
Returns: A (not further specified) sequence of providers.
|
||||
"""
|
||||
|
||||
env = unittest.begin(ctx)
|
||||
|
||||
for dep in ctx.attr.deps:
|
||||
files = dep.files.to_list()
|
||||
asserts.equals(
|
||||
env,
|
||||
[],
|
||||
files,
|
||||
"Expected that target '{}' does not provide files, got {}".format(
|
||||
dep.label,
|
||||
len(files),
|
||||
),
|
||||
)
|
||||
|
||||
return unittest.end(env)
|
||||
|
||||
cc_proto_blacklist_test = unittest.make(
|
||||
impl = _cc_proto_blacklist_test_impl,
|
||||
attrs = {
|
||||
"deps": attr.label_list(
|
||||
mandatory = True,
|
||||
providers = [CcInfo],
|
||||
),
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user