Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1000 B
39 lines
1000 B
5 years ago
|
"""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:
|
||
3 years ago
|
files = dep.files.to_list()
|
||
5 years ago
|
asserts.equals(
|
||
|
env,
|
||
3 years ago
|
[],
|
||
5 years ago
|
files,
|
||
|
"Expected that target '{}' does not provide files, got {}".format(
|
||
|
dep.label,
|
||
3 years ago
|
len(files),
|
||
5 years ago
|
),
|
||
|
)
|
||
|
|
||
|
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],
|
||
|
),
|
||
|
},
|
||
|
)
|