Rework well_known_protos attr, and some other fixes

pull/11160/head
Craig Tiller 8 years ago
parent a3eac51e1e
commit a753371f05
  1. 5
      bazel/cc_grpc_library.bzl
  2. 8
      bazel/generate_cc.bzl
  3. 2
      bazel/grpc_build_system.bzl
  4. 2
      examples/BUILD
  5. 2
      src/proto/grpc/status/BUILD
  6. 18
      test/cpp/interop/BUILD
  7. 14
      test/cpp/util/BUILD
  8. 4
      tools/grpcz/BUILD

@ -12,9 +12,8 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo
srcs: a single proto_library, which wraps the .proto files with services.
deps: a list of C++ proto_library (or cc_proto_library) which provides
the compiled code of any message that the services depend on.
well_known_protos: The target from protobuf library that exports well
known protos. Currently it will only work if the value is
"@com_google_protobuf//:well_known_protos"
well_known_protos: Should this library additionally depend on well known
protos
use_external: When True the grpc deps are prefixed with //external. This
allows grpc to be used as a dependency in other bazel projects.
generate_mock: When true GMOCk code for client stub is generated.

@ -57,7 +57,7 @@ def generate_cc_impl(ctx):
return struct(files=set(out_files))
generate_cc = rule(
_generate_cc = rule(
attrs = {
"srcs": attr.label_list(
mandatory = True,
@ -90,3 +90,9 @@ generate_cc = rule(
output_to_genfiles = True,
implementation = generate_cc_impl,
)
def generate_cc(well_known_protos, **kwargs):
if well_known_protos:
_generate_cc(well_known_protos="@com_google_protobuf//:well_known_protos", **kwargs)
else:
_generate_cc(**kwargs)

@ -67,7 +67,7 @@ def grpc_proto_plugin(name, srcs = [], deps = []):
load("//:bazel/cc_grpc_library.bzl", "cc_grpc_library")
def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = None,
def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = False,
has_services = True, use_external = False, generate_mock = False):
cc_grpc_library(
name = name,

@ -27,6 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
licenses(["notice"]) # 3-clause BSD
package(default_visibility = ["//visibility:public"])
load("//bazel:grpc_build_system.bzl", "grpc_proto_library")

@ -37,5 +37,5 @@ grpc_proto_library(
name = "status_proto",
srcs = ["status.proto"],
has_services = False,
well_known_protos = "@com_google_protobuf//:well_known_protos",
well_known_protos = True,
)

@ -29,8 +29,11 @@
licenses(["notice"]) # 3-clause BSD
cc_library(
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_cc_binary")
grpc_cc_library(
name = "server_helper_lib",
language = "c++",
srcs = [
"server_helper.cc",
],
@ -39,12 +42,15 @@ cc_library(
],
deps = [
"//test/cpp/util:test_util",
"//external:gflags",
],
external_deps = [
"gflags",
],
)
cc_binary(
grpc_cc_binary(
name = "interop_server",
language = "c++",
srcs = [
"interop_server.cc",
"interop_server_bootstrap.cc",
@ -59,8 +65,9 @@ cc_binary(
],
)
cc_library(
grpc_cc_library(
name = "client_helper_lib",
language = "c++",
srcs = [
"client_helper.cc",
"interop_client.cc",
@ -79,8 +86,9 @@ cc_library(
],
)
cc_binary(
grpc_cc_binary(
name = "interop_client",
language = "c++",
srcs = [
"client.cc",
],

@ -29,7 +29,7 @@
licenses(["notice"]) # 3-clause BSD
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary")
load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_binary", "grpc_cc_test")
package(default_visibility = ["//visibility:public"])
@ -141,19 +141,21 @@ grpc_cc_library(
],
)
cc_test(
grpc_cc_test(
name = "error_details_test",
srcs = [
"error_details_test.cc",
],
deps = [
"//:grpc++_error_details",
"//external:gtest",
"//src/proto/grpc/testing:echo_messages_proto",
],
external_deps = [
"gtest",
],
)
cc_binary(
grpc_cc_binary(
name = "grpc_cli",
srcs = [
"cli_call.cc",
@ -175,7 +177,9 @@ cc_binary(
],
deps = [
"//:grpc++",
"//external:gflags",
"//src/proto/grpc/reflection/v1alpha:reflection_proto",
],
external_deps = [
"gflags",
],
)

@ -38,7 +38,7 @@ grpc_proto_library(
srcs = [
"monitoring.proto",
],
well_known_protos = "@com_google_protobuf//:well_known_protos",
well_known_protos = True,
deps = [
":census_proto",
],
@ -49,7 +49,7 @@ grpc_proto_library(
srcs = [
"census.proto",
],
well_known_protos = "@com_google_protobuf//:well_known_protos",
well_known_protos = True,
)
cc_binary(

Loading…
Cancel
Save