grpc 第三方依赖 就是grpc的 third_party 文件夹
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.

71 lines
1.8 KiB

2 years ago
# Example C++ binary that uses the generated validation code.
#
# This binary attempts to read files named on the command line as binary protos.
# To try it out, first use Bazel to build this binary:
#
# bazel build //:example_cc
#
# Now run it on some files. From the repository root directory:
#
# bazel run //:example_cc -- $(pwd)/example.cc
#
# The binary will fail because example.cc is not a valid textproto. Luckily
# this directory contains two textprotos already: valid.textproto and
# invalid.textproto. From the root directory:
#
# bazel run //:example_cc -- $(pwd)/valid.textproto
#
# which succeeds, or
#
# bazel run //:example_cc -- $(pwd)/invalid.textproto
#
# which fails.
cc_binary(
name = "example_cc",
srcs = ["example.cc"],
deps = ["//foo:bar_cc_proto"],
)
# Example python binary that uses the dynamic python validation code.
#
# Exactly as example_cc above except different label. Example:
#
# bazel run //:example_py -- $(pwd)/valid.textproto
py_binary(
name = "example_py",
srcs = ["example.py"],
main = "example.py",
srcs_version = "PY3",
deps = [
"@com_google_protobuf//:protobuf_python",
"@com_envoyproxy_protoc_gen_validate//python:validator_py",
"//foo:bar_py_proto",
],
)
# Test that the example textproto inputs evoke the right responses.
[
sh_test(
name = "example_{lang}_test_{which}".format(lang=lang, which=which),
srcs = ["example_test.sh"],
args = [
"$(location :example_{lang})".format(lang=lang),
str(code),
"$(location :{which})".format(which=which),
],
data = [
which,
":example_{lang}".format(lang=lang),
],
)
for lang in (
"cc",
"py",
)
for (which, code) in (
("valid.textproto", 0),
("invalid.textproto", 1),
)
]