Debian Codegraph @

extra/protobuf/protobuf-24.4/build_defs/cc_proto_blacklist_test.bzl

raw
1 """Contains a unittest to verify that `cc_proto_library` does not generate code for blacklisted `.proto` sources (i.e. WKPs)."""
2
3 load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
4
5 def _cc_proto_blacklist_test_impl(ctx):
6 """Verifies that there are no C++ compile actions for Well-Known-Protos.
7
8 Args:
9 ctx: The rule context.
10
11 Returns: A (not further specified) sequence of providers.
12 """
13
14 env = unittest.begin(ctx)
15
16 for dep in ctx.attr.deps:
17 files = dep.files.to_list()
18 asserts.equals(
19 env,
20 [],
21 files,
22 "Expected that target '{}' does not provide files, got {}".format(
23 dep.label,
24 len(files),
25 ),
26 )
27
28 return unittest.end(env)
29
30 cc_proto_blacklist_test = unittest.make(
31 impl = _cc_proto_blacklist_test_impl,
32 attrs = {
33 "deps": attr.label_list(
34 mandatory = True,
35 providers = [CcInfo],
36 ),
37 },
38 )