Make Buildifier Sanity Test Strict (#27807)

* Fix all lint errors in repo.

* Use strict buildifier by default

* Whoops. That file does not exist

* Attempt fix to buildifier invocation

* Add missing copyright
pull/27933/head
Richard Belleville 3 years ago committed by GitHub
parent cb95e9f3ee
commit 468768865b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      bazel/BUILD
  2. 4
      bazel/copts.bzl
  3. 4
      bazel/custom_exec_properties.bzl
  4. 18
      bazel/generate_cc.bzl
  5. 26
      bazel/generate_objc.bzl
  6. 15
      bazel/gevent_test.bzl
  7. 90
      bazel/grpc_build_system.bzl
  8. 6
      bazel/grpc_deps.bzl
  9. 4
      bazel/grpc_extra_deps.bzl
  10. 3
      bazel/grpc_python_deps.bzl
  11. 13
      bazel/grpc_util.bzl
  12. 7
      bazel/internal_python_rules.bzl
  13. 5
      bazel/objc_grpc_library.bzl
  14. 44
      bazel/protobuf.bzl
  15. 2
      bazel/python_rules.bzl
  16. 11
      examples/objective-c/BUILD
  17. 9
      examples/protos/BUILD
  18. 1
      examples/python/cancellation/BUILD.bazel
  19. 2
      examples/python/data_transmission/BUILD
  20. 2
      examples/python/debug/BUILD.bazel
  21. 2
      examples/python/wait_for_ready/BUILD.bazel
  22. 38
      grpc.bzl
  23. 16
      src/compiler/BUILD
  24. 8
      src/objective-c/examples/BUILD
  25. 47
      src/objective-c/grpc_objc_internal_library.bzl
  26. 8
      src/objective-c/tests/BUILD
  27. 4
      src/proto/grpc/channelz/BUILD
  28. 4
      src/proto/grpc/core/BUILD
  29. 4
      src/proto/grpc/gcp/BUILD
  30. 4
      src/proto/grpc/health/v1/BUILD
  31. 4
      src/proto/grpc/lb/v1/BUILD
  32. 4
      src/proto/grpc/lookup/v1/BUILD
  33. 4
      src/proto/grpc/reflection/v1alpha/BUILD
  34. 4
      src/proto/grpc/status/BUILD
  35. 5
      src/proto/grpc/testing/BUILD
  36. 4
      src/proto/grpc/testing/duplicate/BUILD
  37. 4
      src/proto/grpc/testing/proto2/BUILD.bazel
  38. 4
      src/proto/grpc/testing/xds/BUILD
  39. 4
      src/proto/grpc/testing/xds/v3/BUILD
  40. 9
      src/python/grpcio/grpc/_cython/BUILD.bazel
  41. 2
      src/python/grpcio_csds/grpc_csds/BUILD.bazel
  42. 1
      src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel
  43. 4
      src/python/grpcio_tests/tests/unit/_cython/BUILD.bazel
  44. 4
      src/python/grpcio_tests/tests/unit/framework/foundation/BUILD.bazel
  45. 4
      test/build_test/BUILD
  46. 2
      test/core/avl/BUILD
  47. 2
      test/core/backoff/BUILD
  48. 5
      test/core/bad_client/BUILD
  49. 1
      test/core/bad_client/generate_tests.bzl
  50. 2
      test/core/bad_connection/BUILD
  51. 5
      test/core/bad_ssl/BUILD
  52. 7
      test/core/bad_ssl/generate_tests.bzl
  53. 2
      test/core/channel/BUILD
  54. 2
      test/core/client_channel/resolvers/BUILD
  55. 2
      test/core/compression/BUILD
  56. 2
      test/core/debug/BUILD
  57. 5
      test/core/end2end/BUILD
  58. 5
      test/core/end2end/fuzzers/BUILD
  59. 10
      test/core/end2end/generate_tests.bzl
  60. 4
      test/core/fling/BUILD
  61. 2
      test/core/gpr/BUILD
  62. 5
      test/core/gprpp/BUILD
  63. 2
      test/core/handshake/BUILD
  64. 7
      test/core/http/BUILD
  65. 4
      test/core/iomgr/BUILD
  66. 5
      test/core/json/BUILD
  67. 5
      test/core/nanopb/BUILD
  68. 2
      test/core/network_benchmarks/BUILD
  69. 3
      test/core/promise/BUILD
  70. 7
      test/core/promise/benchmark/BUILD
  71. 3
      test/core/resource_quota/BUILD
  72. 3
      test/core/security/BUILD
  73. 5
      test/core/slice/BUILD
  74. 2
      test/core/surface/BUILD
  75. 2
      test/core/transport/BUILD
  76. 9
      test/core/transport/chttp2/BUILD
  77. 2
      test/core/tsi/BUILD
  78. 4
      test/core/tsi/alts/fake_handshaker/BUILD
  79. 2
      test/core/tsi/alts/frame_protector/BUILD
  80. 3
      test/core/uri/BUILD
  81. 2
      test/core/util/BUILD
  82. 27
      test/core/util/grpc_fuzzer.bzl
  83. 4
      test/cpp/client/BUILD
  84. 4
      test/cpp/codegen/BUILD
  85. 4
      test/cpp/common/BUILD
  86. 3
      test/cpp/ext/filters/census/BUILD
  87. 4
      test/cpp/grpclb/BUILD
  88. 4
      test/cpp/interop/BUILD
  89. 7
      test/cpp/microbenchmarks/BUILD
  90. 6
      test/cpp/naming/BUILD
  91. 5
      test/cpp/naming/generate_resolver_component_tests.bzl
  92. 4
      test/cpp/naming/utils/BUILD
  93. 4
      test/cpp/performance/BUILD
  94. 4
      test/cpp/qps/BUILD
  95. 2
      test/cpp/qps/qps_benchmark_script.bzl
  96. 4
      test/cpp/server/BUILD
  97. 4
      test/cpp/server/load_reporter/BUILD
  98. 4
      test/cpp/test/BUILD
  99. 4
      test/cpp/thread_manager/BUILD
  100. 4
      test/cpp/util/BUILD
  101. Some files were not shown because too many files have changed in this diff Show More

@ -12,12 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Contains build targets used by Starlark files in the bazel/ directory.
"""
licenses(["notice"])
package(default_visibility = ["//:__subpackages__"])
load(":cc_grpc_library.bzl", "cc_grpc_library")
filegroup(
name = "_gevent_test_main",
srcs = ["_gevent_test_main.py"],

@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Includes default copts.
"""
# This is a list of llvm flags to be used when being built with use_strict_warning=1
GRPC_LLVM_WARNING_FLAGS = [
# Enable all & extra warnings

@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Reimports constants from the grpc_custom_exec_properties repo.
"""
load("@grpc_custom_exec_properties//:constants.bzl", _LARGE_MACHINE = "LARGE_MACHINE")
LARGE_MACHINE = _LARGE_MACHINE

@ -54,7 +54,13 @@ def _join_directories(directories):
return "/".join(massaged_directories)
def generate_cc_impl(ctx):
"""Implementation of the generate_cc rule."""
"""Implementation of the generate_cc rule.
Args:
ctx: The context object.
Returns:
The provider for the generated files.
"""
protos = [f for src in ctx.attr.srcs for f in src[ProtoInfo].check_deps_sources.to_list()]
includes = [
f
@ -118,7 +124,7 @@ def generate_cc_impl(ctx):
)
tools = [ctx.executable.plugin]
else:
arguments += ["--cpp_out=" + ",".join(ctx.attr.flags) + ":" + dir_out]
arguments.append("--cpp_out=" + ",".join(ctx.attr.flags) + ":" + dir_out)
tools = []
arguments += [
@ -128,7 +134,7 @@ def generate_cc_impl(ctx):
# Include the output directory so that protoc puts the generated code in the
# right directory.
arguments += ["--proto_path={0}{1}".format(dir_out, proto_root)]
arguments.append("--proto_path={0}{1}".format(dir_out, proto_root))
arguments += [_get_srcs_file_path(proto) for proto in protos]
# create a list of well known proto files if the argument is non-None
@ -138,11 +144,11 @@ def generate_cc_impl(ctx):
if f != "external/com_google_protobuf/src/google/protobuf":
print(
"Error: Only @com_google_protobuf//:well_known_protos is supported",
)
) # buildifier: disable=print
else:
# f points to "external/com_google_protobuf/src/google/protobuf"
# add -I argument to protoc so it knows where to look for the proto files.
arguments += ["-I{0}".format(f + "/../..")]
arguments.append("-I{0}".format(f + "/../.."))
well_known_proto_files = [
f
for f in ctx.attr.well_known_protos.files.to_list()
@ -157,7 +163,7 @@ def generate_cc_impl(ctx):
use_default_shell_env = True,
)
return struct(files = depset(out_files))
return struct(files = depset(out_files)) # buildifier: disable=rule-impl-return
_generate_cc = rule(
attrs = {

@ -11,6 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This module contains build rules relating to gRPC Objective-C.
"""
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
load(
"//bazel:protobuf.bzl",
@ -44,13 +49,13 @@ def _generate_objc_impl(ctx):
outs = []
for proto in protos:
outs += [_get_output_file_name_from_proto(proto, _PROTO_HEADER_FMT)]
outs += [_get_output_file_name_from_proto(proto, _PROTO_SRC_FMT)]
outs.append(_get_output_file_name_from_proto(proto, _PROTO_HEADER_FMT))
outs.append(_get_output_file_name_from_proto(proto, _PROTO_SRC_FMT))
file_path = _get_full_path_from_file(proto)
if file_path in files_with_rpc:
outs += [_get_output_file_name_from_proto(proto, _GRPC_PROTO_HEADER_FMT)]
outs += [_get_output_file_name_from_proto(proto, _GRPC_PROTO_SRC_FMT)]
outs.append(_get_output_file_name_from_proto(proto, _GRPC_PROTO_HEADER_FMT))
outs.append(_get_output_file_name_from_proto(proto, _GRPC_PROTO_SRC_FMT))
out_files = [ctx.actions.declare_file(out) for out in outs]
dir_out = _join_directories([
@ -60,6 +65,7 @@ def _generate_objc_impl(ctx):
])
arguments = []
tools = []
if ctx.executable.plugin:
arguments += get_plugin_args(
ctx.executable.plugin,
@ -68,9 +74,9 @@ def _generate_objc_impl(ctx):
False,
)
tools = [ctx.executable.plugin]
arguments += ["--objc_out=" + dir_out]
arguments.append("--objc_out=" + dir_out)
arguments += ["--proto_path=."]
arguments.append("--proto_path=.")
arguments += [
"--proto_path={}".format(get_include_directory(i))
for i in protos
@ -78,7 +84,7 @@ def _generate_objc_impl(ctx):
# Include the output directory so that protoc puts the generated code in the
# right directory.
arguments += ["--proto_path={}".format(dir_out)]
arguments.append("--proto_path={}".format(dir_out))
arguments += ["--proto_path={}".format(_get_directory_from_proto(proto)) for proto in protos]
arguments += [_get_full_path_from_file(proto) for proto in protos]
@ -88,7 +94,7 @@ def _generate_objc_impl(ctx):
f = ctx.attr.well_known_protos.files.to_list()[0].dirname
# go two levels up so that #import "google/protobuf/..." is correct
arguments += ["-I{0}".format(f + "/../..")]
arguments.append("-I{0}".format(f + "/../.."))
well_known_proto_files = ctx.attr.well_known_protos.files.to_list()
ctx.actions.run(
inputs = protos + well_known_proto_files,
@ -98,7 +104,7 @@ def _generate_objc_impl(ctx):
arguments = arguments,
)
return struct(files = depset(out_files))
return struct(files = depset(out_files)) # buildifier: disable=rule-impl-return
def _label_to_full_file_path(src, package):
if not src.startswith("//"):
@ -198,7 +204,7 @@ def _group_objc_files_impl(ctx):
for file in ctx.attr.src.files.to_list()
if file.basename.endswith(suffix)
]
return struct(files = depset(out_files))
return struct(files = depset(out_files)) # buildifier: disable=rule-impl-return
generate_objc_hdrs = rule(
attrs = {

@ -11,6 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Houses py_grpc_gevent_test.
"""
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
_GRPC_LIB = "//src/python/grpcio/grpc:grpcio"
@ -24,6 +29,16 @@ def py_grpc_gevent_test(
deps = None,
data = None,
**kwargs):
"""Runs a Python test with gevent monkeypatched in.
Args:
name: The name of the test.
srcs: The source files.
main: The main file of the test.
deps: The dependencies of the test.
data: The data dependencies of the test.
**kwargs: Any other test arguments.
"""
if main == None:
if len(srcs) != 1:
fail("When main is not provided, srcs must be of size 1.")

@ -23,6 +23,10 @@
# each change must be ported from one to the other.
#
"""
Contains macros used throughout the repo.
"""
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("//bazel:copts.bzl", "GRPC_DEFAULT_COPTS")
load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library", "upb_proto_reflection_library")
@ -48,20 +52,20 @@ def _get_external_deps(external_deps):
ret = []
for dep in external_deps:
if dep == "address_sorting":
ret += ["//third_party/address_sorting"]
ret.append("//third_party/address_sorting")
elif dep == "xxhash":
ret += ["//third_party/xxhash"]
ret.append("//third_party/xxhash")
elif dep == "cares":
ret += select({
"//:grpc_no_ares": [],
"//conditions:default": ["//external:cares"],
})
elif dep == "cronet_c_for_grpc":
ret += ["//third_party/objective_c/Cronet:cronet_c_for_grpc"]
ret.append("//third_party/objective_c/Cronet:cronet_c_for_grpc")
elif dep.startswith("absl/"):
ret += ["@com_google_absl//" + dep]
ret.append("@com_google_absl//" + dep)
else:
ret += ["//external:" + dep]
ret.append("//external:" + dep)
return ret
def _update_visibility(visibility):
@ -120,6 +124,27 @@ def grpc_cc_library(
use_cfstream = False,
tags = [],
linkstatic = False):
"""An internal wrapper around cc_library.
Args:
name: The name of the library.
srcs: The source files.
public_hdrs: The public headers.
hdrs: The headers.
external_deps: External depdendencies to be resolved.
defines: Build defines to use.
deps: cc_library deps.
select_deps: deps included conditionally.
standalone: Unused.
language: The language of the library, e.g. C, C++.
testonly: Whether the target is for tests only.
visibility: The visibility of the target.
alwayslink: Whether to enable alwayslink on the cc_library.
data: Data dependencies.
use_cfstream: Whether to use cfstream.
tags: Tags to apply to the rule.
linkstatic: Whether to enable linkstatic on the cc_library.
"""
visibility = _update_visibility(visibility)
copts = []
if use_cfstream:
@ -197,6 +222,13 @@ def ios_cc_test(
name,
tags = [],
**kwargs):
"""An ios C++ test target.
Args:
name: The name of the test.
tags: The tags to apply to the test.
**kwargs: All other arguments to apply.
"""
ios_test_adapter = "//third_party/objective_c/google_toolbox_for_mac:GTM_GoogleTestRunner_GTM_USING_XCTEST"
test_lib_ios = name + "_test_lib_ios"
@ -221,6 +253,28 @@ def ios_cc_test(
)
def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = None, tags = [], exec_compatible_with = [], exec_properties = {}, shard_count = None, flaky = None, copts = []):
"""A cc_test target for use in the gRPC repo.
Args:
name: The name of the test.
srcs: The source files.
deps: The target deps.
external_deps: The external deps.
args: The args to supply to the test binary.
data: Data dependencies.
uses_polling: Whether the test uses polling.
language: The language of the test, e.g C, C++.
size: The size of the test.
timeout: The test timeout.
tags: The tags for the test.
exec_compatible_with: A list of constraint values that must be
satisifed for the platform.
exec_properties: A dictionary of strings that will be added to the
exec_properties of a platform selected for this target.
shard_count: The number of shards for this test.
flaky: Whether this test is flaky.
copts: Add these to the compiler invocation.
"""
copts = copts + if_mac(["-DGRPC_CFSTREAM"])
if language.upper() == "C":
copts = copts + if_not_windows(["-std=c99"])
@ -283,6 +337,22 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
)
def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = [], tags = [], features = []):
"""Generates a cc_binary for use in the gRPC repo.
Args:
name: The name of the target.
srcs: The source files.
deps: The dependencies.
external_deps: The external dependencies.
args: The arguments to supply to the binary.
data: The data dependencies.
language: The language of the binary, e.g. C, C++.
testonly: Whether the binary is for tests only.
linkshared: Enables linkshared on the binary.
linkopts: linkopts to supply to the cc_binary.
tags: Tags to apply to the target.
features: features to be supplied to the cc_binary.
"""
copts = []
if language.upper() == "C":
copts = ["-std=c99"]
@ -300,6 +370,7 @@ def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], da
features = features,
)
# buildifier: disable=unnamed-macro
def grpc_generate_one_off_targets():
# In open-source, grpc_objc* libraries depend directly on //:grpc
native.alias(
@ -345,6 +416,13 @@ def grpc_py_binary(
)
def grpc_package(name, visibility = "private", features = []):
"""Creates a package.
Args:
name: The name of the target
visibility: The visibility of the target.
features: The features to enable.
"""
if visibility == "tests":
visibility = ["//test:__subpackages__"]
elif visibility == "public":
@ -355,6 +433,7 @@ def grpc_package(name, visibility = "private", features = []):
fail("Unknown visibility " + visibility)
if len(visibility) != 0:
# buildifier: disable=native-package
native.package(
default_visibility = visibility,
features = features,
@ -402,6 +481,7 @@ def grpc_upb_proto_library(name, deps):
def grpc_upb_proto_reflection_library(name, deps):
upb_proto_reflection_library(name = name, deps = deps)
# buildifier: disable=unnamed-macro
def python_config_settings():
native.config_setting(
name = "python3",

@ -16,6 +16,7 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps")
# buildifier: disable=unnamed-macro
def grpc_deps():
"""Loads dependencies need to compile and test the grpc library."""
@ -447,9 +448,12 @@ def grpc_deps():
grpc_python_deps()
# TODO: move some dependencies from "grpc_deps" here?
# buildifier: disable=unnamed-macro
def grpc_test_only_deps():
"""Internal, not intended for use by packages that are consuming grpc.
Loads dependencies that are only needed to run grpc library's tests."""
Loads dependencies that are only needed to run grpc library's tests.
"""
native.bind(
name = "twisted",
actual = "@com_github_twisted_twisted//:twisted",

@ -39,6 +39,10 @@ def grpc_extra_deps(ignore_version_differences = False):
grpc_extra_deps()
```
Args:
ignore_version_differences: Plumbed directly to the invocation of
apple_rules_dependencies.
"""
protobuf_deps()

@ -16,7 +16,10 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@com_github_grpc_grpc//third_party/py:python_configure.bzl", "python_configure")
# buildifier: disable=unnamed-macro
def grpc_python_deps():
"""Loads dependencies for gRPC Python."""
# protobuf binds to the name "six", so we can't use it here.
# See https://github.com/bazelbuild/bazel/issues/1952 for why bind is
# horrible.

@ -12,6 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# Follows convention set in objectivec_helpers.cc in the protobuf ObjC compiler.
"""
Contains generic helper utilities.
"""
_upper_segments_list = ["url", "http", "https"]
def strip_extension(str):
@ -24,6 +29,14 @@ def capitalize(word):
return word.capitalize()
def lower_underscore_to_upper_camel(str):
"""Converts from lower underscore case to upper camel case.
Args:
str: The snake case string to convert.
Returns:
The title case version of str.
"""
str = strip_extension(str)
camel_case_str = ""
word = ""

@ -17,7 +17,12 @@ load("//bazel:gevent_test.bzl", "py_grpc_gevent_test")
load("//bazel:python_rules.bzl", "py2and3_test")
def internal_py_grpc_test(name, **kwargs):
"""Runs a test under all supported environments."""
"""Runs a test under all supported environments.
Args:
name: The name of the test.
**kwargs: Any additional arguments to add to the test.
"""
py2and3_test(name, **kwargs)
py_grpc_gevent_test(name, **kwargs)

@ -11,6 +11,10 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Contains the objc_grpc_library rule.
"""
load(
"//bazel:generate_objc.bzl",
"generate_objc",
@ -18,7 +22,6 @@ load(
"generate_objc_non_arc_srcs",
"generate_objc_srcs",
)
load("//bazel:protobuf.bzl", "well_known_proto_libs")
def objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kwargs):
"""Generates messages and/or service stubs for given proto_library and all transitively dependent proto files

@ -76,9 +76,10 @@ def proto_path_to_generated_filename(proto_path, fmt_str):
return fmt_str.format(_strip_proto_extension(proto_path))
def get_include_directory(source_file):
"""Returns the include directory path for the source_file. I.e. all of the
include statements within the given source_file are calculated relative to
the directory returned by this method.
"""Returns the include directory path for the source_file.
All of the include statements within the given source_file are calculated
relative to the directory returned by this method.
The returned directory path can be used as the "--proto_path=" argument
value.
@ -195,7 +196,15 @@ def includes_from_deps(deps):
]
def get_proto_arguments(protos, genfiles_dir_path):
"""Get the protoc arguments specifying which protos to compile."""
"""Get the protoc arguments specifying which protos to compile.
Args:
protos: The protob files to supply.
genfiles_dir_path: The path to the genfiles directory.
Returns:
The arguments to supply to protoc.
"""
arguments = []
for proto in protos:
strip_prefix_len = 0
@ -211,7 +220,18 @@ def get_proto_arguments(protos, genfiles_dir_path):
return arguments
def declare_out_files(protos, context, generated_file_format):
"""Declares and returns the files to be generated."""
"""Declares and returns the files to be generated.
Args:
protos: A list of files. The protos to declare.
context: The context object.
generated_file_format: A format string. Will be passed to
proto_path_to_generated_filename to generate the filename of each
generated file.
Returns:
A list of file providers.
"""
out_file_paths = []
for proto in protos:
@ -232,8 +252,9 @@ def declare_out_files(protos, context, generated_file_format):
]
def get_out_dir(protos, context):
""" Returns the calculated value for --<lang>_out= protoc argument based on
the input source proto files and current context.
"""Returns the value to supply to the --<lang>_out= protoc flag.
The result is based on the input source proto files and current context.
Args:
protos: A list of protos to be used as source files in protoc command
@ -264,10 +285,11 @@ def get_out_dir(protos, context):
return struct(path = out_dir, import_path = None)
def is_in_virtual_imports(source_file, virtual_folder = _VIRTUAL_IMPORTS):
"""Determines if source_file is virtual (is placed in _virtual_imports
subdirectory). The output of all proto_library targets which use
import_prefix and/or strip_import_prefix arguments is placed under
_virtual_imports directory.
"""Determines if source_file is virtual.
A file is virtual if placed in the _virtual_imports subdirectory. The
output of all proto_library targets which use import_prefix and/or
strip_import_prefix arguments is placed under _virtual_imports directory.
Args:
source_file: A proto file.

@ -195,7 +195,7 @@ def _generate_pb2_grpc_src_impl(context):
"--proto_path={}".format(get_include_directory(i))
for i in includes
]
arguments += ["--proto_path={}".format(context.genfiles_dir.path)]
arguments.append("--proto_path={}".format(context.genfiles_dir.path))
arguments += get_proto_arguments(protos, context.genfiles_dir.path)
context.actions.run(

@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
load("@com_github_grpc_grpc//bazel:objc_grpc_library.bzl", "objc_grpc_library")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
objc_grpc_library(
name = "HelloWorld_grpc_proto",
srcs = ["//examples/protos:helloworld.proto"],
@ -98,8 +98,7 @@ objc_library(
data = glob([
"route_guide/Misc/Base.lproj/**",
"route_guide/Misc/Images.xcassets/**",
"route_guide/route_guide_db.json",
]),
]) + ["route_guide/route_guide_db.json"],
includes = ["route_guide/Misc"],
tags = ["manual"],
deps = [":RouteGuide"],

@ -12,16 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("//bazel:grpc_build_system.bzl", "grpc_proto_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
grpc_proto_library(
name = "auth_sample",
srcs = ["auth_sample.proto"],

@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")

@ -14,8 +14,6 @@
licenses(["notice"])
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
py_binary(
name = "alts_server",
srcs = [

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_testonly = 1)
py_binary(

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_testonly = 1)
py_binary(

@ -23,7 +23,7 @@ This file declares two macros:
def _lower_underscore_to_upper_camel(str):
humps = []
for hump in str.split("_"):
humps += [hump[0].upper() + hump[1:]]
humps.append(hump[0].upper() + hump[1:])
return "".join(humps)
def _file_to_upper_camel(src):
@ -37,8 +37,9 @@ def _file_with_extension(src, ext):
return "".join(elements[:-1] + [basename, ext])
def _protoc_invocation(srcs, flags):
"""Returns a command line to invoke protoc from a genrule, on the given
sources, using the given flags.
"""Returns a CLI command to invoke protoc.
Uses the given sources and flags. Suitable for use in a genrule.
"""
protoc_command = "$(location //external:protoc) -I . "
srcs_params = ""
@ -47,15 +48,22 @@ def _protoc_invocation(srcs, flags):
return protoc_command + flags + srcs_params
def objc_proto_library(name, srcs, visibility = None):
"""Declares an objc_library for the code generated by protoc from the given
proto sources. This generated code doesn't include proto services.
"""Declares an objc_library for the code generated by protoc.
Uses the given proto sources. This generated code doesn't include proto
services.
Args:
name: The name of the library.
srcs: A list of .proto file sources.
visibility: The visibility label to apply to the target.
"""
h_files = []
m_files = []
for src in srcs:
src = _file_to_upper_camel(src)
h_files += [_file_with_extension(src, ".pbobjc.h")]
m_files += [_file_with_extension(src, ".pbobjc.m")]
h_files.append(_file_with_extension(src, ".pbobjc.h"))
m_files.append(_file_with_extension(src, ".pbobjc.m"))
protoc_flags = "--objc_out=$(GENDIR)"
@ -75,9 +83,15 @@ def objc_proto_library(name, srcs, visibility = None):
)
def objc_grpc_library(name, services, other_messages, visibility = None):
"""Declares an objc_library for the code generated by gRPC and protoc from the
given proto sources (services and other_messages). The generated code doesn't
include proto services of the files passed as other_messages.
"""Declares an objc_library for the code generated by the gRPC ObjC plugin.
The generated code does not include the services of the files in other_messages.
Args:
name: The name of the library.
services: The .proto files from which to generate the library.
other_messages: A list of .proto files containing messages needed for the library.
visibility: The visibility label to apply to the library.
"""
objc_proto_library(name + "_messages", services + other_messages)
@ -85,8 +99,8 @@ def objc_grpc_library(name, services, other_messages, visibility = None):
m_files = []
for src in services:
src = _file_to_upper_camel(src)
h_files += [_file_with_extension(src, ".pbrpc.h")]
m_files += [_file_with_extension(src, ".pbrpc.m")]
h_files.append(_file_with_extension(src, ".pbrpc.h"))
m_files.append(_file_with_extension(src, ".pbrpc.m"))
protoc_flags = ("--grpc_out=$(GENDIR) --plugin=" +
"protoc-gen-grpc=$(location //external:grpc_protoc_plugin_objc)")

@ -14,9 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
exports_files(["LICENSE"])
load(
"//bazel:grpc_build_system.bzl",
"grpc_cc_library",
"grpc_proto_plugin",
)
package(
default_visibility = ["//visibility:public"],
@ -26,11 +28,9 @@ package(
],
)
load(
"//bazel:grpc_build_system.bzl",
"grpc_cc_library",
"grpc_proto_plugin",
)
licenses(["notice"])
exports_files(["LICENSE"])
grpc_cc_library(
name = "grpc_plugin_support",

@ -14,10 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
load(
"//src/objective-c:grpc_objc_internal_library.bzl",
"grpc_objc_examples_library",
@ -28,6 +24,10 @@ load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application")
load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application", "watchos_extension")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
proto_library_objc_wrapper(
name = "messages_proto",
srcs = ["RemoteTestClient/messages.proto"],

@ -12,16 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This is for the gRPC build system. This isn't intended to be used outsite of
# the BUILD file for gRPC. It contains the mapping for the template system we
# use to generate other platform's build system files.
#
# Please consider that there should be a high bar for additions and changes to
# this file.
# Each rule listed must be re-written for Google's internal build system, and
# each change must be ported from one to the other.
#
"""
This is for the gRPC build system. This isn't intended to be used outsite of
the BUILD file for gRPC. It contains the mapping for the template system we
use to generate other platform's build system files.
Please consider that there should be a high bar for additions and changes to
this file.
Each rule listed must be re-written for Google's internal build system, and
each change must be ported from one to the other.
"""
load("@rules_proto//proto:defs.bzl", "proto_library")
load(
@ -37,8 +37,13 @@ def proto_library_objc_wrapper(
srcs,
deps = [],
use_well_known_protos = False):
"""proto_library for adding dependencies to google/protobuf protos
use_well_known_protos - ignored in open source version
"""proto_library for adding dependencies to google/protobuf protos.
Args:
name: The name of the target.
srcs: The sources to include.
deps: The dependencies of the target.
use_well_known_protos: ignored in open source version.
"""
proto_library(
name = name,
@ -109,7 +114,7 @@ def grpc_objc_testing_library(
]
if not name == "TestConfigs":
additional_deps += [":TestConfigs"]
additional_deps.append(":TestConfigs")
native.objc_library(
name = name,
@ -123,7 +128,17 @@ def grpc_objc_testing_library(
)
def local_objc_grpc_library(name, deps, testing = True, srcs = [], use_well_known_protos = False, **kwargs):
"""!!For local targets within the gRPC repository only!! Will not work outside of the repo
"""objc_library for use within the repo.
For local targets within the gRPC repository only. Will not work outside of the repo.
Args:
name: The name of the library.
deps: The library dependencies.
testing: Whether or not to include testing dependencies.
srcs: The source files for the rule.
use_well_known_protos: Whether or not to include well known protos.
**kwargs: Other arguments to apply to the library.
"""
objc_grpc_library_name = "_" + name + "_objc_grpc_library"
@ -155,9 +170,9 @@ def local_objc_grpc_library(name, deps, testing = True, srcs = [], use_well_know
library_deps = ["@com_google_protobuf//:protobuf_objc"]
if testing:
library_deps += ["//src/objective-c:grpc_objc_client_internal_testing"]
library_deps.append("//src/objective-c:grpc_objc_client_internal_testing")
else:
library_deps += ["//src/objective-c:proto_objc_rpc"]
library_deps.append("//src/objective-c:proto_objc_rpc")
native.objc_library(
name = name,

@ -14,10 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
load(
"//src/objective-c:grpc_objc_internal_library.bzl",
"grpc_objc_testing_library",
@ -29,6 +25,10 @@ load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application", "ios_unit_tes
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_unit_test")
load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application", "tvos_unit_test")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
exports_files(["LICENSE"])
proto_library_objc_wrapper(

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "channelz",
visibility = "public",

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
load("//bazel:python_rules.bzl", "py_proto_library")
licenses(["notice"])
grpc_package(
name = "core",
visibility = "public",

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("@rules_proto//proto:defs.bzl", "proto_library")
licenses(["notice"])
proto_library(
name = "alts_handshaker_proto",
srcs = [

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "health",
visibility = "public",

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "lb",
visibility = "public",

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "src/proto/grpc/lookup/v1",
visibility = "public",

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "reflection",
visibility = "public",

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "status",
visibility = "public",

@ -12,13 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
licenses(["notice"])
grpc_package(
name = "testing",
visibility = "public",

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "duplicate",
visibility = "public",

@ -12,12 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("//bazel:python_rules.bzl", "py_proto_library")
package(default_visibility = ["//visibility:public"])
load("//bazel:python_rules.bzl", "py_proto_library")
proto_library(
name = "empty2_proto_descriptor",
srcs = ["empty2.proto"],

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "xds",
visibility = "public",

@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_package", "grpc_proto_library")
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
licenses(["notice"])
grpc_package(
name = "xds_v3",
visibility = "public",

@ -1,3 +1,5 @@
load("//bazel:cython_library.bzl", "pyx_library")
# Copyright 2021 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -13,8 +15,6 @@
# limitations under the License.
package(default_visibility = ["//visibility:public"])
load("//bazel:cython_library.bzl", "pyx_library")
genrule(
name = "copy_roots_pem",
srcs = ["//:etc/roots.pem"],
@ -26,10 +26,11 @@ pyx_library(
name = "cygrpc",
srcs = glob([
"**/*.pxi",
"**/__init__.py",
]) + [
"cygrpc.pxd",
"cygrpc.pyx",
"**/__init__.py",
]),
],
data = [":copy_roots_pem"],
deps = [
"//:grpc",

@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_visibility = ["//visibility:public"])
py_library(

@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:python_rules.bzl", "py_grpc_library", "py_proto_library")
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
package(default_visibility = ["//visibility:public"])

@ -1,4 +1,4 @@
# Copyright 2021 The gRPC Authors
# Copyright 2021 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
load("@grpc_python_dependencies//:requirements.bzl", "requirement")
load("//bazel:python_rules.bzl", "py2and3_test")
package(default_visibility = ["//visibility:public"])

@ -1,3 +1,5 @@
load("//bazel:python_rules.bzl", "py2and3_test")
# Copyright 2021 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
@ -13,8 +15,6 @@
# limitations under the License.
package(default_visibility = ["//visibility:public"])
load("//bazel:python_rules.bzl", "py2and3_test")
py_library(
name = "stream_testing",
srcs = ["stream_testing.py"],

@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("@bazel_skylib//rules:build_test.bzl", "build_test")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
load("@bazel_skylib//rules:build_test.bzl", "build_test")
# build test //test/build_test:objective_c_examples_test
build_test(
name = "objective_c_examples_test",

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
licenses(["notice"])

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test")
licenses(["notice"])

@ -12,12 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_package")
load(":generate_tests.bzl", "grpc_bad_client_tests")
grpc_package(name = "test/core/bad_client")
licenses(["notice"])
load(":generate_tests.bzl", "grpc_bad_client_tests")
grpc_bad_client_tests()

@ -37,6 +37,7 @@ BAD_CLIENT_TESTS = {
"unknown_frame": test_options(),
}
# buildifier: disable=unnamed-macro
def grpc_bad_client_tests():
grpc_cc_library(
name = "bad_client_test",

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_package")
licenses(["notice"])

@ -12,12 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_package")
load(":generate_tests.bzl", "grpc_bad_ssl_tests")
grpc_package(name = "test/core/bad_ssl")
licenses(["notice"])
load(":generate_tests.bzl", "grpc_bad_ssl_tests")
grpc_bad_ssl_tests()

@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Houses grpc_bad_ssl_tests.
"""
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test")
def test_options():
@ -21,7 +25,10 @@ def test_options():
# maps test names to options
BAD_SSL_TESTS = ["cert", "alpn"]
# buildifier: disable=unnamed-macro
def grpc_bad_ssl_tests():
"""Instantiates gRPC bad SSL tests."""
grpc_cc_library(
name = "bad_ssl_test_server",
srcs = ["server_common.cc"],

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
grpc_package(name = "test/core/channel")

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
grpc_package(name = "test/core/client_channel/resolvers")

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_package(name = "test/core/compression")

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
grpc_package(name = "test/core/debug")

@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load(":generate_tests.bzl", "grpc_end2end_nosec_tests", "grpc_end2end_tests")
licenses(["notice"])
grpc_package(name = "test/core/end2end")
load(":generate_tests.bzl", "grpc_end2end_nosec_tests", "grpc_end2end_tests")
grpc_cc_library(
name = "cq_verifier",
srcs = ["cq_verifier.cc"],

@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer", "grpc_proto_fuzzer")
grpc_package(name = "test/core/end2end/fuzzers")
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer", "grpc_proto_fuzzer")
grpc_proto_fuzzer(
name = "api_fuzzer",
size = "enormous",

@ -394,14 +394,16 @@ def _compatible(fopt, topt):
def _platform_support_tags(fopt):
result = []
if not "windows" in fopt._platforms:
result += ["no_windows"]
result.append("no_windows")
if not "mac" in fopt._platforms:
result += ["no_mac"]
result.append("no_mac")
if not "linux" in fopt._platforms:
result += ["no_linux"]
result.append("no_linux")
return result
# buildifier: disable=unnamed-macro
def grpc_end2end_tests():
"""Instantiates the gRPC end2end tests."""
grpc_cc_library(
name = "end2end_tests",
srcs = ["end2end_tests.cc", "end2end_test_utils.cc"] + [
@ -479,7 +481,9 @@ def grpc_end2end_tests():
flaky = t in fopt.flaky_tests,
)
# buildifier: disable=unnamed-macro
def grpc_end2end_nosec_tests():
"""Instantiates the gRPC end2end no security tests"""
grpc_cc_library(
name = "end2end_nosec_tests",
srcs = ["end2end_nosec_tests.cc", "end2end_test_utils.cc"] + [

@ -12,14 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_test", "grpc_package")
grpc_package(name = "test/core/fling")
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_cc_binary(
name = "fling_client",
testonly = 1,

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
licenses(["notice"])

@ -12,15 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//bazel:custom_exec_properties.bzl", "LARGE_MACHINE")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
licenses(["notice"])
grpc_package(name = "test/core/gprpp")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
grpc_cc_test(
name = "examine_stack_test",
srcs = ["examine_stack_test.cc"],

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
grpc_package(name = "test/core/handshake")

@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_package(name = "test/core/http")
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "response_fuzzer",
srcs = ["response_fuzzer.cc"],
@ -62,8 +61,6 @@ grpc_fuzzer(
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_cc_test(
name = "httpcli_test",
srcs = ["httpcli_test.cc"],

@ -12,13 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:custom_exec_properties.bzl", "LARGE_MACHINE")
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_package(
name = "test/core/iomgr",
visibility = "public",

@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_package(name = "test/core/json")
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "json_fuzzer",
srcs = ["fuzzer.cc"],

@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_package(name = "test/core/nanopb")
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "fuzzer_response",
srcs = ["fuzzer_response.cc"],

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_package")
grpc_package(
name = "test/core/network_benchmarks",

@ -13,13 +13,12 @@
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
licenses(["notice"])
grpc_package(name = "test/core/promise")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
grpc_cc_library(
name = "test_wakeup_schedulers",
testonly = True,

@ -12,13 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_benchmark_args")
grpc_package(name = "test/core/promise/benchmark")
licenses(["notice"])
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_benchmark_args")
grpc_package(name = "test/core/promise/benchmark")
grpc_cc_test(
name = "competition",

@ -13,13 +13,12 @@
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
licenses(["notice"])
grpc_package(name = "test/core/resource_quota")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
grpc_cc_library(
name = "call_checker",
testonly = True,

@ -13,13 +13,12 @@
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
licenses(["notice"])
grpc_package(name = "test/core/security")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "alts_credentials_fuzzer",
srcs = ["alts_credentials_fuzzer.cc"],

@ -12,14 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_package(name = "test/core/slice")
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "b64_encode_fuzzer",
srcs = ["b64_encode_fuzzer.cc"],

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
licenses(["notice"])

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
licenses(["notice"])

@ -12,15 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
load("//bazel:custom_exec_properties.bzl", "LARGE_MACHINE")
licenses(["notice"])
grpc_package(name = "test/core/transport/chttp2")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_proto_fuzzer")
load("//bazel:custom_exec_properties.bzl", "LARGE_MACHINE")
grpc_proto_fuzzer(
name = "hpack_parser_fuzzer",
srcs = ["hpack_parser_fuzzer_test.cc"],
@ -164,7 +163,7 @@ grpc_cc_test(
)
grpc_cc_test(
"too_many_pings_test",
name = "too_many_pings_test",
timeout = "long", # Required for internal test infrastructure (cl/325757166)
srcs = ["too_many_pings_test.cc"],
external_deps = ["gtest"],

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_package", "grpc_proto_library")
licenses(["notice"])
grpc_package(
name = "test/core/tsi/alts/fake_handshaker",
visibility = "public",

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
licenses(["notice"])

@ -13,13 +13,12 @@
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_package(name = "test/core/uri")
licenses(["notice"])
load("//test/core/util:grpc_fuzzer.bzl", "grpc_fuzzer")
grpc_fuzzer(
name = "uri_fuzzer_test",
srcs = ["uri_fuzzer_test.cc"],

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])

@ -12,11 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Includes fuzzer rules.
"""
load("//bazel:grpc_build_system.bzl", "grpc_cc_test")
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_cc//cc:defs.bzl", "cc_proto_library")
def grpc_fuzzer(name, corpus, srcs = [], deps = [], data = [], size = "large", **kwargs):
"""Instantiates a fuzzer test.
Args:
name: The name of the test.
corpus: The corpus for the test.
srcs: The source files for the test.
deps: The dependencies of the test.
data: The data dependencies of the test.
size: The size of the test.
**kwargs: Other arguments to supply to the test.
"""
CORPUS_DIR = native.package_name() + "/" + corpus
grpc_cc_test(
name = name,
@ -38,6 +53,18 @@ def grpc_fuzzer(name, corpus, srcs = [], deps = [], data = [], size = "large", *
)
def grpc_proto_fuzzer(name, corpus, proto, srcs = [], deps = [], data = [], size = "large", **kwargs):
"""Instantiates a protobuf mutator fuzzer test.
Args:
name: The name of the test.
corpus: The corpus for the test.
proto: The proto for the test.
srcs: The source files for the test.
deps: The dependencies of the test.
data: The data dependencies of the test.
size: The size of the test.
**kwargs: Other arguments to supply to the test.
"""
PROTO_LIBRARY = "_%s_proto" % name
CC_PROTO_LIBRARY = "_%s_cc_proto" % name
CORPUS_DIR = native.package_name() + "/" + corpus

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(name = "test/cpp/client")

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_test", "grpc_package", "grpc_sh_test")
licenses(["notice"])
grpc_package(name = "test/cpp/codegen")
grpc_cc_test(

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(name = "test/cpp/common")
grpc_cc_test(

@ -12,8 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
licenses(["notice"])

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(
name = "test/cpp/grpclb",

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(
name = "test/cpp/interop",
visibility = "public",

@ -12,13 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_benchmark_args")
grpc_package(name = "test/cpp/microbenchmarks")
licenses(["notice"])
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_benchmark_args")
grpc_package(name = "test/cpp/microbenchmarks")
grpc_cc_test(
name = "noop-benchmark",

@ -12,6 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_py_binary")
load(":generate_resolver_component_tests.bzl", "generate_resolver_component_tests")
package(
default_visibility = ["//visibility:public"],
features = [
@ -22,9 +25,6 @@ package(
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_py_binary")
load(":generate_resolver_component_tests.bzl", "generate_resolver_component_tests")
# Meant to be invoked only through the top-level shell script driver.
grpc_py_binary(
name = "resolver_component_tests_runner",

@ -13,8 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Houses generate_resolver_component_tests.
"""
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_test")
# buildifier: disable=unnamed-macro
def generate_resolver_component_tests():
for unsecure_build_config_suffix in ["_unsecure", ""]:
grpc_cc_test(

@ -12,6 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
load("//bazel:grpc_build_system.bzl", "grpc_py_binary")
package(
default_visibility = ["//visibility:public"],
features = [
@ -22,8 +24,6 @@ package(
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_py_binary")
grpc_py_binary(
name = "dns_server",
testonly = True,

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(name = "test/cpp/performance")

@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/cpp/qps:qps_benchmark_script.bzl", "json_run_localhost_batch", "qps_json_driver_batch")
load("//bazel:custom_exec_properties.bzl", "LARGE_MACHINE")
licenses(["notice"])
grpc_package(name = "test/cpp/qps")
grpc_cc_library(

@ -38,6 +38,7 @@ def add_suffix(name):
else:
return name
# buildifier: disable=unnamed-macro
def qps_json_driver_batch():
for scenario in QPS_JSON_DRIVER_SCENARIOS:
grpc_cc_test(
@ -63,6 +64,7 @@ def qps_json_driver_batch():
flaky = True,
)
# buildifier: disable=unnamed-macro
def json_run_localhost_batch():
for scenario in JSON_RUN_LOCALHOST_SCENARIOS:
grpc_cc_test(

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(name = "test/cpp/server")

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(name = "test/cpp/server/load_reporter")

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(
name = "test/cpp/test",

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(
name = "test/cpp/thread_manager",

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"])
load("//bazel:grpc_build_system.bzl", "grpc_cc_binary", "grpc_cc_library", "grpc_cc_test", "grpc_package")
licenses(["notice"])
grpc_package(
name = "test/cpp/util",
visibility = "public",

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save