From 443a75dd2282ff442fcd217f1b254ebe8a0f4355 Mon Sep 17 00:00:00 2001 From: Mahak Mukhi Date: Fri, 14 Apr 2017 15:33:55 -0700 Subject: 1. Added golden file test. 2. Added support for mock. 3. Sanity fix. --- bazel/cc_grpc_library.bzl | 4 +++- bazel/generate_cc.bzl | 9 ++++++++- bazel/grpc_build_system.bzl | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) (limited to 'bazel') diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index ab1add476e..03a092192f 100644 --- a/bazel/cc_grpc_library.bzl +++ b/bazel/cc_grpc_library.bzl @@ -2,7 +2,7 @@ load("//:bazel/generate_cc.bzl", "generate_cc") -def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, use_external = False, **kwargs): +def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mock, use_external = False, **kwargs): """Generates C++ grpc classes from a .proto file. Assumes the generated classes will be used in cc_api_version = 2. @@ -17,6 +17,7 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, use_externa "@submodule_protobuf//: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. **kwargs: rest of arguments, e.g., compatible_with and visibility. """ if len(srcs) > 1: @@ -54,6 +55,7 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, use_externa srcs = [proto_target], plugin = plugin, well_known_protos = well_known_protos, + generate_mock = generate_mock, **kwargs ) diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl index f3961f0a41..7dd2c0486b 100644 --- a/bazel/generate_cc.bzl +++ b/bazel/generate_cc.bzl @@ -23,7 +23,10 @@ def generate_cc_impl(ctx): arguments = [] if ctx.executable.plugin: arguments += ["--plugin=protoc-gen-PLUGIN=" + ctx.executable.plugin.path] - arguments += ["--PLUGIN_out=" + ",".join(ctx.attr.flags) + ":" + dir_out] + arguments += ["--PLUGIN_out=" + ",".join(ctx.attr.flags)] + if ctx.attr.generate_mock: + arguments += [",generate_mock_code=true"] + arguments += [":" + dir_out] additional_input = [ctx.executable.plugin] else: arguments += ["--cpp_out=" + ",".join(ctx.attr.flags) + ":" + dir_out] @@ -71,6 +74,10 @@ generate_cc = rule( "well_known_protos" : attr.label( mandatory = False, ), + "generate_mock" : attr.bool( + default = False, + mandatory = False, + ), "_protoc": attr.label( default = Label("//external:protocol_compiler"), executable = True, diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 8b524bd0e5..b49ad3aa59 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -59,7 +59,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, - has_services = True, use_external = False): + has_services = True, use_external = False, generate_mock = False): cc_grpc_library( name = name, srcs = srcs, @@ -67,5 +67,6 @@ def grpc_proto_library(name, srcs = [], deps = [], well_known_protos = None, well_known_protos = well_known_protos, proto_only = not has_services, use_external = use_external, + generate_mock = generate_mock, ) -- cgit v1.2.3 From a68829023c4d20767938a9e2156bab1fe83b082a Mon Sep 17 00:00:00 2001 From: Mahak Mukhi Date: Fri, 14 Apr 2017 17:37:46 -0700 Subject: more sanity trying to fix some sanity nope that didn't work fixing test failiures added debug code more trail and error more trial and error cleaning debug code --- CMakeLists.txt | 1 + bazel/generate_cc.bzl | 6 +++--- build.yaml | 6 ++++-- test/cpp/codegen/golden_file_test.cc | 4 +++- tools/run_tests/generated/sources_and_headers.json | 3 +++ tools/run_tests/generated/tests.json | 2 +- vsprojects/vcxproj/test/golden_file_test/golden_file_test.vcxproj | 2 ++ 7 files changed, 17 insertions(+), 7 deletions(-) (limited to 'bazel') diff --git a/CMakeLists.txt b/CMakeLists.txt index d3db20d420..4c23d28b90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10082,6 +10082,7 @@ add_executable(golden_file_test ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/compiler_test.grpc.pb.cc ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/compiler_test.pb.h ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/compiler_test.grpc.pb.h + ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/compiler_test_mock.grpc.pb.h test/cpp/codegen/golden_file_test.cc third_party/googletest/googletest/src/gtest-all.cc ) diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl index 7dd2c0486b..dac76f67f1 100644 --- a/bazel/generate_cc.bzl +++ b/bazel/generate_cc.bzl @@ -23,10 +23,10 @@ def generate_cc_impl(ctx): arguments = [] if ctx.executable.plugin: arguments += ["--plugin=protoc-gen-PLUGIN=" + ctx.executable.plugin.path] - arguments += ["--PLUGIN_out=" + ",".join(ctx.attr.flags)] + gen_mock = "" if ctx.attr.generate_mock: - arguments += [",generate_mock_code=true"] - arguments += [":" + dir_out] + gen_mock = ",generate_mock_code=true" + arguments += ["--PLUGIN_out=" + gen_mock + ",".join(ctx.attr.flags) + ":" + dir_out] additional_input = [ctx.executable.plugin] else: arguments += ["--cpp_out=" + ",".join(ctx.attr.flags) + ":" + dir_out] diff --git a/build.yaml b/build.yaml index 8fd1b7bad4..52ff98c64b 100644 --- a/build.yaml +++ b/build.yaml @@ -948,8 +948,8 @@ filegroups: - name: grpc++_test language: c++ public_headers: - - include/grpc++/test/server_context_test_spouse.h - include/grpc++/test/mock_stream.h + - include/grpc++/test/server_context_test_spouse.h deps: - grpc++ - name: thrift_util @@ -3630,7 +3630,7 @@ targets: - grpc - gpr args: - - --generated_file_path=gens/src/proto/grpc/testing + - --generated_file_path=gens/src/proto/grpc/testing/ - name: grpc_cli build: test run: false @@ -3891,6 +3891,8 @@ targets: gtest: true build: test language: c++ + headers: + - include/grpc++/test/mock_stream.h src: - test/cpp/end2end/mock_test.cc deps: diff --git a/test/cpp/codegen/golden_file_test.cc b/test/cpp/codegen/golden_file_test.cc index dd09471fdb..7789ac738b 100644 --- a/test/cpp/codegen/golden_file_test.cc +++ b/test/cpp/codegen/golden_file_test.cc @@ -76,7 +76,9 @@ TEST(GoldenMockFileTest, TestGeneratedMockFile) { int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); ::google::ParseCommandLineFlags(&argc, &argv, true); - if (FLAGS_generated_file_path.empty()) return 1; + if (FLAGS_generated_file_path.empty()) { + FLAGS_generated_file_path = "gens/src/proto/grpc/testing/"; + } if (FLAGS_generated_file_path.back() != '/') FLAGS_generated_file_path.append("/"); return RUN_ALL_TESTS(); diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index c019996174..fa28af7f7b 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -3031,6 +3031,7 @@ ], "headers": [ "src/proto/grpc/testing/compiler_test.grpc.pb.h", + "src/proto/grpc/testing/compiler_test_mock.grpc.pb.h", "src/proto/grpc/testing/compiler_test.pb.h" ], "is_filegroup": false, @@ -8933,12 +8934,14 @@ "grpc++" ], "headers": [ + "include/grpc++/test/mock_stream.h", "include/grpc++/test/server_context_test_spouse.h" ], "is_filegroup": true, "language": "c++", "name": "grpc++_test", "src": [ + "include/grpc++/test/mock_stream.h", "include/grpc++/test/server_context_test_spouse.h" ], "third_party": false, diff --git a/tools/run_tests/generated/tests.json b/tools/run_tests/generated/tests.json index a08caf30d3..408b38f844 100644 --- a/tools/run_tests/generated/tests.json +++ b/tools/run_tests/generated/tests.json @@ -3263,7 +3263,7 @@ }, { "args": [ - "--generated_file_path=gens/src/proto/grpc/testing/compiler_test.grpc.pb.h" + "--generated_file_path=gens/src/proto/grpc/testing/" ], "ci_platforms": [ "linux", diff --git a/vsprojects/vcxproj/test/golden_file_test/golden_file_test.vcxproj b/vsprojects/vcxproj/test/golden_file_test/golden_file_test.vcxproj index e9802773d8..7deebd1728 100644 --- a/vsprojects/vcxproj/test/golden_file_test/golden_file_test.vcxproj +++ b/vsprojects/vcxproj/test/golden_file_test/golden_file_test.vcxproj @@ -168,6 +168,8 @@ + + -- cgit v1.2.3 From 459da91519078f0ab46206febcc22d5d223c3781 Mon Sep 17 00:00:00 2001 From: Mahak Mukhi Date: Sun, 16 Apr 2017 20:44:04 -0700 Subject: fixing bug --- bazel/generate_cc.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bazel') diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl index dac76f67f1..72fc6093f8 100644 --- a/bazel/generate_cc.bzl +++ b/bazel/generate_cc.bzl @@ -23,10 +23,10 @@ def generate_cc_impl(ctx): arguments = [] if ctx.executable.plugin: arguments += ["--plugin=protoc-gen-PLUGIN=" + ctx.executable.plugin.path] - gen_mock = "" + flags = list(ctx.attr.flags) if ctx.attr.generate_mock: - gen_mock = ",generate_mock_code=true" - arguments += ["--PLUGIN_out=" + gen_mock + ",".join(ctx.attr.flags) + ":" + dir_out] + flags.append("generate_mock_code=true") + arguments += ["--PLUGIN_out=" + ",".join(flags) + ":" + dir_out] additional_input = [ctx.executable.plugin] else: arguments += ["--cpp_out=" + ",".join(ctx.attr.flags) + ":" + dir_out] -- cgit v1.2.3 From 78f12e5c760486f4297e1b6ddbac772d6e942eac Mon Sep 17 00:00:00 2001 From: Mahak Mukhi Date: Sun, 16 Apr 2017 21:24:16 -0700 Subject: Add _mock files to output list of generate_cc.bzl --- bazel/generate_cc.bzl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'bazel') diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl index 72fc6093f8..d979b76228 100644 --- a/bazel/generate_cc.bzl +++ b/bazel/generate_cc.bzl @@ -12,6 +12,8 @@ def generate_cc_impl(ctx): if ctx.executable.plugin: outs += [proto.basename[:-len(".proto")] + ".grpc.pb.h" for proto in protos] outs += [proto.basename[:-len(".proto")] + ".grpc.pb.cc" for proto in protos] + if ctx.attr.generate_mock: + outs += [proto.basename[:-len(".proto")] + "_mock.grpc.pb.h" for proto in protos] else: outs += [proto.basename[:-len(".proto")] + ".pb.h" for proto in protos] outs += [proto.basename[:-len(".proto")] + ".pb.cc" for proto in protos] -- cgit v1.2.3 From c872a993e531d7a630459858e1798f18fabd42e0 Mon Sep 17 00:00:00 2001 From: Makarand Dharmapurikar Date: Mon, 17 Apr 2017 16:36:00 -0700 Subject: .proto and BUILD files can now in differnt dirs --- bazel/generate_cc.bzl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'bazel') diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl index f3961f0a41..f8fddeb0d5 100644 --- a/bazel/generate_cc.bzl +++ b/bazel/generate_cc.bzl @@ -9,16 +9,16 @@ def generate_cc_impl(ctx): protos = [f for src in ctx.attr.srcs for f in src.proto.direct_sources] includes = [f for src in ctx.attr.srcs for f in src.proto.transitive_imports] outs = [] + # label_len is length of the path from WORKSPACE root to the location of this build file + label_len = len(ctx.label.package) + 1 if ctx.executable.plugin: - outs += [proto.basename[:-len(".proto")] + ".grpc.pb.h" for proto in protos] - outs += [proto.basename[:-len(".proto")] + ".grpc.pb.cc" for proto in protos] + outs += [proto.path[label_len:-len(".proto")] + ".grpc.pb.h" for proto in protos] + outs += [proto.path[label_len:-len(".proto")] + ".grpc.pb.cc" for proto in protos] else: - outs += [proto.basename[:-len(".proto")] + ".pb.h" for proto in protos] - outs += [proto.basename[:-len(".proto")] + ".pb.cc" for proto in protos] + outs += [proto.path[label_len:-len(".proto")] + ".pb.h" for proto in protos] + outs += [proto.path[label_len:-len(".proto")] + ".pb.cc" for proto in protos] out_files = [ctx.new_file(out) for out in outs] - # The following should be replaced with ctx.configuration.buildout - # whenever this is added to Skylark. - dir_out = out_files[0].dirname[:-len(protos[0].dirname)] + dir_out = str(ctx.genfiles_dir.path) arguments = [] if ctx.executable.plugin: -- cgit v1.2.3 From f74eaa69575f2570d18dbc37acafb60670f06fe5 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 14 Apr 2017 17:19:52 -0700 Subject: Fix up protobuf submodule name to match bazel expectation --- bazel/BUILD | 4 ++-- bazel/cc_grpc_library.bzl | 2 +- bazel/generate_cc.bzl | 6 +++--- tools/grpcz/BUILD | 13 +++++++------ 4 files changed, 13 insertions(+), 12 deletions(-) (limited to 'bazel') diff --git a/bazel/BUILD b/bazel/BUILD index b86dcc2ad7..cb2d9d66ae 100644 --- a/bazel/BUILD +++ b/bazel/BUILD @@ -35,12 +35,12 @@ load(":cc_grpc_library.bzl", "cc_grpc_library") proto_library( name = "well_known_protos_list", - srcs = ["@submodule_protobuf//:well_known_protos"], + srcs = ["@com_google_protobuf//:well_known_protos"], ) cc_grpc_library( name = "well_known_protos", srcs = "well_known_protos_list", - deps = [], proto_only = True, + deps = [], ) diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index ab1add476e..a3996eca00 100644 --- a/bazel/cc_grpc_library.bzl +++ b/bazel/cc_grpc_library.bzl @@ -14,7 +14,7 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, use_externa 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 - "@submodule_protobuf//:well_known_protos" + "@com_google_protobuf//: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. **kwargs: rest of arguments, e.g., compatible_with and visibility. diff --git a/bazel/generate_cc.bzl b/bazel/generate_cc.bzl index f3961f0a41..35c2983b54 100644 --- a/bazel/generate_cc.bzl +++ b/bazel/generate_cc.bzl @@ -35,10 +35,10 @@ def generate_cc_impl(ctx): well_known_proto_files = [] if ctx.attr.well_known_protos: f = ctx.attr.well_known_protos.files.to_list()[0].dirname - if f != "external/submodule_protobuf/src/google/protobuf": - print("Error: Only @submodule_protobuf//:well_known_protos is supported") + if f != "external/com_google_protobuf/src/google/protobuf": + print("Error: Only @com_google_protobuf//:well_known_protos is supported") else: - # f points to "external/submodule_protobuf/src/google/protobuf" + # 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 + "/../..")] well_known_proto_files = [f for f in ctx.attr.well_known_protos.files] diff --git a/tools/grpcz/BUILD b/tools/grpcz/BUILD index cac7df2a9d..cc887a5375 100644 --- a/tools/grpcz/BUILD +++ b/tools/grpcz/BUILD @@ -33,30 +33,31 @@ package(default_visibility = ["//visibility:public"]) load("//:bazel/grpc_build_system.bzl", "grpc_proto_library") -grpc_proto_library ( +grpc_proto_library( name = "monitoring_proto", srcs = [ "monitoring.proto", ], + well_known_protos = "@com_google_protobuf//:well_known_protos", deps = [ ":census_proto", ], - well_known_protos = "@submodule_protobuf//:well_known_protos", ) -grpc_proto_library ( +grpc_proto_library( name = "census_proto", srcs = [ "census.proto", ], - well_known_protos = "@submodule_protobuf//:well_known_protos", + well_known_protos = "@com_google_protobuf//:well_known_protos", ) cc_binary( name = "grpcz_client", - srcs = ["grpcz_client.cc",], + srcs = ["grpcz_client.cc"], deps = [ - "//external:gflags", "monitoring_proto", + "//external:gflags", + "@mongoose_repo//:mongoose_lib", ], ) -- cgit v1.2.3 From 576e546019140a05cc88f896e7ff50d70704d719 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Thu, 20 Apr 2017 18:40:16 +0000 Subject: Changes required to make build possible: create separate grpc++_base{,_unsecure}, move grpc_compression_trace definition, and remove an assertion about library initialization from server --- BUILD | 23 +++++++++++----------- bazel/grpc_build_system.bzl | 13 ++++++++++++ .../message_compress/message_compress_filter.c | 2 -- src/core/lib/surface/call.c | 1 + src/core/lib/surface/server.c | 2 -- 5 files changed, 26 insertions(+), 15 deletions(-) (limited to 'bazel') diff --git a/BUILD b/BUILD index 57709e4745..09b17ad6eb 100644 --- a/BUILD +++ b/BUILD @@ -35,7 +35,8 @@ exports_files(["LICENSE"]) package(default_visibility = ["//visibility:public"]) -load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_proto_plugin") +load("//bazel:grpc_build_system.bzl", "grpc_cc_library", + "grpc_proto_plugin", "grpc_cc_libraries") # This should be updated along with build.yaml g_stands_for = "gentle" @@ -163,7 +164,7 @@ grpc_cc_library( standalone = True, deps = [ "gpr", - "grpc++_base", + "grpc++_base_unsecure", "grpc++_codegen_base", "grpc++_codegen_base_src", "grpc_unsecure", @@ -1231,8 +1232,12 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "grpc++_base", +grpc_cc_libraries( + name_list = ["grpc++_base", "grpc++_base_unsecure"], + additional_dep_list = [ + ["grpc", ], + ["grpc_unsecure", ], + ], srcs = [ "src/cpp/client/channel_cc.cc", "src/cpp/client/client_context.cc", @@ -1267,7 +1272,7 @@ grpc_cc_library( "src/cpp/util/status.cc", "src/cpp/util/string_ref.cc", "src/cpp/util/time_cc.cc", - ], + ], hdrs = [ "src/cpp/client/create_channel_internal.h", "src/cpp/common/channel_filter.h", @@ -1276,10 +1281,7 @@ grpc_cc_library( "src/cpp/server/health/health.pb.h", "src/cpp/server/thread_pool_interface.h", "src/cpp/thread_manager/thread_manager.h", - ], - external_deps = [ - "nanopb", - ], + ], language = "c++", public_hdrs = [ "include/grpc++/alarm.h", @@ -1329,9 +1331,8 @@ grpc_cc_library( "include/grpc++/support/stub_options.h", "include/grpc++/support/sync_stream.h", "include/grpc++/support/time.h", - ], + ], deps = [ - "grpc_base", "grpc++_codegen_base", ], ) diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 8b524bd0e5..984c06de48 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -49,6 +49,19 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps ] ) +def grpc_cc_libraries(name_list, additional_dep_list, srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language="C++"): + for i in range(len(name_list)): + grpc_cc_library( + name = name_list[i], + srcs = srcs, + hdrs = hdrs, + public_hdrs = public_hdrs, + deps = deps + additional_dep_list[i], + external_deps = external_deps, + standalone = standalone, + language = language + ) + def grpc_proto_plugin(name, srcs = [], deps = []): native.cc_binary( name = name, diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.c b/src/core/ext/filters/http/message_compress/message_compress_filter.c index f414a60eee..4f5f41e9b0 100644 --- a/src/core/ext/filters/http/message_compress/message_compress_filter.c +++ b/src/core/ext/filters/http/message_compress/message_compress_filter.c @@ -49,8 +49,6 @@ #include "src/core/lib/support/string.h" #include "src/core/lib/transport/static_metadata.h" -int grpc_compression_trace = 0; - #define INITIAL_METADATA_UNSEEN 0 #define HAS_COMPRESSION_ALGORITHM 2 #define NO_COMPRESSION_ALGORITHM 4 diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c index 9aa457d792..7525806583 100644 --- a/src/core/lib/surface/call.c +++ b/src/core/lib/surface/call.c @@ -245,6 +245,7 @@ struct grpc_call { }; int grpc_call_error_trace = 0; +int grpc_compression_trace = 0; #define CALL_STACK_FROM_CALL(call) ((grpc_call_stack *)((call) + 1)) #define CALL_FROM_CALL_STACK(call_stack) (((grpc_call *)(call_stack)) - 1) diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c index 26c81e9aca..e133d1d2a4 100644 --- a/src/core/lib/surface/server.c +++ b/src/core/lib/surface/server.c @@ -1033,8 +1033,6 @@ grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved) { grpc_server *server = gpr_zalloc(sizeof(grpc_server)); - GPR_ASSERT(grpc_is_initialized() && "call grpc_init()"); - gpr_mu_init(&server->mu_global); gpr_mu_init(&server->mu_call); gpr_cv_init(&server->starting_cv); -- cgit v1.2.3 From a8749903dd445e3e01a37a9c111b8887915f6124 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Fri, 21 Apr 2017 16:44:01 +0000 Subject: Avoid duplication in build rules by expanding the grpc_cc_libraries rule-creation macro --- BUILD | 55 +++++++++++++++++---------------------------- bazel/grpc_build_system.bzl | 11 +++++---- 2 files changed, 28 insertions(+), 38 deletions(-) (limited to 'bazel') diff --git a/BUILD b/BUILD index 09b17ad6eb..a919a6328a 100644 --- a/BUILD +++ b/BUILD @@ -54,33 +54,46 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "grpc", +grpc_cc_libraries( + name_list = ["grpc", "grpc_unsecure",], srcs = [ "src/core/lib/surface/init.c", - "src/core/plugin_registry/grpc_plugin_registry.c", + ], + additional_src_list = [ + [ + "src/core/plugin_registry/grpc_plugin_registry.c", + ], + [ + "src/core/lib/surface/init_unsecure.c", + "src/core/plugin_registry/grpc_unsecure_plugin_registry.c", + ], ], language = "c", standalone = True, deps = [ "census", "grpc_base", - "grpc_lb_policy_grpclb_secure", "grpc_lb_policy_pick_first", "grpc_lb_policy_round_robin", "grpc_load_reporting", "grpc_max_age_filter", - "grpc_resolver_dns_ares", "grpc_resolver_dns_native", "grpc_resolver_sockaddr", - "grpc_secure", "grpc_transport_chttp2_client_insecure", - "grpc_transport_chttp2_client_secure", "grpc_transport_chttp2_server_insecure", - "grpc_transport_chttp2_server_secure", "grpc_message_size_filter", "grpc_deadline_filter", ], + additional_dep_list = [ + [ + "grpc_secure", + "grpc_resolver_dns_ares", + "grpc_lb_policy_grpclb_secure", + "grpc_transport_chttp2_client_secure", + "grpc_transport_chttp2_server_secure", + ], + [], + ], ) grpc_cc_library( @@ -98,32 +111,6 @@ grpc_cc_library( ], ) -grpc_cc_library( - name = "grpc_unsecure", - srcs = [ - "src/core/lib/surface/init.c", - "src/core/lib/surface/init_unsecure.c", - "src/core/plugin_registry/grpc_unsecure_plugin_registry.c", - ], - language = "c", - standalone = True, - deps = [ - "census", - "grpc_base", - "grpc_lb_policy_grpclb", - "grpc_lb_policy_pick_first", - "grpc_lb_policy_round_robin", - "grpc_load_reporting", - "grpc_max_age_filter", - "grpc_resolver_dns_native", - "grpc_resolver_sockaddr", - "grpc_transport_chttp2_client_insecure", - "grpc_transport_chttp2_server_insecure", - "grpc_message_size_filter", - "grpc_deadline_filter", - ], -) - grpc_cc_library( name = "grpc++", srcs = [ diff --git a/bazel/grpc_build_system.bzl b/bazel/grpc_build_system.bzl index 984c06de48..a438186c75 100644 --- a/bazel/grpc_build_system.bzl +++ b/bazel/grpc_build_system.bzl @@ -49,14 +49,17 @@ def grpc_cc_library(name, srcs = [], public_hdrs = [], hdrs = [], external_deps ] ) -def grpc_cc_libraries(name_list, additional_dep_list, srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language="C++"): - for i in range(len(name_list)): +def grpc_cc_libraries(name_list, additional_src_list = [], additional_dep_list = [], srcs = [], public_hdrs = [], hdrs = [], external_deps = [], deps = [], standalone = False, language="C++"): + names = len(name_list) + asl = additional_src_list + [[]]*(names - len(additional_src_list)) + adl = additional_dep_list + [[]]*(names - len(additional_dep_list)) + for i in range(names): grpc_cc_library( name = name_list[i], - srcs = srcs, + srcs = srcs + asl[i], hdrs = hdrs, public_hdrs = public_hdrs, - deps = deps + additional_dep_list[i], + deps = deps + adl[i], external_deps = external_deps, standalone = standalone, language = language -- cgit v1.2.3