From e808329475b61fa966283a51870ea5464e2bf4a2 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Wed, 16 Oct 2019 15:22:24 -0400 Subject: [PATCH 1/6] Add options for all codegen plugins Codegen plugins can be enabled or disabled individually by setting gRPC_BUILD_ to ON or OFF. --- templates/CMakeLists.txt.template | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template index 923cda9b34c..998234972b7 100644 --- a/templates/CMakeLists.txt.template +++ b/templates/CMakeLists.txt.template @@ -315,13 +315,21 @@ endforeach() endfunction() - add_custom_target(plugins - DEPENDS + # These options allow users to enable or disable the building of the various + # protoc plugins. For example, running CMake with + # -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF will disable building the C# plugin. + set(_gRPC_PLUGIN_LIST) % for tgt in targets: % if tgt.build == 'protoc': - ${tgt.name} + option(gRPC_BUILD_${tgt.name.upper()} "Build ${tgt.name}" ON) + if (gRPC_BUILD_${tgt.name.upper()}) + list(APPEND _gRPC_PLUGIN_LIST ${tgt.name}) + endif () % endif % endfor + + add_custom_target(plugins + DEPENDS <%text>${_gRPC_PLUGIN_LIST} ) add_custom_target(tools_c @@ -419,7 +427,7 @@ endif() % elif tgt.build in ["protoc"]: - if(gRPC_BUILD_CODEGEN) + if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_${tgt.name.upper()}) <%block filter='platforms_condition_block(tgt.platforms)'> ${cc_binary(tgt)} ${cc_install(tgt)} From 221f3075909e3394274b17daeb7d39e32a69a2e1 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Wed, 16 Oct 2019 15:23:32 -0400 Subject: [PATCH 2/6] Update CMakeLists.txt --- CMakeLists.txt | 56 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b8fe560e75..1645eebfe0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,15 +220,41 @@ function(protobuf_generate_grpc_cpp) endforeach() endfunction() +# These options allow users to enable or disable the building of the various +# protoc plugins. For example, running CMake with +# -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF will disable building the C# plugin. +set(_gRPC_PLUGIN_LIST) +option(gRPC_BUILD_GRPC_CPP_PLUGIN "Build grpc_cpp_plugin" ON) +if (gRPC_BUILD_GRPC_CPP_PLUGIN) + list(APPEND _gRPC_PLUGIN_LIST grpc_cpp_plugin) +endif () +option(gRPC_BUILD_GRPC_CSHARP_PLUGIN "Build grpc_csharp_plugin" ON) +if (gRPC_BUILD_GRPC_CSHARP_PLUGIN) + list(APPEND _gRPC_PLUGIN_LIST grpc_csharp_plugin) +endif () +option(gRPC_BUILD_GRPC_NODE_PLUGIN "Build grpc_node_plugin" ON) +if (gRPC_BUILD_GRPC_NODE_PLUGIN) + list(APPEND _gRPC_PLUGIN_LIST grpc_node_plugin) +endif () +option(gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN "Build grpc_objective_c_plugin" ON) +if (gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN) + list(APPEND _gRPC_PLUGIN_LIST grpc_objective_c_plugin) +endif () +option(gRPC_BUILD_GRPC_PHP_PLUGIN "Build grpc_php_plugin" ON) +if (gRPC_BUILD_GRPC_PHP_PLUGIN) + list(APPEND _gRPC_PLUGIN_LIST grpc_php_plugin) +endif () +option(gRPC_BUILD_GRPC_PYTHON_PLUGIN "Build grpc_python_plugin" ON) +if (gRPC_BUILD_GRPC_PYTHON_PLUGIN) + list(APPEND _gRPC_PLUGIN_LIST grpc_python_plugin) +endif () +option(gRPC_BUILD_GRPC_RUBY_PLUGIN "Build grpc_ruby_plugin" ON) +if (gRPC_BUILD_GRPC_RUBY_PLUGIN) + list(APPEND _gRPC_PLUGIN_LIST grpc_ruby_plugin) +endif () + add_custom_target(plugins - DEPENDS - grpc_cpp_plugin - grpc_csharp_plugin - grpc_node_plugin - grpc_objective_c_plugin - grpc_php_plugin - grpc_python_plugin - grpc_ruby_plugin + DEPENDS ${_gRPC_PLUGIN_LIST} ) add_custom_target(tools_c @@ -12509,7 +12535,7 @@ target_link_libraries(grpc_cli endif() -if(gRPC_BUILD_CODEGEN) +if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CPP_PLUGIN) add_executable(grpc_cpp_plugin src/compiler/cpp_plugin.cc @@ -12546,7 +12572,7 @@ if(gRPC_INSTALL) endif() endif() -if(gRPC_BUILD_CODEGEN) +if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_CSHARP_PLUGIN) add_executable(grpc_csharp_plugin src/compiler/csharp_plugin.cc @@ -12656,7 +12682,7 @@ target_link_libraries(grpc_linux_system_roots_test endif() -if(gRPC_BUILD_CODEGEN) +if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_NODE_PLUGIN) add_executable(grpc_node_plugin src/compiler/node_plugin.cc @@ -12693,7 +12719,7 @@ if(gRPC_INSTALL) endif() endif() -if(gRPC_BUILD_CODEGEN) +if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN) add_executable(grpc_objective_c_plugin src/compiler/objective_c_plugin.cc @@ -12730,7 +12756,7 @@ if(gRPC_INSTALL) endif() endif() -if(gRPC_BUILD_CODEGEN) +if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_PHP_PLUGIN) add_executable(grpc_php_plugin src/compiler/php_plugin.cc @@ -12767,7 +12793,7 @@ if(gRPC_INSTALL) endif() endif() -if(gRPC_BUILD_CODEGEN) +if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_PYTHON_PLUGIN) add_executable(grpc_python_plugin src/compiler/python_plugin.cc @@ -12804,7 +12830,7 @@ if(gRPC_INSTALL) endif() endif() -if(gRPC_BUILD_CODEGEN) +if(gRPC_BUILD_CODEGEN AND gRPC_BUILD_GRPC_RUBY_PLUGIN) add_executable(grpc_ruby_plugin src/compiler/ruby_plugin.cc From 6e0b3a6784aa0a9acb67496a866280e2991e2f35 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 13 Nov 2019 12:23:53 +0100 Subject: [PATCH 3/6] Increase MacOS C/C++ test limit --- tools/internal_ci/macos/grpc_basictests_c_cpp.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/internal_ci/macos/grpc_basictests_c_cpp.cfg b/tools/internal_ci/macos/grpc_basictests_c_cpp.cfg index f16e3e8ee68..3d6678817b8 100644 --- a/tools/internal_ci/macos/grpc_basictests_c_cpp.cfg +++ b/tools/internal_ci/macos/grpc_basictests_c_cpp.cfg @@ -17,7 +17,7 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" -timeout_mins: 120 +timeout_mins: 180 action { define_artifacts { regex: "**/*sponge_log.*" From d3bae202158900463e047b98f61a5afeb63d6416 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 13 Nov 2019 12:25:14 +0100 Subject: [PATCH 4/6] Increase MacOS C/C++ test limit --- tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp.cfg b/tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp.cfg index 00f402d389b..936fc4f49c8 100644 --- a/tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp.cfg +++ b/tools/internal_ci/macos/pull_request/grpc_basictests_c_cpp.cfg @@ -17,7 +17,7 @@ # Location of the continuous shell script in repository. build_file: "grpc/tools/internal_ci/macos/grpc_run_tests_matrix.sh" gfile_resources: "/bigstore/grpc-testing-secrets/gcp_credentials/GrpcTesting-d0eeee2db331.json" -timeout_mins: 120 +timeout_mins: 180 action { define_artifacts { regex: "**/*sponge_log.*" From f14ce59fc80dff25cf191d1374386f27dedf7a5a Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Wed, 13 Nov 2019 08:19:41 -0800 Subject: [PATCH 5/6] Fix typo in gRPC C++ podspec --- gRPC-C++.podspec | 2 +- templates/gRPC-C++.podspec.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 26340b79601..d9cdbb155d2 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -1247,7 +1247,7 @@ Pod::Spec.new do |s| end s.subspec 'Cronet-Implementation' do |ss| - ss.header_mappings_dir = 'include/grpcpp' + ss.header_mappings_dir = '.' ss.dependency "#{s.name}/Cronet-Interface", version ss.dependency "#{s.name}/Implementation", version diff --git a/templates/gRPC-C++.podspec.template b/templates/gRPC-C++.podspec.template index c93fa0de277..0a31cc5066b 100644 --- a/templates/gRPC-C++.podspec.template +++ b/templates/gRPC-C++.podspec.template @@ -208,7 +208,7 @@ end s.subspec 'Cronet-Implementation' do |ss| - ss.header_mappings_dir = 'include/grpcpp' + ss.header_mappings_dir = '.' ss.dependency "#{s.name}/Cronet-Interface", version ss.dependency "#{s.name}/Implementation", version From 2a6cad41a4c7d03d4ac580f6454e86d0dab5ec80 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Wed, 13 Nov 2019 12:10:49 -0800 Subject: [PATCH 6/6] Fix racey test assertion in alts_concurrent_connectivity_test --- .../alts_concurrent_connectivity_test.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc index abd608a6364..67dda4cd6e8 100644 --- a/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc +++ b/test/core/tsi/alts/handshaker/alts_concurrent_connectivity_test.cc @@ -236,7 +236,22 @@ class ConnectLoopRunner { << "connect_loop runner:" << std::hex << self << " got ev.type:" << ev.type << " i:" << i; ASSERT_TRUE(ev.success); + grpc_connectivity_state prev_state = state; state = grpc_channel_check_connectivity_state(channel, 1); + if (self->expected_connectivity_states_ == + GRPC_CHANNEL_TRANSIENT_FAILURE && + prev_state == GRPC_CHANNEL_CONNECTING && + state == GRPC_CHANNEL_CONNECTING) { + // Detect a race in state checking: if the watch_connectivity_state + // completed from prior state "connecting", this could be because the + // channel momentarily entered state "transient failure", which is + // what we want. However, if the channel immediately re-enters + // "connecting" state, then the new state check might still result in + // "connecting". A continuous repeat of this can cause this loop to + // never terminate in time. So take this scenario to indicate that the + // channel momentarily entered transient failure. + break; + } } grpc_channel_destroy(channel); grpc_completion_queue_shutdown(cq);