From 4098498227024ca4632fcb0beeee6db0d5892336 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Wed, 2 May 2018 22:37:44 -0700 Subject: Bump version to v1.12.0-pre1 --- BUILD | 4 ++-- build.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BUILD b/BUILD index 241f7c220d..cb68b3d0f5 100644 --- a/BUILD +++ b/BUILD @@ -66,9 +66,9 @@ config_setting( # This should be updated along with build.yaml g_stands_for = "glorious" -core_version = "6.0.0-dev" +core_version = "6.0.0-pre1" -version = "1.12.0-dev" +version = "1.12.0-pre1" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index c63ca5de5b..48eee9e77f 100644 --- a/build.yaml +++ b/build.yaml @@ -12,9 +12,9 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here - core_version: 6.0.0-dev + core_version: 6.0.0-pre1 g_stands_for: glorious - version: 1.12.0-dev + version: 1.12.0-pre1 filegroups: - name: alts_proto headers: -- cgit v1.2.3 From e388cdfb635c9cf267c0f6defac7aa016c3b8d77 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Wed, 2 May 2018 22:38:37 -0700 Subject: Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 6 +++--- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 4 ++-- src/core/lib/surface/version.cc | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 4 ++-- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 31 files changed, 37 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e64d2efbc..2b49a4ba8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.12.0-dev") +set(PACKAGE_VERSION "1.12.0-pre1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index 76fa95b419..73b1ee054c 100644 --- a/Makefile +++ b/Makefile @@ -420,9 +420,9 @@ E = @echo Q = @ endif -CORE_VERSION = 6.0.0-dev -CPP_VERSION = 1.12.0-dev -CSHARP_VERSION = 1.12.0-dev +CORE_VERSION = 6.0.0-pre1 +CPP_VERSION = 1.12.0-pre1 +CSHARP_VERSION = 1.12.0-pre1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 990b0a4f9d..c98d6683a4 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.12.0-dev' + # version = '1.12.0-pre1' version = '0.0.2' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.12.0-dev' + grpc_version = '1.12.0-pre1' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index a1e0fd2ca1..b846c4c5a6 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.12.0-dev' + version = '1.12.0-pre1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index e98dee4a3c..a7ada84a10 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.12.0-dev' + version = '1.12.0-pre1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index 3bba14b695..f96a1330e1 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.12.0-dev' + version = '1.12.0-pre1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index bf73ffd22e..a0079f5d61 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.12.0-dev' + version = '1.12.0-pre1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index b9cb22b647..8ebe6c00e7 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2018-01-19 - 1.12.0dev - 1.12.0dev + 1.12.0RC1 + 1.12.0RC1 beta diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index a712e10037..3cc06014ee 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -23,6 +23,6 @@ #include -const char* grpc_version_string(void) { return "6.0.0-dev"; } +const char* grpc_version_string(void) { return "6.0.0-pre1"; } const char* grpc_g_stands_for(void) { return "glorious"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index d669ea21a9..50fc644190 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.12.0-dev"; } +grpc::string Version() { return "1.12.0-pre1"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 6e28c11df2..253d69e4cd 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.12.0-dev + 1.12.0-pre1 3.5.1 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 06a0396c34..2d02050cae 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.12.0-dev"; + public const string CurrentVersion = "1.12.0-pre1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index 0d65748697..bfb2ccb301 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.12.0-dev +set VERSION=1.12.0-pre1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index 66aba36089..a9a02ab021 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -45,7 +45,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.12.0-dev" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.12.0-dev" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.12.0-pre1" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.12.0-pre1" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index f06312bea9..6cb792c4ce 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.12.0-dev' + v = '1.12.0-pre1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 1298e7e191..e602d8f9eb 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.12.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.12.0-pre1" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index d36545fced..ef73f71ae0 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.12.0-dev" -#define GRPC_C_VERSION_STRING @"6.0.0-dev" +#define GRPC_OBJC_VERSION_STRING @"1.12.0-pre1" +#define GRPC_C_VERSION_STRING @"6.0.0-pre1" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 37df2768bf..85a7a62244 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.12.0dev" +#define PHP_GRPC_VERSION "1.12.0RC1" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index cb5da72f1f..9b4187a529 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.12.0.dev0""" +__version__ = """1.12.0rc1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index de5a780abd..48b6aff885 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.12.0.dev0' +VERSION = '1.12.0rc1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index afcd316e5c..50b51e9b0a 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.12.0.dev0' +VERSION = '1.12.0rc1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 824b73201d..b4c7eeca6a 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.12.0.dev0' +VERSION = '1.12.0rc1' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 5b1f4c4cc0..8edd988386 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.12.0.dev0' +VERSION = '1.12.0rc1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 382f95018e..889a040d28 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.12.0.dev0' +VERSION = '1.12.0rc1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 2cb7c4be53..e2375b46de 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.12.0.dev' + VERSION = '1.12.0.pre1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 822f70eb0a..871faaca91 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.12.0.dev' + VERSION = '1.12.0.pre1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index e71f836f6d..28ffe7c824 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.12.0.dev0' +VERSION = '1.12.0rc1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 22f225ec54..9ad47e9cab 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.12.0-dev +PROJECT_NUMBER = 1.12.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 63d238d741..326ecd468b 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.12.0-dev +PROJECT_NUMBER = 1.12.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 04f9d78850..36c6550baf 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.0-dev +PROJECT_NUMBER = 6.0.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index b28641156f..0c874a7dc9 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.0-dev +PROJECT_NUMBER = 6.0.0-pre1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- cgit v1.2.3 From 7f6858ce61d5d6c103e0bf121fdccd9e743fc0a5 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 3 May 2018 10:16:34 -0700 Subject: Fix generater --- src/compiler/objective_c_generator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 7d4d4d1f5a..2294615a28 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -222,7 +222,7 @@ void PrintMethodImplementations(Printer* printer, map< ::grpc::string, ::grpc::string> vars = { {"service_class", ServiceClassName(service)}}; - printer.Print(vars, "@protocol $service_class$ \n\n"); + printer.Print(vars, "@protocol $service_class$ \n\n"); for (int i = 0; i < service->method_count(); i++) { PrintMethodDeclarations(&printer, service->method(i)); } @@ -248,7 +248,7 @@ void PrintMethodImplementations(Printer* printer, " */\n"); printer.Print(vars, "@interface $service_class$ :" - " GRPCProtoService<$service_class$, GRPCProtoServiceInit>\n"); + " GRPCProtoService<$service_class$>\n"); printer.Print( "- (instancetype)initWithHost:(NSString *)host" " NS_DESIGNATED_INITIALIZER;\n"); -- cgit v1.2.3 From f5d869a2b3ddc8b5db957858ce0df4e5be6b93eb Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 3 May 2018 10:36:11 -0700 Subject: clang-format --- src/compiler/objective_c_generator.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index 2294615a28..e97494f64c 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -222,7 +222,8 @@ void PrintMethodImplementations(Printer* printer, map< ::grpc::string, ::grpc::string> vars = { {"service_class", ServiceClassName(service)}}; - printer.Print(vars, "@protocol $service_class$ \n\n"); + printer.Print( + vars, "@protocol $service_class$ \n\n"); for (int i = 0; i < service->method_count(); i++) { PrintMethodDeclarations(&printer, service->method(i)); } -- cgit v1.2.3 From 61d9a42007a61be9d59fc2e161c59a5ecde32214 Mon Sep 17 00:00:00 2001 From: ganmacs Date: Mon, 14 May 2018 17:52:34 +0900 Subject: Moved pubsub demo_demo to examples directory of ruby so that grpc does not depends on googleauth gem. This project (pubsub demo) is introduced at [this commit](https://github.com/grpc/grpc/commit/d5d00d5c8fac4495ea42020866feb913c854aa1e#diff-c495642bb64c09cae54f3ccff463bd51) as demo project for grpc with ruby. This demo is awesome. But the position of this project directory seems to be not suitable for demo app. This project added unnecessary gem dependency about googleauth to grpc ruby gem. --- examples/ruby/grpc-demo.gemspec | 1 + examples/ruby/pubsub/google/protobuf/empty.rb | 29 +++ examples/ruby/pubsub/pubsub_demo.rb | 241 +++++++++++++++++++++ examples/ruby/pubsub/tech/pubsub/proto/pubsub.rb | 159 ++++++++++++++ .../pubsub/tech/pubsub/proto/pubsub_services.rb | 88 ++++++++ src/ruby/bin/apis/google/protobuf/empty.rb | 29 --- src/ruby/bin/apis/pubsub_demo.rb | 241 --------------------- src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb | 159 -------------- .../bin/apis/tech/pubsub/proto/pubsub_services.rb | 88 -------- 9 files changed, 518 insertions(+), 517 deletions(-) create mode 100644 examples/ruby/pubsub/google/protobuf/empty.rb create mode 100755 examples/ruby/pubsub/pubsub_demo.rb create mode 100644 examples/ruby/pubsub/tech/pubsub/proto/pubsub.rb create mode 100644 examples/ruby/pubsub/tech/pubsub/proto/pubsub_services.rb delete mode 100644 src/ruby/bin/apis/google/protobuf/empty.rb delete mode 100755 src/ruby/bin/apis/pubsub_demo.rb delete mode 100644 src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb delete mode 100644 src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb diff --git a/examples/ruby/grpc-demo.gemspec b/examples/ruby/grpc-demo.gemspec index 4423fd34d4..c77446249e 100644 --- a/examples/ruby/grpc-demo.gemspec +++ b/examples/ruby/grpc-demo.gemspec @@ -18,6 +18,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.add_dependency 'grpc', '~> 1.0' + s.add_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.add_development_dependency 'bundler', '~> 1.7' end diff --git a/examples/ruby/pubsub/google/protobuf/empty.rb b/examples/ruby/pubsub/google/protobuf/empty.rb new file mode 100644 index 0000000000..4743bded3d --- /dev/null +++ b/examples/ruby/pubsub/google/protobuf/empty.rb @@ -0,0 +1,29 @@ +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/protobuf/empty.proto + +require 'google/protobuf' + +Google::Protobuf::DescriptorPool.generated_pool.build do + add_message "google.protobuf.Empty" do + end +end + +module Google + module Protobuf + Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass + end +end diff --git a/examples/ruby/pubsub/pubsub_demo.rb b/examples/ruby/pubsub/pubsub_demo.rb new file mode 100755 index 0000000000..c565771d45 --- /dev/null +++ b/examples/ruby/pubsub/pubsub_demo.rb @@ -0,0 +1,241 @@ +#!/usr/bin/env ruby + +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# pubsub_demo demos accesses the Google PubSub API via its gRPC interface +# +# $ GOOGLE_APPLICATION_CREDENTIALS= \ +# path/to/pubsub_demo.rb \ +# [--action= ] +# +# There are options related to the chosen action, see #parse_args below. +# - the possible actions are given by the method names of NamedAction class +# - the default action is list_some_topics + +this_dir = File.expand_path(File.dirname(__FILE__)) +lib_dir = File.join(File.dirname(File.dirname(this_dir)), 'lib') +$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) +$LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir) + +require 'optparse' + +require 'grpc' +require 'googleauth' +require 'google/protobuf' + +require 'google/protobuf/empty' +require 'tech/pubsub/proto/pubsub' +require 'tech/pubsub/proto/pubsub_services' + +# creates a SSL Credentials from the production certificates. +def ssl_creds + GRPC::Core::ChannelCredentials.new() +end + +# Builds the metadata authentication update proc. +def auth_proc(opts) + auth_creds = Google::Auth.get_application_default + return auth_creds.updater_proc +end + +# Creates a stub for accessing the publisher service. +def publisher_stub(opts) + address = "#{opts.host}:#{opts.port}" + stub_clz = Tech::Pubsub::PublisherService::Stub # shorter + GRPC.logger.info("... access PublisherService at #{address}") + call_creds = GRPC::Core::CallCredentials.new(auth_proc(opts)) + combined_creds = ssl_creds.compose(call_creds) + stub_clz.new(address, creds: combined_creds, + GRPC::Core::Channel::SSL_TARGET => opts.host) +end + +# Creates a stub for accessing the subscriber service. +def subscriber_stub(opts) + address = "#{opts.host}:#{opts.port}" + stub_clz = Tech::Pubsub::SubscriberService::Stub # shorter + GRPC.logger.info("... access SubscriberService at #{address}") + call_creds = GRPC::Core::CallCredentials.new(auth_proc(opts)) + combined_creds = ssl_creds.compose(call_creds) + stub_clz.new(address, creds: combined_creds, + GRPC::Core::Channel::SSL_TARGET => opts.host) +end + +# defines methods corresponding to each interop test case. +class NamedActions + include Tech::Pubsub + + # Initializes NamedActions + # + # @param pub [Stub] a stub for accessing the publisher service + # @param sub [Stub] a stub for accessing the publisher service + # @param args [Args] provides access to the command line + def initialize(pub, sub, args) + @pub = pub + @sub = sub + @args = args + end + + # Removes the test topic if it exists + def remove_topic + name = test_topic_name + p "... removing Topic #{name}" + @pub.delete_topic(DeleteTopicRequest.new(topic: name)) + p "removed Topic: #{name} OK" + rescue GRPC::BadStatus => e + p "Could not delete a topics: rpc failed with '#{e}'" + end + + # Creates a test topic + def create_topic + name = test_topic_name + p "... creating Topic #{name}" + resp = @pub.create_topic(Topic.new(name: name)) + p "created Topic: #{resp.name} OK" + rescue GRPC::BadStatus => e + p "Could not create a topics: rpc failed with '#{e}'" + end + + # Lists topics in the project + def list_some_topics + p 'Listing topics' + p '-------------_' + list_project_topics.topic.each { |t| p t.name } + rescue GRPC::BadStatus => e + p "Could not list topics: rpc failed with '#{e}'" + end + + # Checks if a topics exists in a project + def check_exists + name = test_topic_name + p "... checking for topic #{name}" + exists = topic_exists?(name) + p "#{name} is a topic" if exists + p "#{name} is not a topic" unless exists + rescue GRPC::BadStatus => e + p "Could not check for a topics: rpc failed with '#{e}'" + end + + # Publishes some messages + def random_pub_sub + topic_name, sub_name = test_topic_name, test_sub_name + create_topic_if_needed(topic_name) + @sub.create_subscription(Subscription.new(name: sub_name, + topic: topic_name)) + msg_count = rand(10..30) + msg_count.times do |x| + msg = PubsubMessage.new(data: "message #{x}") + @pub.publish(PublishRequest.new(topic: topic_name, message: msg)) + end + p "Sent #{msg_count} messages to #{topic_name}, checking for them now." + batch = @sub.pull_batch(PullBatchRequest.new(subscription: sub_name, + max_events: msg_count)) + ack_ids = batch.pull_responses.map { |x| x.ack_id } + p "Got #{ack_ids.size} messages; acknowledging them.." + @sub.acknowledge(AcknowledgeRequest.new(subscription: sub_name, + ack_id: ack_ids)) + p "Test messages were acknowledged OK, deleting the subscription" + del_req = DeleteSubscriptionRequest.new(subscription: sub_name) + @sub.delete_subscription(del_req) + rescue GRPC::BadStatus => e + p "Could not do random pub sub: rpc failed with '#{e}'" + end + + private + + # test_topic_name is the topic name to use in this test. + def test_topic_name + unless @args.topic_name.nil? + return "/topics/#{@args.project_id}/#{@args.topic_name}" + end + now_text = Time.now.utc.strftime('%Y%m%d%H%M%S%L') + "/topics/#{@args.project_id}/#{ENV['USER']}-#{now_text}" + end + + # test_sub_name is the subscription name to use in this test. + def test_sub_name + unless @args.sub_name.nil? + return "/subscriptions/#{@args.project_id}/#{@args.sub_name}" + end + now_text = Time.now.utc.strftime('%Y%m%d%H%M%S%L') + "/subscriptions/#{@args.project_id}/#{ENV['USER']}-#{now_text}" + end + + # determines if the topic name exists + def topic_exists?(name) + topics = list_project_topics.topic.map { |t| t.name } + topics.include?(name) + end + + def create_topic_if_needed(name) + return if topic_exists?(name) + @pub.create_topic(Topic.new(name: name)) + end + + def list_project_topics + q = "cloud.googleapis.com/project in (/projects/#{@args.project_id})" + @pub.list_topics(ListTopicsRequest.new(query: q)) + end +end + +# Args is used to hold the command line info. +Args = Struct.new(:host, :port, :action, :project_id, :topic_name, + :sub_name) + +# validates the command line options, returning them as an Arg. +def parse_args + args = Args.new('pubsub-staging.googleapis.com', + 443, 'list_some_topics', 'stoked-keyword-656') + OptionParser.new do |opts| + opts.on('--server_host SERVER_HOST', 'server hostname') do |v| + args.host = v + end + opts.on('--server_port SERVER_PORT', 'server port') do |v| + args.port = v + end + + # instance_methods(false) gives only the methods defined in that class. + scenes = NamedActions.instance_methods(false).map { |t| t.to_s } + scene_list = scenes.join(',') + opts.on("--action CODE", scenes, {}, 'pick a demo action', + " (#{scene_list})") do |v| + args.action = v + end + + # Set the remaining values. + %w(project_id topic_name sub_name).each do |o| + opts.on("--#{o} VALUE", "#{o}") do |v| + args[o] = v + end + end + end.parse! + _check_args(args) +end + +def _check_args(args) + %w(host port action).each do |a| + if args[a].nil? + raise OptionParser::MissingArgument.new("please specify --#{a}") + end + end + args +end + +def main + args = parse_args + pub, sub = publisher_stub(args), subscriber_stub(args) + NamedActions.new(pub, sub, args).method(args.action).call +end + +main diff --git a/examples/ruby/pubsub/tech/pubsub/proto/pubsub.rb b/examples/ruby/pubsub/tech/pubsub/proto/pubsub.rb new file mode 100644 index 0000000000..73a0d5d9e4 --- /dev/null +++ b/examples/ruby/pubsub/tech/pubsub/proto/pubsub.rb @@ -0,0 +1,159 @@ +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: tech/pubsub/proto/pubsub.proto + +require 'google/protobuf' + +require 'google/protobuf/empty' +Google::Protobuf::DescriptorPool.generated_pool.build do + add_message "tech.pubsub.Topic" do + optional :name, :string, 1 + end + add_message "tech.pubsub.PubsubMessage" do + optional :data, :string, 1 + optional :message_id, :string, 3 + end + add_message "tech.pubsub.GetTopicRequest" do + optional :topic, :string, 1 + end + add_message "tech.pubsub.PublishRequest" do + optional :topic, :string, 1 + optional :message, :message, 2, "tech.pubsub.PubsubMessage" + end + add_message "tech.pubsub.PublishBatchRequest" do + optional :topic, :string, 1 + repeated :messages, :message, 2, "tech.pubsub.PubsubMessage" + end + add_message "tech.pubsub.PublishBatchResponse" do + repeated :message_ids, :string, 1 + end + add_message "tech.pubsub.ListTopicsRequest" do + optional :query, :string, 1 + optional :max_results, :int32, 2 + optional :page_token, :string, 3 + end + add_message "tech.pubsub.ListTopicsResponse" do + repeated :topic, :message, 1, "tech.pubsub.Topic" + optional :next_page_token, :string, 2 + end + add_message "tech.pubsub.DeleteTopicRequest" do + optional :topic, :string, 1 + end + add_message "tech.pubsub.Subscription" do + optional :name, :string, 1 + optional :topic, :string, 2 + optional :query, :string, 3 + optional :truncation_policy, :message, 4, "tech.pubsub.Subscription.TruncationPolicy" + optional :push_config, :message, 5, "tech.pubsub.PushConfig" + optional :ack_deadline_seconds, :int32, 6 + optional :garbage_collect_seconds, :int64, 7 + end + add_message "tech.pubsub.Subscription.TruncationPolicy" do + optional :max_bytes, :int64, 1 + optional :max_age_seconds, :int64, 2 + end + add_message "tech.pubsub.PushConfig" do + optional :push_endpoint, :string, 1 + end + add_message "tech.pubsub.PubsubEvent" do + optional :subscription, :string, 1 + optional :message, :message, 2, "tech.pubsub.PubsubMessage" + optional :truncated, :bool, 3 + optional :deleted, :bool, 4 + end + add_message "tech.pubsub.GetSubscriptionRequest" do + optional :subscription, :string, 1 + end + add_message "tech.pubsub.ListSubscriptionsRequest" do + optional :query, :string, 1 + optional :max_results, :int32, 3 + optional :page_token, :string, 4 + end + add_message "tech.pubsub.ListSubscriptionsResponse" do + repeated :subscription, :message, 1, "tech.pubsub.Subscription" + optional :next_page_token, :string, 2 + end + add_message "tech.pubsub.TruncateSubscriptionRequest" do + optional :subscription, :string, 1 + end + add_message "tech.pubsub.DeleteSubscriptionRequest" do + optional :subscription, :string, 1 + end + add_message "tech.pubsub.ModifyPushConfigRequest" do + optional :subscription, :string, 1 + optional :push_config, :message, 2, "tech.pubsub.PushConfig" + end + add_message "tech.pubsub.PullRequest" do + optional :subscription, :string, 1 + optional :return_immediately, :bool, 2 + end + add_message "tech.pubsub.PullResponse" do + optional :ack_id, :string, 1 + optional :pubsub_event, :message, 2, "tech.pubsub.PubsubEvent" + end + add_message "tech.pubsub.PullBatchRequest" do + optional :subscription, :string, 1 + optional :return_immediately, :bool, 2 + optional :max_events, :int32, 3 + end + add_message "tech.pubsub.PullBatchResponse" do + repeated :pull_responses, :message, 2, "tech.pubsub.PullResponse" + end + add_message "tech.pubsub.ModifyAckDeadlineRequest" do + optional :subscription, :string, 1 + optional :ack_id, :string, 2 + optional :ack_deadline_seconds, :int32, 3 + end + add_message "tech.pubsub.AcknowledgeRequest" do + optional :subscription, :string, 1 + repeated :ack_id, :string, 2 + end + add_message "tech.pubsub.NackRequest" do + optional :subscription, :string, 1 + repeated :ack_id, :string, 2 + end +end + +module Tech + module Pubsub + Topic = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.Topic").msgclass + PubsubMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PubsubMessage").msgclass + GetTopicRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.GetTopicRequest").msgclass + PublishRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PublishRequest").msgclass + PublishBatchRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PublishBatchRequest").msgclass + PublishBatchResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PublishBatchResponse").msgclass + ListTopicsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ListTopicsRequest").msgclass + ListTopicsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ListTopicsResponse").msgclass + DeleteTopicRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.DeleteTopicRequest").msgclass + Subscription = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.Subscription").msgclass + Subscription::TruncationPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.Subscription.TruncationPolicy").msgclass + PushConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PushConfig").msgclass + PubsubEvent = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PubsubEvent").msgclass + GetSubscriptionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.GetSubscriptionRequest").msgclass + ListSubscriptionsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ListSubscriptionsRequest").msgclass + ListSubscriptionsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ListSubscriptionsResponse").msgclass + TruncateSubscriptionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.TruncateSubscriptionRequest").msgclass + DeleteSubscriptionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.DeleteSubscriptionRequest").msgclass + ModifyPushConfigRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ModifyPushConfigRequest").msgclass + PullRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PullRequest").msgclass + PullResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PullResponse").msgclass + PullBatchRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PullBatchRequest").msgclass + PullBatchResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PullBatchResponse").msgclass + ModifyAckDeadlineRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ModifyAckDeadlineRequest").msgclass + AcknowledgeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.AcknowledgeRequest").msgclass + NackRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.NackRequest").msgclass + end +end diff --git a/examples/ruby/pubsub/tech/pubsub/proto/pubsub_services.rb b/examples/ruby/pubsub/tech/pubsub/proto/pubsub_services.rb new file mode 100644 index 0000000000..b34db57b44 --- /dev/null +++ b/examples/ruby/pubsub/tech/pubsub/proto/pubsub_services.rb @@ -0,0 +1,88 @@ +# Copyright 2015 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# 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. + +# Generated by the protocol buffer compiler. DO NOT EDIT! +# Source: tech/pubsub/proto/pubsub.proto for package 'tech.pubsub' + +require 'grpc' +require 'google/protobuf/empty' +require 'tech/pubsub/proto/pubsub' + +module Tech + module Pubsub + module PublisherService + + # TODO: add proto service documentation here + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'tech.pubsub.PublisherService' + + rpc :CreateTopic, Topic, Topic + rpc :Publish, PublishRequest, Google::Protobuf::Empty + rpc :PublishBatch, PublishBatchRequest, PublishBatchResponse + rpc :GetTopic, GetTopicRequest, Topic + rpc :ListTopics, ListTopicsRequest, ListTopicsResponse + rpc :DeleteTopic, DeleteTopicRequest, Google::Protobuf::Empty + end + + Stub = Service.rpc_stub_class + end + module SubscriberService + + # TODO: add proto service documentation here + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'tech.pubsub.SubscriberService' + + rpc :CreateSubscription, Subscription, Subscription + rpc :GetSubscription, GetSubscriptionRequest, Subscription + rpc :ListSubscriptions, ListSubscriptionsRequest, ListSubscriptionsResponse + rpc :DeleteSubscription, DeleteSubscriptionRequest, Google::Protobuf::Empty + rpc :TruncateSubscription, TruncateSubscriptionRequest, Google::Protobuf::Empty + rpc :ModifyPushConfig, ModifyPushConfigRequest, Google::Protobuf::Empty + rpc :Pull, PullRequest, PullResponse + rpc :PullBatch, PullBatchRequest, PullBatchResponse + rpc :ModifyAckDeadline, ModifyAckDeadlineRequest, Google::Protobuf::Empty + rpc :Acknowledge, AcknowledgeRequest, Google::Protobuf::Empty + rpc :Nack, NackRequest, Google::Protobuf::Empty + end + + Stub = Service.rpc_stub_class + end + module PushEndpointService + + # TODO: add proto service documentation here + class Service + + include GRPC::GenericService + + self.marshal_class_method = :encode + self.unmarshal_class_method = :decode + self.service_name = 'tech.pubsub.PushEndpointService' + + rpc :HandlePubsubEvent, PubsubEvent, Google::Protobuf::Empty + end + + Stub = Service.rpc_stub_class + end + end +end diff --git a/src/ruby/bin/apis/google/protobuf/empty.rb b/src/ruby/bin/apis/google/protobuf/empty.rb deleted file mode 100644 index 4743bded3d..0000000000 --- a/src/ruby/bin/apis/google/protobuf/empty.rb +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: google/protobuf/empty.proto - -require 'google/protobuf' - -Google::Protobuf::DescriptorPool.generated_pool.build do - add_message "google.protobuf.Empty" do - end -end - -module Google - module Protobuf - Empty = Google::Protobuf::DescriptorPool.generated_pool.lookup("google.protobuf.Empty").msgclass - end -end diff --git a/src/ruby/bin/apis/pubsub_demo.rb b/src/ruby/bin/apis/pubsub_demo.rb deleted file mode 100755 index c565771d45..0000000000 --- a/src/ruby/bin/apis/pubsub_demo.rb +++ /dev/null @@ -1,241 +0,0 @@ -#!/usr/bin/env ruby - -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# pubsub_demo demos accesses the Google PubSub API via its gRPC interface -# -# $ GOOGLE_APPLICATION_CREDENTIALS= \ -# path/to/pubsub_demo.rb \ -# [--action= ] -# -# There are options related to the chosen action, see #parse_args below. -# - the possible actions are given by the method names of NamedAction class -# - the default action is list_some_topics - -this_dir = File.expand_path(File.dirname(__FILE__)) -lib_dir = File.join(File.dirname(File.dirname(this_dir)), 'lib') -$LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir) -$LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir) - -require 'optparse' - -require 'grpc' -require 'googleauth' -require 'google/protobuf' - -require 'google/protobuf/empty' -require 'tech/pubsub/proto/pubsub' -require 'tech/pubsub/proto/pubsub_services' - -# creates a SSL Credentials from the production certificates. -def ssl_creds - GRPC::Core::ChannelCredentials.new() -end - -# Builds the metadata authentication update proc. -def auth_proc(opts) - auth_creds = Google::Auth.get_application_default - return auth_creds.updater_proc -end - -# Creates a stub for accessing the publisher service. -def publisher_stub(opts) - address = "#{opts.host}:#{opts.port}" - stub_clz = Tech::Pubsub::PublisherService::Stub # shorter - GRPC.logger.info("... access PublisherService at #{address}") - call_creds = GRPC::Core::CallCredentials.new(auth_proc(opts)) - combined_creds = ssl_creds.compose(call_creds) - stub_clz.new(address, creds: combined_creds, - GRPC::Core::Channel::SSL_TARGET => opts.host) -end - -# Creates a stub for accessing the subscriber service. -def subscriber_stub(opts) - address = "#{opts.host}:#{opts.port}" - stub_clz = Tech::Pubsub::SubscriberService::Stub # shorter - GRPC.logger.info("... access SubscriberService at #{address}") - call_creds = GRPC::Core::CallCredentials.new(auth_proc(opts)) - combined_creds = ssl_creds.compose(call_creds) - stub_clz.new(address, creds: combined_creds, - GRPC::Core::Channel::SSL_TARGET => opts.host) -end - -# defines methods corresponding to each interop test case. -class NamedActions - include Tech::Pubsub - - # Initializes NamedActions - # - # @param pub [Stub] a stub for accessing the publisher service - # @param sub [Stub] a stub for accessing the publisher service - # @param args [Args] provides access to the command line - def initialize(pub, sub, args) - @pub = pub - @sub = sub - @args = args - end - - # Removes the test topic if it exists - def remove_topic - name = test_topic_name - p "... removing Topic #{name}" - @pub.delete_topic(DeleteTopicRequest.new(topic: name)) - p "removed Topic: #{name} OK" - rescue GRPC::BadStatus => e - p "Could not delete a topics: rpc failed with '#{e}'" - end - - # Creates a test topic - def create_topic - name = test_topic_name - p "... creating Topic #{name}" - resp = @pub.create_topic(Topic.new(name: name)) - p "created Topic: #{resp.name} OK" - rescue GRPC::BadStatus => e - p "Could not create a topics: rpc failed with '#{e}'" - end - - # Lists topics in the project - def list_some_topics - p 'Listing topics' - p '-------------_' - list_project_topics.topic.each { |t| p t.name } - rescue GRPC::BadStatus => e - p "Could not list topics: rpc failed with '#{e}'" - end - - # Checks if a topics exists in a project - def check_exists - name = test_topic_name - p "... checking for topic #{name}" - exists = topic_exists?(name) - p "#{name} is a topic" if exists - p "#{name} is not a topic" unless exists - rescue GRPC::BadStatus => e - p "Could not check for a topics: rpc failed with '#{e}'" - end - - # Publishes some messages - def random_pub_sub - topic_name, sub_name = test_topic_name, test_sub_name - create_topic_if_needed(topic_name) - @sub.create_subscription(Subscription.new(name: sub_name, - topic: topic_name)) - msg_count = rand(10..30) - msg_count.times do |x| - msg = PubsubMessage.new(data: "message #{x}") - @pub.publish(PublishRequest.new(topic: topic_name, message: msg)) - end - p "Sent #{msg_count} messages to #{topic_name}, checking for them now." - batch = @sub.pull_batch(PullBatchRequest.new(subscription: sub_name, - max_events: msg_count)) - ack_ids = batch.pull_responses.map { |x| x.ack_id } - p "Got #{ack_ids.size} messages; acknowledging them.." - @sub.acknowledge(AcknowledgeRequest.new(subscription: sub_name, - ack_id: ack_ids)) - p "Test messages were acknowledged OK, deleting the subscription" - del_req = DeleteSubscriptionRequest.new(subscription: sub_name) - @sub.delete_subscription(del_req) - rescue GRPC::BadStatus => e - p "Could not do random pub sub: rpc failed with '#{e}'" - end - - private - - # test_topic_name is the topic name to use in this test. - def test_topic_name - unless @args.topic_name.nil? - return "/topics/#{@args.project_id}/#{@args.topic_name}" - end - now_text = Time.now.utc.strftime('%Y%m%d%H%M%S%L') - "/topics/#{@args.project_id}/#{ENV['USER']}-#{now_text}" - end - - # test_sub_name is the subscription name to use in this test. - def test_sub_name - unless @args.sub_name.nil? - return "/subscriptions/#{@args.project_id}/#{@args.sub_name}" - end - now_text = Time.now.utc.strftime('%Y%m%d%H%M%S%L') - "/subscriptions/#{@args.project_id}/#{ENV['USER']}-#{now_text}" - end - - # determines if the topic name exists - def topic_exists?(name) - topics = list_project_topics.topic.map { |t| t.name } - topics.include?(name) - end - - def create_topic_if_needed(name) - return if topic_exists?(name) - @pub.create_topic(Topic.new(name: name)) - end - - def list_project_topics - q = "cloud.googleapis.com/project in (/projects/#{@args.project_id})" - @pub.list_topics(ListTopicsRequest.new(query: q)) - end -end - -# Args is used to hold the command line info. -Args = Struct.new(:host, :port, :action, :project_id, :topic_name, - :sub_name) - -# validates the command line options, returning them as an Arg. -def parse_args - args = Args.new('pubsub-staging.googleapis.com', - 443, 'list_some_topics', 'stoked-keyword-656') - OptionParser.new do |opts| - opts.on('--server_host SERVER_HOST', 'server hostname') do |v| - args.host = v - end - opts.on('--server_port SERVER_PORT', 'server port') do |v| - args.port = v - end - - # instance_methods(false) gives only the methods defined in that class. - scenes = NamedActions.instance_methods(false).map { |t| t.to_s } - scene_list = scenes.join(',') - opts.on("--action CODE", scenes, {}, 'pick a demo action', - " (#{scene_list})") do |v| - args.action = v - end - - # Set the remaining values. - %w(project_id topic_name sub_name).each do |o| - opts.on("--#{o} VALUE", "#{o}") do |v| - args[o] = v - end - end - end.parse! - _check_args(args) -end - -def _check_args(args) - %w(host port action).each do |a| - if args[a].nil? - raise OptionParser::MissingArgument.new("please specify --#{a}") - end - end - args -end - -def main - args = parse_args - pub, sub = publisher_stub(args), subscriber_stub(args) - NamedActions.new(pub, sub, args).method(args.action).call -end - -main diff --git a/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb b/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb deleted file mode 100644 index 73a0d5d9e4..0000000000 --- a/src/ruby/bin/apis/tech/pubsub/proto/pubsub.rb +++ /dev/null @@ -1,159 +0,0 @@ -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# source: tech/pubsub/proto/pubsub.proto - -require 'google/protobuf' - -require 'google/protobuf/empty' -Google::Protobuf::DescriptorPool.generated_pool.build do - add_message "tech.pubsub.Topic" do - optional :name, :string, 1 - end - add_message "tech.pubsub.PubsubMessage" do - optional :data, :string, 1 - optional :message_id, :string, 3 - end - add_message "tech.pubsub.GetTopicRequest" do - optional :topic, :string, 1 - end - add_message "tech.pubsub.PublishRequest" do - optional :topic, :string, 1 - optional :message, :message, 2, "tech.pubsub.PubsubMessage" - end - add_message "tech.pubsub.PublishBatchRequest" do - optional :topic, :string, 1 - repeated :messages, :message, 2, "tech.pubsub.PubsubMessage" - end - add_message "tech.pubsub.PublishBatchResponse" do - repeated :message_ids, :string, 1 - end - add_message "tech.pubsub.ListTopicsRequest" do - optional :query, :string, 1 - optional :max_results, :int32, 2 - optional :page_token, :string, 3 - end - add_message "tech.pubsub.ListTopicsResponse" do - repeated :topic, :message, 1, "tech.pubsub.Topic" - optional :next_page_token, :string, 2 - end - add_message "tech.pubsub.DeleteTopicRequest" do - optional :topic, :string, 1 - end - add_message "tech.pubsub.Subscription" do - optional :name, :string, 1 - optional :topic, :string, 2 - optional :query, :string, 3 - optional :truncation_policy, :message, 4, "tech.pubsub.Subscription.TruncationPolicy" - optional :push_config, :message, 5, "tech.pubsub.PushConfig" - optional :ack_deadline_seconds, :int32, 6 - optional :garbage_collect_seconds, :int64, 7 - end - add_message "tech.pubsub.Subscription.TruncationPolicy" do - optional :max_bytes, :int64, 1 - optional :max_age_seconds, :int64, 2 - end - add_message "tech.pubsub.PushConfig" do - optional :push_endpoint, :string, 1 - end - add_message "tech.pubsub.PubsubEvent" do - optional :subscription, :string, 1 - optional :message, :message, 2, "tech.pubsub.PubsubMessage" - optional :truncated, :bool, 3 - optional :deleted, :bool, 4 - end - add_message "tech.pubsub.GetSubscriptionRequest" do - optional :subscription, :string, 1 - end - add_message "tech.pubsub.ListSubscriptionsRequest" do - optional :query, :string, 1 - optional :max_results, :int32, 3 - optional :page_token, :string, 4 - end - add_message "tech.pubsub.ListSubscriptionsResponse" do - repeated :subscription, :message, 1, "tech.pubsub.Subscription" - optional :next_page_token, :string, 2 - end - add_message "tech.pubsub.TruncateSubscriptionRequest" do - optional :subscription, :string, 1 - end - add_message "tech.pubsub.DeleteSubscriptionRequest" do - optional :subscription, :string, 1 - end - add_message "tech.pubsub.ModifyPushConfigRequest" do - optional :subscription, :string, 1 - optional :push_config, :message, 2, "tech.pubsub.PushConfig" - end - add_message "tech.pubsub.PullRequest" do - optional :subscription, :string, 1 - optional :return_immediately, :bool, 2 - end - add_message "tech.pubsub.PullResponse" do - optional :ack_id, :string, 1 - optional :pubsub_event, :message, 2, "tech.pubsub.PubsubEvent" - end - add_message "tech.pubsub.PullBatchRequest" do - optional :subscription, :string, 1 - optional :return_immediately, :bool, 2 - optional :max_events, :int32, 3 - end - add_message "tech.pubsub.PullBatchResponse" do - repeated :pull_responses, :message, 2, "tech.pubsub.PullResponse" - end - add_message "tech.pubsub.ModifyAckDeadlineRequest" do - optional :subscription, :string, 1 - optional :ack_id, :string, 2 - optional :ack_deadline_seconds, :int32, 3 - end - add_message "tech.pubsub.AcknowledgeRequest" do - optional :subscription, :string, 1 - repeated :ack_id, :string, 2 - end - add_message "tech.pubsub.NackRequest" do - optional :subscription, :string, 1 - repeated :ack_id, :string, 2 - end -end - -module Tech - module Pubsub - Topic = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.Topic").msgclass - PubsubMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PubsubMessage").msgclass - GetTopicRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.GetTopicRequest").msgclass - PublishRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PublishRequest").msgclass - PublishBatchRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PublishBatchRequest").msgclass - PublishBatchResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PublishBatchResponse").msgclass - ListTopicsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ListTopicsRequest").msgclass - ListTopicsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ListTopicsResponse").msgclass - DeleteTopicRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.DeleteTopicRequest").msgclass - Subscription = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.Subscription").msgclass - Subscription::TruncationPolicy = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.Subscription.TruncationPolicy").msgclass - PushConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PushConfig").msgclass - PubsubEvent = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PubsubEvent").msgclass - GetSubscriptionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.GetSubscriptionRequest").msgclass - ListSubscriptionsRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ListSubscriptionsRequest").msgclass - ListSubscriptionsResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ListSubscriptionsResponse").msgclass - TruncateSubscriptionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.TruncateSubscriptionRequest").msgclass - DeleteSubscriptionRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.DeleteSubscriptionRequest").msgclass - ModifyPushConfigRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ModifyPushConfigRequest").msgclass - PullRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PullRequest").msgclass - PullResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PullResponse").msgclass - PullBatchRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PullBatchRequest").msgclass - PullBatchResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.PullBatchResponse").msgclass - ModifyAckDeadlineRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.ModifyAckDeadlineRequest").msgclass - AcknowledgeRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.AcknowledgeRequest").msgclass - NackRequest = Google::Protobuf::DescriptorPool.generated_pool.lookup("tech.pubsub.NackRequest").msgclass - end -end diff --git a/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb b/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb deleted file mode 100644 index b34db57b44..0000000000 --- a/src/ruby/bin/apis/tech/pubsub/proto/pubsub_services.rb +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright 2015 gRPC authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# 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. - -# Generated by the protocol buffer compiler. DO NOT EDIT! -# Source: tech/pubsub/proto/pubsub.proto for package 'tech.pubsub' - -require 'grpc' -require 'google/protobuf/empty' -require 'tech/pubsub/proto/pubsub' - -module Tech - module Pubsub - module PublisherService - - # TODO: add proto service documentation here - class Service - - include GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'tech.pubsub.PublisherService' - - rpc :CreateTopic, Topic, Topic - rpc :Publish, PublishRequest, Google::Protobuf::Empty - rpc :PublishBatch, PublishBatchRequest, PublishBatchResponse - rpc :GetTopic, GetTopicRequest, Topic - rpc :ListTopics, ListTopicsRequest, ListTopicsResponse - rpc :DeleteTopic, DeleteTopicRequest, Google::Protobuf::Empty - end - - Stub = Service.rpc_stub_class - end - module SubscriberService - - # TODO: add proto service documentation here - class Service - - include GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'tech.pubsub.SubscriberService' - - rpc :CreateSubscription, Subscription, Subscription - rpc :GetSubscription, GetSubscriptionRequest, Subscription - rpc :ListSubscriptions, ListSubscriptionsRequest, ListSubscriptionsResponse - rpc :DeleteSubscription, DeleteSubscriptionRequest, Google::Protobuf::Empty - rpc :TruncateSubscription, TruncateSubscriptionRequest, Google::Protobuf::Empty - rpc :ModifyPushConfig, ModifyPushConfigRequest, Google::Protobuf::Empty - rpc :Pull, PullRequest, PullResponse - rpc :PullBatch, PullBatchRequest, PullBatchResponse - rpc :ModifyAckDeadline, ModifyAckDeadlineRequest, Google::Protobuf::Empty - rpc :Acknowledge, AcknowledgeRequest, Google::Protobuf::Empty - rpc :Nack, NackRequest, Google::Protobuf::Empty - end - - Stub = Service.rpc_stub_class - end - module PushEndpointService - - # TODO: add proto service documentation here - class Service - - include GRPC::GenericService - - self.marshal_class_method = :encode - self.unmarshal_class_method = :decode - self.service_name = 'tech.pubsub.PushEndpointService' - - rpc :HandlePubsubEvent, PubsubEvent, Google::Protobuf::Empty - end - - Stub = Service.rpc_stub_class - end - end -end -- cgit v1.2.3 From ff456e11df7b2e54ff41c6a56f3c16e97e7c41d9 Mon Sep 17 00:00:00 2001 From: ganmacs Date: Mon, 14 May 2018 18:19:04 +0900 Subject: Reject test directory in src/ruby/pb from packing as gem This seems to be a test directory, as the name implies. So This directory does not need to be include as grpc gem. --- grpc.gemspec | 4 +++- templates/grpc.gemspec.template | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/grpc.gemspec b/grpc.gemspec index 2a66801e34..2df1b9ee91 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -20,7 +20,9 @@ Gem::Specification.new do |s| s.files += Dir.glob('src/ruby/bin/**/*') s.files += Dir.glob('src/ruby/ext/**/*') s.files += Dir.glob('src/ruby/lib/**/*') - s.files += Dir.glob('src/ruby/pb/**/*') + s.files += Dir.glob('src/ruby/pb/**/*').reject do |f| + f.match(%r{^src/ruby/pb/test}) + end s.files += Dir.glob('include/grpc/**/*') s.test_files = Dir.glob('src/ruby/spec/**/*') s.bindir = 'src/ruby/bin' diff --git a/templates/grpc.gemspec.template b/templates/grpc.gemspec.template index fb54de1c8e..9945456d52 100644 --- a/templates/grpc.gemspec.template +++ b/templates/grpc.gemspec.template @@ -22,7 +22,9 @@ s.files += Dir.glob('src/ruby/bin/**/*') s.files += Dir.glob('src/ruby/ext/**/*') s.files += Dir.glob('src/ruby/lib/**/*') - s.files += Dir.glob('src/ruby/pb/**/*') + s.files += Dir.glob('src/ruby/pb/**/*').reject do |f| + f.match(%r{^src/ruby/pb/test}) + end s.files += Dir.glob('include/grpc/**/*') s.test_files = Dir.glob('src/ruby/spec/**/*') s.bindir = 'src/ruby/bin' -- cgit v1.2.3 From d18116872ae38e48697b8db55a63dbf42806d7ac Mon Sep 17 00:00:00 2001 From: ganmacs Date: Mon, 14 May 2018 18:06:28 +0900 Subject: grpc gem does not depend on googleauth --- grpc.gemspec | 2 +- templates/grpc.gemspec.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/grpc.gemspec b/grpc.gemspec index 2df1b9ee91..cd92a39af4 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -30,7 +30,6 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.add_dependency 'google-protobuf', '~> 3.1' - s.add_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0' s.add_development_dependency 'bundler', '~> 1.9' @@ -43,6 +42,7 @@ Gem::Specification.new do |s| s.add_development_dependency 'rspec', '~> 3.6' s.add_development_dependency 'rubocop', '~> 0.49.1' s.add_development_dependency 'signet', '~> 0.7.0' + s.add_development_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.extensions = %w(src/ruby/ext/grpc/extconf.rb) diff --git a/templates/grpc.gemspec.template b/templates/grpc.gemspec.template index 9945456d52..842035b664 100644 --- a/templates/grpc.gemspec.template +++ b/templates/grpc.gemspec.template @@ -32,7 +32,6 @@ s.platform = Gem::Platform::RUBY s.add_dependency 'google-protobuf', '~> 3.1' - s.add_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.add_dependency 'googleapis-common-protos-types', '~> 1.0.0' s.add_development_dependency 'bundler', '~> 1.9' @@ -45,6 +44,7 @@ s.add_development_dependency 'rspec', '~> 3.6' s.add_development_dependency 'rubocop', '~> 0.49.1' s.add_development_dependency 'signet', '~> 0.7.0' + s.add_development_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.extensions = %w(src/ruby/ext/grpc/extconf.rb) -- cgit v1.2.3 From 494d65da5080e664f6c9dd2d210dce636adebea9 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Tue, 15 May 2018 00:06:04 +0200 Subject: No longer automatically fallbacking on system's OpenSSL if it only has NPN. --- Makefile | 19 ++----------------- templates/Makefile.template | 19 ++----------------- test/build/openssl-npn.c | 30 ------------------------------ 3 files changed, 4 insertions(+), 64 deletions(-) delete mode 100644 test/build/openssl-npn.c diff --git a/Makefile b/Makefile index 73b1ee054c..d2db74ca5b 100644 --- a/Makefile +++ b/Makefile @@ -501,7 +501,6 @@ endif ifeq ($(HAS_PKG_CONFIG),true) OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl -OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.5.0 protobuf CARES_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.11.0 libcares @@ -514,7 +513,6 @@ OPENSSL_LIBS = ssl crypto endif OPENSSL_ALPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) -OPENSSL_NPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) BORINGSSL_COMPILE_CHECK_CMD = $(CC) $(CPPFLAGS) -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX $(CFLAGS) -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare -Wno-implicit-fallthrough $(NO_W_EXTRA_SEMI) -o $(TMPOUT) test/build/boringssl.c $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) @@ -542,13 +540,7 @@ HAS_SYSTEM_PROTOBUF_VERIFY = $(shell $(PROTOBUF_CHECK_CMD) 2> /dev/null && echo ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_OPENSSL_ALPN ?= $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) -HAS_SYSTEM_OPENSSL_NPN = true CACHE_MK += HAS_SYSTEM_OPENSSL_ALPN = true, -else -HAS_SYSTEM_OPENSSL_NPN ?= $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false) -endif -ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) -CACHE_MK += HAS_SYSTEM_OPENSSL_NPN = true, endif HAS_SYSTEM_ZLIB ?= $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_SYSTEM_ZLIB),true) @@ -565,7 +557,6 @@ endif else # override system libraries if the config requires a custom compiled library HAS_SYSTEM_OPENSSL_ALPN = false -HAS_SYSTEM_OPENSSL_NPN = false HAS_SYSTEM_ZLIB = false HAS_SYSTEM_PROTOBUF = false HAS_SYSTEM_CARES = false @@ -712,12 +703,7 @@ ifneq ($(HAS_EMBEDDED_OPENSSL_ALPN),false) EMBED_OPENSSL ?= $(HAS_EMBEDDED_OPENSSL_ALPN) NO_SECURE ?= false else # HAS_EMBEDDED_OPENSSL_ALPN=false -ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) -EMBED_OPENSSL ?= false -NO_SECURE ?= false -else NO_SECURE ?= true -endif # HAS_SYSTEM_OPENSSL_NPN=true endif # HAS_EMBEDDED_OPENSSL_ALPN endif # HAS_SYSTEM_OPENSSL_ALPN @@ -751,10 +737,10 @@ LDFLAGS := $(LDFLAGS_OPENSSL_PKG_CONFIG) $(LDFLAGS) else # HAS_PKG_CONFIG=false LIBS_SECURE = $(OPENSSL_LIBS) endif # HAS_PKG_CONFIG -ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) +ifeq ($(DISABLE_ALPN),true) CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 LIBS_SECURE = $(OPENSSL_LIBS) -endif # HAS_SYSTEM_OPENSSL_NPN +endif # DISABLE_ALPN PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) endif # EMBED_OPENSSL endif # NO_SECURE @@ -1341,7 +1327,6 @@ uri_fuzzer_test_one_entry: $(BINDIR)/$(CONFIG)/uri_fuzzer_test_one_entry run_dep_checks: $(OPENSSL_ALPN_CHECK_CMD) || true - $(OPENSSL_NPN_CHECK_CMD) || true $(ZLIB_CHECK_CMD) || true $(PERFTOOLS_CHECK_CMD) || true $(PROTOBUF_CHECK_CMD) || true diff --git a/templates/Makefile.template b/templates/Makefile.template index 354f2a2f40..2ca0cbc999 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -414,7 +414,6 @@ ifeq ($(HAS_PKG_CONFIG),true) OPENSSL_ALPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.2 openssl - OPENSSL_NPN_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.0.1 openssl ZLIB_CHECK_CMD = $(PKG_CONFIG) --exists zlib PROTOBUF_CHECK_CMD = $(PKG_CONFIG) --atleast-version=3.5.0 protobuf CARES_CHECK_CMD = $(PKG_CONFIG) --atleast-version=1.11.0 libcares @@ -427,7 +426,6 @@ endif OPENSSL_ALPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-alpn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) - OPENSSL_NPN_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/openssl-npn.c $(addprefix -l, $(OPENSSL_LIBS)) $(LDFLAGS) BORINGSSL_COMPILE_CHECK_CMD = $(CC) $(CPPFLAGS) ${defaults.boringssl.CPPFLAGS} $(CFLAGS) ${defaults.boringssl.CFLAGS} -o $(TMPOUT) test/build/boringssl.c $(LDFLAGS) ZLIB_CHECK_CMD = $(CC) $(CPPFLAGS) $(CFLAGS) -o $(TMPOUT) test/build/zlib.c -lz $(LDFLAGS) PROTOBUF_CHECK_CMD = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS) @@ -455,13 +453,7 @@ ifndef REQUIRE_CUSTOM_LIBRARIES_$(CONFIG) HAS_SYSTEM_OPENSSL_ALPN ?= $(shell $(OPENSSL_ALPN_CHECK_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_SYSTEM_OPENSSL_ALPN),true) - HAS_SYSTEM_OPENSSL_NPN = true CACHE_MK += HAS_SYSTEM_OPENSSL_ALPN = true, - else - HAS_SYSTEM_OPENSSL_NPN ?= $(shell $(OPENSSL_NPN_CHECK_CMD) 2> /dev/null && echo true || echo false) - endif - ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) - CACHE_MK += HAS_SYSTEM_OPENSSL_NPN = true, endif HAS_SYSTEM_ZLIB ?= $(shell $(ZLIB_CHECK_CMD) 2> /dev/null && echo true || echo false) ifeq ($(HAS_SYSTEM_ZLIB),true) @@ -478,7 +470,6 @@ else # override system libraries if the config requires a custom compiled library HAS_SYSTEM_OPENSSL_ALPN = false - HAS_SYSTEM_OPENSSL_NPN = false HAS_SYSTEM_ZLIB = false HAS_SYSTEM_PROTOBUF = false HAS_SYSTEM_CARES = false @@ -625,12 +616,7 @@ EMBED_OPENSSL ?= $(HAS_EMBEDDED_OPENSSL_ALPN) NO_SECURE ?= false else # HAS_EMBEDDED_OPENSSL_ALPN=false - ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) - EMBED_OPENSSL ?= false - NO_SECURE ?= false - else NO_SECURE ?= true - endif # HAS_SYSTEM_OPENSSL_NPN=true endif # HAS_EMBEDDED_OPENSSL_ALPN endif # HAS_SYSTEM_OPENSSL_ALPN @@ -664,10 +650,10 @@ else # HAS_PKG_CONFIG=false LIBS_SECURE = $(OPENSSL_LIBS) endif # HAS_PKG_CONFIG - ifeq ($(HAS_SYSTEM_OPENSSL_NPN),true) + ifeq ($(DISABLE_ALPN),true) CPPFLAGS += -DTSI_OPENSSL_ALPN_SUPPORT=0 LIBS_SECURE = $(OPENSSL_LIBS) - endif # HAS_SYSTEM_OPENSSL_NPN + endif # DISABLE_ALPN PC_LIBS_SECURE = $(addprefix -l, $(LIBS_SECURE)) endif # EMBED_OPENSSL endif # NO_SECURE @@ -888,7 +874,6 @@ run_dep_checks: $(OPENSSL_ALPN_CHECK_CMD) || true - $(OPENSSL_NPN_CHECK_CMD) || true $(ZLIB_CHECK_CMD) || true $(PERFTOOLS_CHECK_CMD) || true $(PROTOBUF_CHECK_CMD) || true diff --git a/test/build/openssl-npn.c b/test/build/openssl-npn.c deleted file mode 100644 index 9c71382720..0000000000 --- a/test/build/openssl-npn.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * 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 is just a compilation test, to see if we have a version of OpenSSL with - NPN support installed. It's not meant to be run, and all of the values and - function calls there are non-sensical. The code is only meant to test the - presence of symbols, and we're expecting a compilation failure otherwise. */ - -#include -#include - -int main() { - SSL_get0_next_proto_negotiated(NULL, NULL, NULL); - return OPENSSL_NPN_UNSUPPORTED; -} -- cgit v1.2.3 From 97c293226093df88b74f181402aedc7ac7a4f165 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Mon, 14 May 2018 10:25:03 -0700 Subject: Install futures package only on Python 2 --- requirements.txt | 1 - src/python/grpcio_tests/setup.py | 5 ++++- tools/run_tests/artifacts/build_artifact_python.sh | 6 ++++++ tools/run_tests/helper_scripts/build_python.sh | 8 +++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 53768c6822..0a7f2e8601 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,6 @@ coverage>=4.0 cython>=0.27 enum34>=1.0.4 -futures>=2.2.0 protobuf>=3.5.0.post1 six>=1.10 wheel>=0.29 diff --git a/src/python/grpcio_tests/setup.py b/src/python/grpcio_tests/setup.py index 98ac19d188..1262e48571 100644 --- a/src/python/grpcio_tests/setup.py +++ b/src/python/grpcio_tests/setup.py @@ -37,13 +37,16 @@ PACKAGE_DIRECTORIES = { } INSTALL_REQUIRES = ( - 'coverage>=4.0', 'enum34>=1.0.4', 'futures>=2.2.0', + 'coverage>=4.0', 'enum34>=1.0.4', 'grpcio>={version}'.format(version=grpc_version.VERSION), 'grpcio-tools>={version}'.format(version=grpc_version.VERSION), 'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION), 'oauth2client>=1.4.7', 'protobuf>=3.5.2.post1', 'six>=1.10', 'google-auth>=1.0.0', 'requests>=2.14.2') +if not PY3: + INSTALL_REQUIRES += ('futures>=2.2.0',) + COMMAND_CLASS = { # Run `preprocess` *before* doing any packaging! 'preprocess': commands.GatherProto, diff --git a/tools/run_tests/artifacts/build_artifact_python.sh b/tools/run_tests/artifacts/build_artifact_python.sh index cd794a1391..846a415396 100755 --- a/tools/run_tests/artifacts/build_artifact_python.sh +++ b/tools/run_tests/artifacts/build_artifact_python.sh @@ -90,6 +90,12 @@ fi if [ "$GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS" != "" ] then "${PIP}" install -rrequirements.txt + + if [ "$("$PYTHON" -c "import sys; print(sys.version_info[0])")" == "2" ] + then + "${PIP}" install futures>=2.2.0 + fi + "${PIP}" install grpcio --no-index --find-links "file://$ARTIFACT_DIR/" "${PIP}" install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/" diff --git a/tools/run_tests/helper_scripts/build_python.sh b/tools/run_tests/helper_scripts/build_python.sh index b0a6f0f4d4..52d5a61165 100755 --- a/tools/run_tests/helper_scripts/build_python.sh +++ b/tools/run_tests/helper_scripts/build_python.sh @@ -166,7 +166,13 @@ esac $VENV_PYTHON -m pip install --upgrade pip==10.0.1 $VENV_PYTHON -m pip install setuptools $VENV_PYTHON -m pip install cython -$VENV_PYTHON -m pip install six enum34 protobuf futures +$VENV_PYTHON -m pip install six enum34 protobuf + +if [ "$("$VENV_PYTHON" -c "import sys; print(sys.version_info[0])")" == "2" ] +then + $VENV_PYTHON -m pip install futures +fi + pip_install_dir "$ROOT" $VENV_PYTHON "$ROOT/tools/distrib/python/make_grpcio_tools.py" -- cgit v1.2.3 From a0636f040a6cc7b837d9cf7ab399179aa729e213 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Mon, 14 May 2018 22:41:41 -0700 Subject: Bump v1.12.x to v1.12.0 --- BUILD | 4 ++-- build.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/BUILD b/BUILD index cb68b3d0f5..457c5f60ee 100644 --- a/BUILD +++ b/BUILD @@ -66,9 +66,9 @@ config_setting( # This should be updated along with build.yaml g_stands_for = "glorious" -core_version = "6.0.0-pre1" +core_version = "6.0.0" -version = "1.12.0-pre1" +version = "1.12.0" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/build.yaml b/build.yaml index 48eee9e77f..115f9e7fc9 100644 --- a/build.yaml +++ b/build.yaml @@ -12,9 +12,9 @@ settings: '#08': Use "-preN" suffixes to identify pre-release versions '#09': Per-language overrides are possible with (eg) ruby_version tag here '#10': See the expand_version.py for all the quirks here - core_version: 6.0.0-pre1 + core_version: 6.0.0 g_stands_for: glorious - version: 1.12.0-pre1 + version: 1.12.0 filegroups: - name: alts_proto headers: -- cgit v1.2.3 From 4ecc5d8225376fbaf2577d83d8cf7fd348ece5c2 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Mon, 14 May 2018 22:42:39 -0700 Subject: Regenerate projects --- CMakeLists.txt | 2 +- Makefile | 6 +++--- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 8 ++++---- src/core/lib/surface/version.cc | 2 +- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 2 +- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 4 ++-- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- tools/doxygen/Doxyfile.core | 2 +- tools/doxygen/Doxyfile.core.internal | 2 +- 31 files changed, 39 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b49a4ba8a..f58ee194f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.12.0-pre1") +set(PACKAGE_VERSION "1.12.0") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index d2db74ca5b..a7f0c7d6f3 100644 --- a/Makefile +++ b/Makefile @@ -420,9 +420,9 @@ E = @echo Q = @ endif -CORE_VERSION = 6.0.0-pre1 -CPP_VERSION = 1.12.0-pre1 -CSHARP_VERSION = 1.12.0-pre1 +CORE_VERSION = 6.0.0 +CPP_VERSION = 1.12.0 +CSHARP_VERSION = 1.12.0 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index c98d6683a4..6ad71e9221 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.12.0-pre1' + # version = '1.12.0' version = '0.0.2' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.12.0-pre1' + grpc_version = '1.12.0' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index b846c4c5a6..5409f4bd2e 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.12.0-pre1' + version = '1.12.0' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index a7ada84a10..27e1c9458b 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.12.0-pre1' + version = '1.12.0' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index f96a1330e1..bf57d318c7 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.12.0-pre1' + version = '1.12.0' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index a0079f5d61..730cd4908a 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.12.0-pre1' + version = '1.12.0' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index 8ebe6c00e7..6ce9bd177f 100644 --- a/package.xml +++ b/package.xml @@ -13,12 +13,12 @@ 2018-01-19 - 1.12.0RC1 - 1.12.0RC1 + 1.12.0 + 1.12.0 - beta - beta + stable + stable Apache 2.0 diff --git a/src/core/lib/surface/version.cc b/src/core/lib/surface/version.cc index 3cc06014ee..b8d6a2c466 100644 --- a/src/core/lib/surface/version.cc +++ b/src/core/lib/surface/version.cc @@ -23,6 +23,6 @@ #include -const char* grpc_version_string(void) { return "6.0.0-pre1"; } +const char* grpc_version_string(void) { return "6.0.0"; } const char* grpc_g_stands_for(void) { return "glorious"; } diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 50fc644190..61a9f9fa53 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.12.0-pre1"; } +grpc::string Version() { return "1.12.0"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index 253d69e4cd..d11510440e 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.12.0-pre1 + 1.12.0 3.5.1 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 2d02050cae..56af8884bc 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -38,6 +38,6 @@ namespace Grpc.Core /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.12.0-pre1"; + public const string CurrentVersion = "1.12.0"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index bfb2ccb301..be895a32dd 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.12.0-pre1 +set VERSION=1.12.0 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index a9a02ab021..fc17da3e25 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -45,7 +45,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.12.0-pre1" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.12.0-pre1" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.12.0" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.12.0" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index 6cb792c4ce..f4a181655b 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.12.0-pre1' + v = '1.12.0' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index e602d8f9eb..41f0992686 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.12.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.12.0" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index ef73f71ae0..8073888f76 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.12.0-pre1" -#define GRPC_C_VERSION_STRING @"6.0.0-pre1" +#define GRPC_OBJC_VERSION_STRING @"1.12.0" +#define GRPC_C_VERSION_STRING @"6.0.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 85a7a62244..33a1d75cb6 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.12.0RC1" +#define PHP_GRPC_VERSION "1.12.0" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index 9b4187a529..2742d5f06d 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.12.0rc1""" +__version__ = """1.12.0""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 48b6aff885..0b36438551 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.12.0rc1' +VERSION = '1.12.0' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 50b51e9b0a..4942c78980 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.12.0rc1' +VERSION = '1.12.0' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index b4c7eeca6a..35b20734dd 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.12.0rc1' +VERSION = '1.12.0' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 8edd988386..24296d2fe5 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.12.0rc1' +VERSION = '1.12.0' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index 889a040d28..f303e53010 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.12.0rc1' +VERSION = '1.12.0' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index e2375b46de..d949bf5e27 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.12.0.pre1' + VERSION = '1.12.0' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index 871faaca91..c56568a206 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.12.0.pre1' + VERSION = '1.12.0' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index 28ffe7c824..e9430a0f21 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.12.0rc1' +VERSION = '1.12.0' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 9ad47e9cab..77ae01d82d 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.12.0-pre1 +PROJECT_NUMBER = 1.12.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 326ecd468b..07350d57fd 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.12.0-pre1 +PROJECT_NUMBER = 1.12.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core index 36c6550baf..695225d6c1 100644 --- a/tools/doxygen/Doxyfile.core +++ b/tools/doxygen/Doxyfile.core @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.0-pre1 +PROJECT_NUMBER = 6.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 0c874a7dc9..b35c442f76 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC Core" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 6.0.0-pre1 +PROJECT_NUMBER = 6.0.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- cgit v1.2.3 From 47cf9906c75cf82f6e70eb7b5814df26d9fa6f36 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 10 May 2018 14:15:21 +0200 Subject: update C# distribtests --- .../csharp/DistribTest/DistribTest.project.json | 11 --------- .../csharp/DistribTest/DistribTestDotNet.csproj | 27 ++++++++++++++++++++++ test/distrib/csharp/DistribTest/project.json | 22 ------------------ test/distrib/csharp/run_distrib_test.sh | 5 ---- test/distrib/csharp/run_distrib_test_dotnetcli.sh | 17 ++++++++------ test/distrib/csharp/update_version.sh | 2 +- .../distribtest/csharp_ubuntu1404_x64/Dockerfile | 5 +--- 7 files changed, 39 insertions(+), 50 deletions(-) delete mode 100644 test/distrib/csharp/DistribTest/DistribTest.project.json create mode 100644 test/distrib/csharp/DistribTest/DistribTestDotNet.csproj delete mode 100644 test/distrib/csharp/DistribTest/project.json diff --git a/test/distrib/csharp/DistribTest/DistribTest.project.json b/test/distrib/csharp/DistribTest/DistribTest.project.json deleted file mode 100644 index 422545ea8f..0000000000 --- a/test/distrib/csharp/DistribTest/DistribTest.project.json +++ /dev/null @@ -1,11 +0,0 @@ -// This file exists only to prevent VS2015 from mistakenly picking up -// project.json file when building .csproj project. -// See https://github.com/Microsoft/msbuild/issues/394 -{ - "frameworks": { - "net45": { } - }, - "runtimes": { - "win": { } - } -} diff --git a/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj b/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj new file mode 100644 index 0000000000..f16a0f9959 --- /dev/null +++ b/test/distrib/csharp/DistribTest/DistribTestDotNet.csproj @@ -0,0 +1,27 @@ + + + + Exe + netcoreapp1.0;net45 + false + false + false + false + false + false + false + + + + + + + + + + + /usr/lib/mono/4.5-api + /usr/local/lib/mono/4.5-api + /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/4.5-api + + \ No newline at end of file diff --git a/test/distrib/csharp/DistribTest/project.json b/test/distrib/csharp/DistribTest/project.json deleted file mode 100644 index 09266e5d4d..0000000000 --- a/test/distrib/csharp/DistribTest/project.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "buildOptions": { - "emitEntryPoint": true - }, - "dependencies": { - "Grpc.Auth": "__GRPC_NUGET_VERSION__", - "Grpc.Core": "__GRPC_NUGET_VERSION__", - // Necessary for native deps to get copied correctly. - "Microsoft.NETCore.Platforms": "1.0.1" - }, - "frameworks": { - "net45": { }, - "netcoreapp1.0": { - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} diff --git a/test/distrib/csharp/run_distrib_test.sh b/test/distrib/csharp/run_distrib_test.sh index b96872725e..eee24d0e57 100755 --- a/test/distrib/csharp/run_distrib_test.sh +++ b/test/distrib/csharp/run_distrib_test.sh @@ -21,11 +21,6 @@ unzip -o "$EXTERNAL_GIT_ROOT/input_artifacts/csharp_nugets_windows_dotnetcli.zip ./update_version.sh auto -# With a recent-enough version of mono, the "nuget restore" command would -# restore packages based on project.json files, but we want to restore packages -# based on the net45 legacy "packages.config" file instead. -rm DistribTest/*project.json - nuget restore xbuild DistribTest.sln diff --git a/test/distrib/csharp/run_distrib_test_dotnetcli.sh b/test/distrib/csharp/run_distrib_test_dotnetcli.sh index 9e31945dfb..86c2d5231e 100755 --- a/test/distrib/csharp/run_distrib_test_dotnetcli.sh +++ b/test/distrib/csharp/run_distrib_test_dotnetcli.sh @@ -25,19 +25,22 @@ cd DistribTest # TODO(jtattermusch): make sure we don't pollute the global nuget cache with # the nugets being tested. -dotnet restore +dotnet restore DistribTestDotNet.csproj -dotnet build -dotnet publish +dotnet build DistribTestDotNet.csproj +dotnet publish -f netcoreapp1.0 DistribTestDotNet.csproj +dotnet publish -f net45 DistribTestDotNet.csproj + +ls -R bin # .NET 4.5 target after dotnet build -mono bin/Debug/net45/*-x64/DistribTest.exe +mono bin/Debug/net45/publish/DistribTestDotNet.exe # .NET 4.5 target after dotnet publish -mono bin/Debug/net45/*-x64/publish/DistribTest.exe +mono bin/Debug/net45/publish/DistribTestDotNet.exe # .NET Core target after dotnet build -dotnet exec bin/Debug/netcoreapp1.0/DistribTest.dll +dotnet exec bin/Debug/netcoreapp1.0/DistribTestDotNet.dll # .NET Core target after dotnet publish -dotnet exec bin/Debug/netcoreapp1.0/publish/DistribTest.dll +dotnet exec bin/Debug/netcoreapp1.0/publish/DistribTestDotNet.dll diff --git a/test/distrib/csharp/update_version.sh b/test/distrib/csharp/update_version.sh index 734ec21ba2..9759cc5648 100755 --- a/test/distrib/csharp/update_version.sh +++ b/test/distrib/csharp/update_version.sh @@ -28,4 +28,4 @@ then fi # Replaces version placeholder with value provided as first argument. -sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/packages.config DistribTest/DistribTest.csproj DistribTest/project.json +sed -ibak "s/__GRPC_NUGET_VERSION__/${CSHARP_VERSION}/g" DistribTest/packages.config DistribTest/DistribTest.csproj DistribTest/DistribTestDotNet.csproj diff --git a/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile b/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile index 4bd3763370..10279c5925 100644 --- a/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile +++ b/tools/dockerfile/distribtest/csharp_ubuntu1404_x64/Dockerfile @@ -22,16 +22,13 @@ RUN apt-get update && apt-get install -y \ ca-certificates-mono \ nuget -# make sure we have nuget 2.12+ (in case there's an older cached docker image) -RUN apt-get update && apt-get install -y nuget - RUN apt-get update && apt-get install -y unzip # Install dotnet CLI RUN apt-get install -y apt-transport-https RUN sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list' RUN apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 -RUN apt-get update && apt-get install -y dotnet-dev-1.0.0-preview2-003121 +RUN apt-get update && apt-get install -y dotnet-dev-1.0.4 # Trigger the population of the local package cache for dotnet CLI RUN mkdir warmup \ -- cgit v1.2.3 From 30ce693621d61efb8596503a0da212077a8c4daa Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Thu, 24 May 2018 17:12:13 +0200 Subject: Allow building the python module with system openssl When building the python module and using the new GRPC_PYTHON_BUILD_SYSTEM_OPENSSL env variable, the third party boringssl code is not compiled. Instead, the openssl shared library installed on the system is used during runtime. This is useful for distributions who don't want to include code copies but use shared libraries instead. --- setup.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 99d1a1c504..3a5ed56c64 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ egg_info.manifest_maker.template = 'PYTHON-MANIFEST.in' PY3 = sys.version_info.major == 3 PYTHON_STEM = os.path.join('src', 'python', 'grpcio') CORE_INCLUDE = ('include', '.',) -BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) +SSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) CARES_INCLUDE = ( os.path.join('third_party', 'cares'), @@ -84,6 +84,12 @@ CLASSIFIERS = [ # present, then it will still attempt to use Cython. BUILD_WITH_CYTHON = os.environ.get('GRPC_PYTHON_BUILD_WITH_CYTHON', False) +# Export this variable to use the system installation of openssl. You need to +# have the header files installed (in /usr/include/openssl) and during +# runtime, the shared libary must be installed +BUILD_WITH_SYSTEM_OPENSSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL', + False) + # Environment variable to determine whether or not to enable coverage analysis # in Cython modules. ENABLE_CYTHON_TRACING = os.environ.get( @@ -148,8 +154,13 @@ CORE_C_FILES = tuple(grpc_core_dependencies.CORE_SOURCE_FILES) if "win32" in sys.platform: CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES) +if BUILD_WITH_SYSTEM_OPENSSL: + CORE_C_FILES = filter(lambda x: 'third_party/boringssl' not in x, CORE_C_FILES) + CORE_C_FILES = filter(lambda x: 'src/boringssl' not in x, CORE_C_FILES) + SSL_INCLUDE = (os.path.join('/usr', 'include', 'openssl'),) + EXTENSION_INCLUDE_DIRECTORIES = ( - (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE + + (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE + CARES_INCLUDE + ADDRESS_SORTING_INCLUDE) EXTENSION_LIBRARIES = () @@ -159,6 +170,8 @@ if not "win32" in sys.platform: EXTENSION_LIBRARIES += ('m',) if "win32" in sys.platform: EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',) +if BUILD_WITH_SYSTEM_OPENSSL: + EXTENSION_LIBRARIES += ('ssl', 'crypto',) DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), -- cgit v1.2.3 From 64ab89928c603601492986c2cd82e1ee1e3d5939 Mon Sep 17 00:00:00 2001 From: ganmacs Date: Tue, 15 May 2018 10:35:53 +0900 Subject: Put Gemfile for sub-directory of pubsub examples/ruby/greeter*.rb and examples/ruby/route_guide/*.rb doesn't need to depends on googleauth --- examples/ruby/grpc-demo.gemspec | 1 - examples/ruby/pubsub/.gitignore | 15 +++++++++++++++ examples/ruby/pubsub/Gemfile | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 examples/ruby/pubsub/.gitignore create mode 100644 examples/ruby/pubsub/Gemfile diff --git a/examples/ruby/grpc-demo.gemspec b/examples/ruby/grpc-demo.gemspec index c77446249e..4423fd34d4 100644 --- a/examples/ruby/grpc-demo.gemspec +++ b/examples/ruby/grpc-demo.gemspec @@ -18,7 +18,6 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.add_dependency 'grpc', '~> 1.0' - s.add_dependency 'googleauth', '>= 0.5.1', '< 0.7' s.add_development_dependency 'bundler', '~> 1.7' end diff --git a/examples/ruby/pubsub/.gitignore b/examples/ruby/pubsub/.gitignore new file mode 100644 index 0000000000..62fcb4fa94 --- /dev/null +++ b/examples/ruby/pubsub/.gitignore @@ -0,0 +1,15 @@ +/.bundle/ +/.yardoc +/Gemfile.lock +/_yardoc/ +/coverage/ +/doc/ +/pkg/ +/spec/reports/ +/tmp/ +*.bundle +*.so +*.o +*.a +mkmf.log +vendor diff --git a/examples/ruby/pubsub/Gemfile b/examples/ruby/pubsub/Gemfile new file mode 100644 index 0000000000..4ee8ffe3d6 --- /dev/null +++ b/examples/ruby/pubsub/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org/' + +gem 'grpc', '~> 1.0' +gem 'googleauth', '>= 0.5.1', '< 0.7' -- cgit v1.2.3 From 3823d9048102bce79e165584c62a1a5b91810aeb Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Fri, 25 May 2018 06:52:23 +0200 Subject: Allow building the python module with system zlib When building the python module and using the new GRPC_PYTHON_BUILD_SYSTEM_ZLIB env variable, the third party zlib code is not compiled. Instead, the zlib shared library installed on the system is used during runtime. This is useful for distributions who don't want to include code copies but use shared libraries instead. --- setup.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/setup.py b/setup.py index 3a5ed56c64..483d3ac168 100644 --- a/setup.py +++ b/setup.py @@ -90,6 +90,12 @@ BUILD_WITH_CYTHON = os.environ.get('GRPC_PYTHON_BUILD_WITH_CYTHON', False) BUILD_WITH_SYSTEM_OPENSSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL', False) +# Export this variable to use the system installation of zlib. You need to +# have the header files installed (in /usr/include/) and during +# runtime, the shared libary must be installed +BUILD_WITH_SYSTEM_ZLIB = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ZLIB', + False) + # Environment variable to determine whether or not to enable coverage analysis # in Cython modules. ENABLE_CYTHON_TRACING = os.environ.get( @@ -159,6 +165,10 @@ if BUILD_WITH_SYSTEM_OPENSSL: CORE_C_FILES = filter(lambda x: 'src/boringssl' not in x, CORE_C_FILES) SSL_INCLUDE = (os.path.join('/usr', 'include', 'openssl'),) +if BUILD_WITH_SYSTEM_ZLIB: + CORE_C_FILES = filter(lambda x: 'third_party/zlib' not in x, CORE_C_FILES) + ZLIB_INCLUDE = (os.path.join('/usr', 'include'),) + EXTENSION_INCLUDE_DIRECTORIES = ( (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE + CARES_INCLUDE + ADDRESS_SORTING_INCLUDE) @@ -172,6 +182,8 @@ if "win32" in sys.platform: EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',) if BUILD_WITH_SYSTEM_OPENSSL: EXTENSION_LIBRARIES += ('ssl', 'crypto',) +if BUILD_WITH_SYSTEM_ZLIB: + EXTENSION_LIBRARIES += ('z',) DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), -- cgit v1.2.3 From 78a6e04ec1efc2dc839f0329dcff732940e27fd9 Mon Sep 17 00:00:00 2001 From: Thomas Bechtold Date: Fri, 25 May 2018 07:08:05 +0200 Subject: Allow building the python module with system cares When building the python module and using the new GRPC_PYTHON_BUILD_SYSTEM_CARES env variable, the third party cares code is not compiled. Instead, the cares shared library installed on the system is used during runtime. This is useful for distributions who don't want to include code copies but use shared libraries instead. --- setup.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/setup.py b/setup.py index 483d3ac168..43c25aafeb 100644 --- a/setup.py +++ b/setup.py @@ -96,6 +96,12 @@ BUILD_WITH_SYSTEM_OPENSSL = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_OPENSSL', BUILD_WITH_SYSTEM_ZLIB = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_ZLIB', False) +# Export this variable to use the system installation of cares. You need to +# have the header files installed (in /usr/include/) and during +# runtime, the shared libary must be installed +BUILD_WITH_SYSTEM_CARES = os.environ.get('GRPC_PYTHON_BUILD_SYSTEM_CARES', + False) + # Environment variable to determine whether or not to enable coverage analysis # in Cython modules. ENABLE_CYTHON_TRACING = os.environ.get( @@ -169,6 +175,10 @@ if BUILD_WITH_SYSTEM_ZLIB: CORE_C_FILES = filter(lambda x: 'third_party/zlib' not in x, CORE_C_FILES) ZLIB_INCLUDE = (os.path.join('/usr', 'include'),) +if BUILD_WITH_SYSTEM_CARES: + CORE_C_FILES = filter(lambda x: 'third_party/cares' not in x, CORE_C_FILES) + CARES_INCLUDE = (os.path.join('/usr', 'include'),) + EXTENSION_INCLUDE_DIRECTORIES = ( (PYTHON_STEM,) + CORE_INCLUDE + SSL_INCLUDE + ZLIB_INCLUDE + CARES_INCLUDE + ADDRESS_SORTING_INCLUDE) @@ -184,6 +194,8 @@ if BUILD_WITH_SYSTEM_OPENSSL: EXTENSION_LIBRARIES += ('ssl', 'crypto',) if BUILD_WITH_SYSTEM_ZLIB: EXTENSION_LIBRARIES += ('z',) +if BUILD_WITH_SYSTEM_CARES: + EXTENSION_LIBRARIES += ('cares',) DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), -- cgit v1.2.3 From a7edad828c9ecdde89190095b88fc4ca2c924bc2 Mon Sep 17 00:00:00 2001 From: kpayson64 Date: Fri, 25 May 2018 13:38:51 -0700 Subject: Init connect timer before calling connect --- src/core/lib/iomgr/tcp_client_custom.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/lib/iomgr/tcp_client_custom.cc b/src/core/lib/iomgr/tcp_client_custom.cc index 932c79ea0b..9389861d07 100644 --- a/src/core/lib/iomgr/tcp_client_custom.cc +++ b/src/core/lib/iomgr/tcp_client_custom.cc @@ -140,12 +140,12 @@ static void tcp_connect(grpc_closure* closure, grpc_endpoint** ep, socket, connect->addr_name); } - grpc_custom_socket_vtable->connect( - socket, (const grpc_sockaddr*)resolved_addr->addr, resolved_addr->len, - custom_connect_callback); GRPC_CLOSURE_INIT(&connect->on_alarm, on_alarm, socket, grpc_schedule_on_exec_ctx); grpc_timer_init(&connect->alarm, deadline, &connect->on_alarm); + grpc_custom_socket_vtable->connect( + socket, (const grpc_sockaddr*)resolved_addr->addr, resolved_addr->len, + custom_connect_callback); } grpc_tcp_client_vtable custom_tcp_client_vtable = {tcp_connect}; -- cgit v1.2.3 From 544dfcc5cca88188af5ea41556dc035588d1f946 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 30 May 2018 16:39:51 +0200 Subject: enable C# v1.0.1 in interop_matrix --- tools/interop_matrix/client_matrix.py | 10 +++++- .../patches/csharp_v1.0.1/git_repo.patch | 37 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch diff --git a/tools/interop_matrix/client_matrix.py b/tools/interop_matrix/client_matrix.py index 2d43e3ea12..d6a704681a 100644 --- a/tools/interop_matrix/client_matrix.py +++ b/tools/interop_matrix/client_matrix.py @@ -326,7 +326,14 @@ LANG_RELEASE_MATRIX = { }, ], 'csharp': [ - #{'v1.0.1': None}, + { + 'v1.0.1': { + 'patch': [ + 'tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile', + 'tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile', + ] + } + }, { 'v1.1.4': None }, @@ -377,6 +384,7 @@ TESTCASES_VERSION_MATRIX = { 'node_v1.4.2': 'node__v1.1.4', 'node_v1.6.6': 'node__v1.1.4', 'ruby_v1.0.1': 'ruby__v1.0.1', + 'csharp_v1.0.1': 'csharp__v1.1.4', 'csharp_v1.1.4': 'csharp__v1.1.4', 'csharp_v1.2.5': 'csharp__v1.1.4', 'python_v1.0.x': 'python__v1.0.x', diff --git a/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch b/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch new file mode 100644 index 0000000000..edc9869023 --- /dev/null +++ b/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch @@ -0,0 +1,37 @@ +diff --git a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +index da1d2c645e5..484bdfdfbbd 100644 +--- a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile ++++ b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +@@ -67,11 +67,10 @@ RUN apt-get update && apt-get install -y time && apt-get clean + # C# dependencies + + # Update to a newer version of mono +-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +-RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list ++RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF ++RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list + RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list + RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list +-RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list + + # Install dependencies + RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ +diff --git a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +index 65f67d36502..33a2e54bc1e 100644 +--- a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile ++++ b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +@@ -82,11 +82,10 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 + # C# dependencies + + # Update to a newer version of mono +-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF +-RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list ++RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF ++RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list + RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list + RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list +-RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list + + # Install dependencies + RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ + \ No newline at end of file -- cgit v1.2.3 From b6a2eeb81675de28b076fa7781a6653c7affa4e1 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 30 May 2018 17:13:32 +0200 Subject: add TODO to remove unnecessary logic --- tools/interop_matrix/run_interop_matrix_tests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/interop_matrix/run_interop_matrix_tests.py b/tools/interop_matrix/run_interop_matrix_tests.py index eb8b7d6944..9d442346a7 100755 --- a/tools/interop_matrix/run_interop_matrix_tests.py +++ b/tools/interop_matrix/run_interop_matrix_tests.py @@ -116,6 +116,10 @@ def find_all_images_for_lang(lang): return {} releases = [args.release] + # TODO(jtattermusch): why do we need to query the existing images/tags? + # From LANG_RUNTIME_MATRIX and LANG_RELEASE_MATRIX it should be obvious + # which tags we want to test - and it should be an error if they are + # missing. # Images tuples keyed by runtime. images = {} for runtime in client_matrix.LANG_RUNTIME_MATRIX[lang]: -- cgit v1.2.3 From c093a7f8a117dc88f5075b67ec5b48b48c3151ff Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 30 May 2018 17:43:56 +0200 Subject: create_matrix_images.py usability fixes --- tools/interop_matrix/create_matrix_images.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/interop_matrix/create_matrix_images.py b/tools/interop_matrix/create_matrix_images.py index ef9f6a5990..e75d309b3c 100755 --- a/tools/interop_matrix/create_matrix_images.py +++ b/tools/interop_matrix/create_matrix_images.py @@ -97,6 +97,11 @@ argp.add_argument( 'reusing the repo can cause git checkout error if you switch ' 'between releases.') +argp.add_argument( + '--upload_images', + action='store_true', + help='If set, images will be uploaded to container registry after building.') + args = argp.parse_args() @@ -166,8 +171,9 @@ def build_all_images_for_lang(lang): """Build all docker images for a language across releases and runtimes.""" if not args.git_checkout: if args.release != 'master': - print('WARNING: --release is set but will be ignored\n') - releases = ['master'] + print('Cannot use --release without also enabling --git_checkout.\n') + sys.exit(1) + releases = [args.release] else: if args.release == 'all': releases = client_matrix.get_release_tags(lang) @@ -334,8 +340,12 @@ languages = args.language if args.language != ['all'] else _LANGUAGES for lang in languages: docker_images = build_all_images_for_lang(lang) for image in docker_images: - jobset.message('START', 'Uploading %s' % image, do_newline=True) - # docker image name must be in the format /: - assert image.startswith(args.gcr_path) and image.find(':') != -1 + if args.upload_images: + jobset.message('START', 'Uploading %s' % image, do_newline=True) + # docker image name must be in the format /: + assert image.startswith(args.gcr_path) and image.find(':') != -1 + subprocess.call(['gcloud', 'docker', '--', 'push', image]) + else: + # Uploading (and overwriting images) by default can easily break things. + print('Not uploading image %s, run with --upload_images to upload.' % image) - subprocess.call(['gcloud', 'docker', '--', 'push', image]) -- cgit v1.2.3 From d851d827dd73928f044cd2c2835f58ccbc4a9acd Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Wed, 30 May 2018 18:59:51 +0200 Subject: point out complexity in create_matrix_images.py --- tools/interop_matrix/create_matrix_images.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/interop_matrix/create_matrix_images.py b/tools/interop_matrix/create_matrix_images.py index e75d309b3c..24fd0e2ea4 100755 --- a/tools/interop_matrix/create_matrix_images.py +++ b/tools/interop_matrix/create_matrix_images.py @@ -274,6 +274,13 @@ def maybe_apply_patches_on_git_tag(stack_base, lang, release): sys.exit(1) subprocess.check_output( ['git', 'apply', patch_file], cwd=stack_base, stderr=subprocess.STDOUT) + + # TODO(jtattermusch): this really would need simplification and refactoring + # - "git add" and "git commit" can easily be done in a single command + # - it looks like the only reason for the existence of the "files_to_patch" + # entry is to perform "git add" - which is clumsy and fragile. + # - we only allow a single patch with name "git_repo.patch". A better design + # would be to allow multiple patches that can have more descriptive names. for repo_relative_path in files_to_patch: subprocess.check_output( ['git', 'add', repo_relative_path], -- cgit v1.2.3 From 87f395c04d41e0ac1459745dc0a950c84033207c Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 31 May 2018 11:20:58 +0200 Subject: make docker images buildable --- .../patches/csharp_v1.0.1/git_repo.patch | 52 ++++++++++++++++++++-- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch b/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch index edc9869023..e07b9c80f8 100644 --- a/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch +++ b/tools/interop_matrix/patches/csharp_v1.0.1/git_repo.patch @@ -1,5 +1,40 @@ +diff --git a/third_party/boringssl b/third_party/boringssl +index c880e42ba1..70ef9596bb 160000 +--- a/third_party/boringssl ++++ b/third_party/boringssl +@@ -1 +1 @@ +-Subproject commit c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9 ++Subproject commit 70ef9596bbcc11353b9bb8d4e91478694dd21439 +diff --git a/third_party/gflags b/third_party/gflags +index 05b155ff59..30dbc81fb5 160000 +--- a/third_party/gflags ++++ b/third_party/gflags +@@ -1 +1 @@ +-Subproject commit 05b155ff59114735ec8cd089f669c4c3d8f59029 ++Subproject commit 30dbc81fb5ffdc98ea9b14b1918bfe4e8779b26e +diff --git a/third_party/googletest b/third_party/googletest +index c99458533a..ec44c6c167 160000 +--- a/third_party/googletest ++++ b/third_party/googletest +@@ -1 +1 @@ +-Subproject commit c99458533a9b4c743ed51537e25989ea55944908 ++Subproject commit ec44c6c1675c25b9827aacd08c02433cccde7780 +diff --git a/third_party/protobuf b/third_party/protobuf +index 1a58673508..b5fbb742af 160000 +--- a/third_party/protobuf ++++ b/third_party/protobuf +@@ -1 +1 @@ +-Subproject commit 1a586735085e817b1f52e53feec92ce418049f69 ++Subproject commit b5fbb742af122b565925987e65c08957739976a7 +diff --git a/third_party/zlib b/third_party/zlib +index 5089329162..cacf7f1d4e 160000 +--- a/third_party/zlib ++++ b/third_party/zlib +@@ -1 +1 @@ +-Subproject commit 50893291621658f355bc5b4d450a8d06a563053d ++Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f diff --git a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile -index da1d2c645e5..484bdfdfbbd 100644 +index da1d2c645e..f405994293 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharp/Dockerfile @@ -67,11 +67,10 @@ RUN apt-get update && apt-get install -y time && apt-get clean @@ -9,7 +44,7 @@ index da1d2c645e5..484bdfdfbbd 100644 -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF -+RUN echo "deb http://download.mono-project.com/repo/debian jessie main" | tee /etc/apt/sources.list.d/mono-official.list ++RUN echo "deb http://download.mono-project.com/repo/debian wheezy/snapshots/4.6 main" | tee /etc/apt/sources.list.d/official.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list -RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list @@ -17,7 +52,7 @@ index da1d2c645e5..484bdfdfbbd 100644 # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ diff --git a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile -index 65f67d36502..33a2e54bc1e 100644 +index 65f67d3650..26223753ed 100644 --- a/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile +++ b/tools/dockerfile/interoptest/grpc_interop_csharpcoreclr/Dockerfile @@ -82,11 +82,10 @@ RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 @@ -34,4 +69,13 @@ index 65f67d36502..33a2e54bc1e 100644 # Install dependencies RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ - \ No newline at end of file +@@ -99,7 +98,8 @@ RUN nuget update -self + + # Install dotnet SDK based on https://www.microsoft.com/net/core#debian + RUN apt-get update && apt-get install -y curl libunwind8 gettext +-RUN curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=809130 ++# https://github.com/dotnet/core/blob/master/release-notes/download-archives/1.0.1-preview2-download.md ++RUN curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=827530 + RUN mkdir -p /opt/dotnet && tar zxf dotnet.tar.gz -C /opt/dotnet + RUN ln -s /opt/dotnet/dotnet /usr/local/bin + -- cgit v1.2.3 From f1f456baf50330612fcc160394b2ccddb4fb7411 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 31 May 2018 11:45:44 +0200 Subject: yapf code --- tools/interop_matrix/create_matrix_images.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/interop_matrix/create_matrix_images.py b/tools/interop_matrix/create_matrix_images.py index 24fd0e2ea4..c2568efba0 100755 --- a/tools/interop_matrix/create_matrix_images.py +++ b/tools/interop_matrix/create_matrix_images.py @@ -100,7 +100,8 @@ argp.add_argument( argp.add_argument( '--upload_images', action='store_true', - help='If set, images will be uploaded to container registry after building.') + help='If set, images will be uploaded to container registry after building.' +) args = argp.parse_args() @@ -171,7 +172,8 @@ def build_all_images_for_lang(lang): """Build all docker images for a language across releases and runtimes.""" if not args.git_checkout: if args.release != 'master': - print('Cannot use --release without also enabling --git_checkout.\n') + print( + 'Cannot use --release without also enabling --git_checkout.\n') sys.exit(1) releases = [args.release] else: @@ -354,5 +356,5 @@ for lang in languages: subprocess.call(['gcloud', 'docker', '--', 'push', image]) else: # Uploading (and overwriting images) by default can easily break things. - print('Not uploading image %s, run with --upload_images to upload.' % image) - + print('Not uploading image %s, run with --upload_images to upload.' + % image) -- cgit v1.2.3 From 57139d1eefc31eebefb0a2af7ffc932ba8ded349 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 31 May 2018 08:44:58 +0200 Subject: fix C# codegen for empty service --- src/compiler/csharp_generator.cc | 12 ++- src/csharp/Grpc.Examples/MathGrpc.cs | 2 +- src/csharp/Grpc.HealthCheck/HealthGrpc.cs | 2 +- .../BenchmarkServiceGrpc.cs | 2 +- src/csharp/Grpc.IntegrationTesting/EmptyService.cs | 38 ++++++++++ .../Grpc.IntegrationTesting/EmptyServiceGrpc.cs | 85 ++++++++++++++++++++++ src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs | 2 +- .../ReportQpsScenarioServiceGrpc.cs | 2 +- src/csharp/Grpc.IntegrationTesting/TestGrpc.cs | 2 +- .../Grpc.IntegrationTesting/WorkerServiceGrpc.cs | 2 +- src/csharp/Grpc.Reflection/ReflectionGrpc.cs | 2 +- src/csharp/generate_proto_csharp.sh | 2 +- src/proto/grpc/testing/empty_service.proto | 23 ++++++ 13 files changed, 160 insertions(+), 16 deletions(-) create mode 100644 src/csharp/Grpc.IntegrationTesting/EmptyService.cs create mode 100644 src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs create mode 100644 src/proto/grpc/testing/empty_service.proto diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc index 6e2730579a..14173e0794 100644 --- a/src/compiler/csharp_generator.cc +++ b/src/compiler/csharp_generator.cc @@ -590,19 +590,16 @@ void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor* service) { out->Print("{\n"); out->Indent(); - out->Print("return grpc::ServerServiceDefinition.CreateBuilder()\n"); + out->Print("return grpc::ServerServiceDefinition.CreateBuilder()"); out->Indent(); out->Indent(); for (int i = 0; i < service->method_count(); i++) { const MethodDescriptor* method = service->method(i); - out->Print(".AddMethod($methodfield$, serviceImpl.$methodname$)", + out->Print("\n.AddMethod($methodfield$, serviceImpl.$methodname$)", "methodfield", GetMethodFieldName(method), "methodname", method->name()); - if (i == service->method_count() - 1) { - out->Print(".Build();"); - } - out->Print("\n"); } + out->Print(".Build();\n"); out->Outdent(); out->Outdent(); @@ -676,7 +673,8 @@ grpc::string GetServices(const FileDescriptor* file, bool generate_client, out.PrintRaw(leading_comments.c_str()); } - out.Print("#pragma warning disable 1591\n"); + out.Print("#pragma warning disable 0414, 1591\n"); + out.Print("#region Designer generated code\n"); out.Print("\n"); out.Print("using grpc = global::Grpc.Core;\n"); diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs index 045708b947..a4739da81d 100644 --- a/src/csharp/Grpc.Examples/MathGrpc.cs +++ b/src/csharp/Grpc.Examples/MathGrpc.cs @@ -17,7 +17,7 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs index a26f483981..ebd890e48d 100644 --- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs +++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs @@ -20,7 +20,7 @@ // The canonical version of this proto can be found at // https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto // -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs index 20b933fdfa..e2a4b93cef 100644 --- a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceGrpc.cs @@ -19,7 +19,7 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/EmptyService.cs b/src/csharp/Grpc.IntegrationTesting/EmptyService.cs new file mode 100644 index 0000000000..e9fe5b79ef --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/EmptyService.cs @@ -0,0 +1,38 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/proto/grpc/testing/empty_service.proto +// +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Grpc.Testing { + + /// Holder for reflection information generated from src/proto/grpc/testing/empty_service.proto + public static partial class EmptyServiceReflection { + + #region Descriptor + /// File descriptor for src/proto/grpc/testing/empty_service.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static EmptyServiceReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CipzcmMvcHJvdG8vZ3JwYy90ZXN0aW5nL2VtcHR5X3NlcnZpY2UucHJvdG8S", + "DGdycGMudGVzdGluZzIOCgxFbXB0eVNlcnZpY2ViBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, null)); + } + #endregion + + } +} + +#endregion Designer generated code diff --git a/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs new file mode 100644 index 0000000000..2d233fbdc0 --- /dev/null +++ b/src/csharp/Grpc.IntegrationTesting/EmptyServiceGrpc.cs @@ -0,0 +1,85 @@ +// +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: src/proto/grpc/testing/empty_service.proto +// +// Original file comments: +// Copyright 2018 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. +// +#pragma warning disable 0414, 1591 +#region Designer generated code + +using grpc = global::Grpc.Core; + +namespace Grpc.Testing { + /// + /// A service that has zero methods. + /// See https://github.com/grpc/grpc/issues/15574 + /// + public static partial class EmptyService + { + static readonly string __ServiceName = "grpc.testing.EmptyService"; + + + /// Service descriptor + public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor + { + get { return global::Grpc.Testing.EmptyServiceReflection.Descriptor.Services[0]; } + } + + /// Base class for server-side implementations of EmptyService + public abstract partial class EmptyServiceBase + { + } + + /// Client for EmptyService + public partial class EmptyServiceClient : grpc::ClientBase + { + /// Creates a new client for EmptyService + /// The channel to use to make remote calls. + public EmptyServiceClient(grpc::Channel channel) : base(channel) + { + } + /// Creates a new client for EmptyService that uses a custom CallInvoker. + /// The callInvoker to use to make remote calls. + public EmptyServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker) + { + } + /// Protected parameterless constructor to allow creation of test doubles. + protected EmptyServiceClient() : base() + { + } + /// Protected constructor to allow creation of configured clients. + /// The client configuration. + protected EmptyServiceClient(ClientBaseConfiguration configuration) : base(configuration) + { + } + + /// Creates a new instance of client from given ClientBaseConfiguration. + protected override EmptyServiceClient NewInstance(ClientBaseConfiguration configuration) + { + return new EmptyServiceClient(configuration); + } + } + + /// Creates service definition that can be registered with a server + /// An object implementing the server-side handling logic. + public static grpc::ServerServiceDefinition BindService(EmptyServiceBase serviceImpl) + { + return grpc::ServerServiceDefinition.CreateBuilder().Build(); + } + + } +} +#endregion diff --git a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs index d18b9e7d5e..e8c566e167 100644 --- a/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/MetricsGrpc.cs @@ -23,7 +23,7 @@ // Currently, 'Gauge' (i.e a metric that represents the measured value of // something at an instant of time) is the only metric type supported by the // service. -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs index c9c6f75c8c..60a3890f21 100644 --- a/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/ReportQpsScenarioServiceGrpc.cs @@ -19,7 +19,7 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs index 6c4b77f7ac..aec4ce7be7 100644 --- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs @@ -20,7 +20,7 @@ // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. // -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs index ede3ace461..85f2cfd871 100644 --- a/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs +++ b/src/csharp/Grpc.IntegrationTesting/WorkerServiceGrpc.cs @@ -19,7 +19,7 @@ // // An integration test service that covers all the method signature permutations // of unary/streaming requests/responses. -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs index e2263cfc90..387c9fb52f 100644 --- a/src/csharp/Grpc.Reflection/ReflectionGrpc.cs +++ b/src/csharp/Grpc.Reflection/ReflectionGrpc.cs @@ -19,7 +19,7 @@ // // Service exported by server reflection // -#pragma warning disable 1591 +#pragma warning disable 0414, 1591 #region Designer generated code using grpc = global::Grpc.Core; diff --git a/src/csharp/generate_proto_csharp.sh b/src/csharp/generate_proto_csharp.sh index 1a38f860e8..e79728ff95 100755 --- a/src/csharp/generate_proto_csharp.sh +++ b/src/csharp/generate_proto_csharp.sh @@ -42,4 +42,4 @@ $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR/CoreStats --grpc_out=$TESTING # don't match the package names. Setting -I to the correct value src/proto # breaks the code generation. $PROTOC --plugin=$PLUGIN --csharp_out=$TESTING_DIR --grpc_out=$TESTING_DIR \ - -I . src/proto/grpc/testing/{control,echo_messages,empty,messages,metrics,payloads,benchmark_service,report_qps_scenario_service,worker_service,stats,test}.proto + -I . src/proto/grpc/testing/{control,echo_messages,empty,empty_service,messages,metrics,payloads,benchmark_service,report_qps_scenario_service,worker_service,stats,test}.proto diff --git a/src/proto/grpc/testing/empty_service.proto b/src/proto/grpc/testing/empty_service.proto new file mode 100644 index 0000000000..157629b7a4 --- /dev/null +++ b/src/proto/grpc/testing/empty_service.proto @@ -0,0 +1,23 @@ + +// Copyright 2018 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +syntax = "proto3"; + +package grpc.testing; + +// A service that has zero methods. +// See https://github.com/grpc/grpc/issues/15574 +service EmptyService { +} -- cgit v1.2.3 From 38689e65871aa69daff19761ef25768a8142c3aa Mon Sep 17 00:00:00 2001 From: Augie Fackler Date: Thu, 31 May 2018 17:07:13 -0400 Subject: Python: wordsmith documentation on Server.stop() @nathanielmanistaatgoogle and I just had a good session helping me figure out how to use this API correctly, and this rewording of the documentation was the result. --- src/python/grpcio/grpc/__init__.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/python/grpcio/grpc/__init__.py b/src/python/grpcio/grpc/__init__.py index b7ed0c8563..0f31119467 100644 --- a/src/python/grpcio/grpc/__init__.py +++ b/src/python/grpcio/grpc/__init__.py @@ -1250,19 +1250,20 @@ class Server(six.with_metaclass(abc.ABCMeta)): """Stops this Server. This method immediately stop service of new RPCs in all cases. + If a grace period is specified, this method returns immediately and all RPCs active at the end of the grace period are aborted. - - If a grace period is not specified, then all existing RPCs are - teriminated immediately and the this method blocks until the last - RPC handler terminates. + If a grace period is not specified (by passing None for `grace`), + all existing RPCs are aborted immediately and this method + blocks until the last RPC handler terminates. This method is idempotent and may be called at any time. - Passing a smaller grace value in subsequent call will have - the effect of stopping the Server sooner. Passing a larger - grace value in subsequent call *will not* have the effect of - stopping the server later (i.e. the most restrictive grace - value is used). + Passing a smaller grace value in a subsequent call will have + the effect of stopping the Server sooner (passing None will + have the effect of stopping the server immediately). Passing + a larger grace value in a subsequent call *will not* have the + effect of stopping the server later (i.e. the most restrictive + grace value is used). Args: grace: A duration of time in seconds or None. -- cgit v1.2.3 From 3bd4b935ee59ff8347530694b1d527523d0e4e30 Mon Sep 17 00:00:00 2001 From: kpayson64 Date: Thu, 31 May 2018 14:32:49 -0700 Subject: Ref tcp server under lock --- src/core/ext/transport/chttp2/server/chttp2_server.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index 687cc483f6..3f8a26ae32 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -179,8 +179,8 @@ static void on_accept(void* arg, grpc_endpoint* tcp, grpc_handshake_manager* handshake_mgr = grpc_handshake_manager_create(); grpc_handshake_manager_pending_list_add(&state->pending_handshake_mgrs, handshake_mgr); - gpr_mu_unlock(&state->mu); grpc_tcp_server_ref(state->tcp_server); + gpr_mu_unlock(&state->mu); server_connection_state* connection_state = static_cast( gpr_zalloc(sizeof(*connection_state))); -- cgit v1.2.3 From 0647b03296069af48cc79f0aca3719610ff178b0 Mon Sep 17 00:00:00 2001 From: kpayson64 Date: Thu, 31 May 2018 17:11:23 -0700 Subject: Use gevent greenlets for metadata callbacks --- src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi | 13 ++++++++++++- src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi index 500086f6cb..dff9097bf9 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi @@ -17,6 +17,17 @@ cimport cpython import grpc import threading +def _spawn_callback_in_thread(cb_func, args): + threading.Thread(target=cb_func, args=args).start() + +async_callback_func = _spawn_callback_in_thread + +def set_async_callback_func(callback_func): + global async_callback_func + async_callback_func = callback_func + +def _spawn_callback_async(callback, args): + async_callback_func(callback, args) cdef class CallCredentials: @@ -40,7 +51,7 @@ cdef int _get_metadata( else: cb(user_data, NULL, 0, status, error_details) args = context.service_url, context.method_name, callback, - threading.Thread(target=state, args=args).start() + _spawn_callback_async(state, args) return 0 # Asynchronous return diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx index 31ef671aed..f9a1b2856d 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc_gevent.pyx @@ -418,6 +418,11 @@ def init_grpc_gevent(): g_event = gevent.event.Event() g_pool = gevent.pool.Group() + + def cb_func(cb, args): + _spawn_greenlet(cb, *args) + set_async_callback_func(cb_func) + gevent_resolver_vtable.resolve = socket_resolve gevent_resolver_vtable.resolve_async = socket_resolve_async -- cgit v1.2.3 From 4e8643e75318477edcf0ca0598dcd0e20454f97a Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Fri, 1 Jun 2018 12:46:10 +0200 Subject: pin google-api-python-client to 1.6.7 to avoid breakage --- tools/internal_ci/helper_scripts/prepare_build_macos_rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/internal_ci/helper_scripts/prepare_build_macos_rc b/tools/internal_ci/helper_scripts/prepare_build_macos_rc index d2b77691d4..2f12471a85 100644 --- a/tools/internal_ci/helper_scripts/prepare_build_macos_rc +++ b/tools/internal_ci/helper_scripts/prepare_build_macos_rc @@ -34,7 +34,8 @@ sudo systemsetup -setusingnetworktime on date # Add GCP credentials for BQ access -pip install google-api-python-client --user python +# pin google-api-python-client to avoid https://github.com/grpc/grpc/issues/15600 +pip install google-api-python-client==1.6.7 --user python export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json # If this is a PR using RUN_TESTS_FLAGS var, then add flags to filter tests -- cgit v1.2.3 From 4677c70684c182e99c67bff7b195cd2dadfa2cf5 Mon Sep 17 00:00:00 2001 From: ZhouyihaiDing Date: Thu, 31 May 2018 16:02:46 -0700 Subject: PHP: fix flaky tests --- src/php/tests/unit_tests/CallCredentials2Test.php | 1 + src/php/tests/unit_tests/CallCredentialsTest.php | 1 + src/php/tests/unit_tests/CallTest.php | 6 +++-- src/php/tests/unit_tests/EndToEndTest.php | 5 +++- src/php/tests/unit_tests/InterceptorTest.php | 30 +++++++++++++++++++---- src/php/tests/unit_tests/SecureEndToEndTest.php | 2 ++ src/php/tests/unit_tests/ServerTest.php | 5 +++- 7 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/php/tests/unit_tests/CallCredentials2Test.php b/src/php/tests/unit_tests/CallCredentials2Test.php index 1c7e0c0ff6..c63029f121 100644 --- a/src/php/tests/unit_tests/CallCredentials2Test.php +++ b/src/php/tests/unit_tests/CallCredentials2Test.php @@ -35,6 +35,7 @@ class CallCredentials2Test extends PHPUnit_Framework_TestCase $this->channel = new Grpc\Channel( 'localhost:'.$this->port, [ + 'force_new' => true, 'grpc.ssl_target_name_override' => $this->host_override, 'grpc.default_authority' => $this->host_override, 'credentials' => $credentials, diff --git a/src/php/tests/unit_tests/CallCredentialsTest.php b/src/php/tests/unit_tests/CallCredentialsTest.php index 4b5721d76a..818b823da7 100644 --- a/src/php/tests/unit_tests/CallCredentialsTest.php +++ b/src/php/tests/unit_tests/CallCredentialsTest.php @@ -41,6 +41,7 @@ class CallCredentialsTest extends PHPUnit_Framework_TestCase $this->channel = new Grpc\Channel( 'localhost:'.$this->port, [ + 'force_new' => true, 'grpc.ssl_target_name_override' => $this->host_override, 'grpc.default_authority' => $this->host_override, 'credentials' => $this->credentials, diff --git a/src/php/tests/unit_tests/CallTest.php b/src/php/tests/unit_tests/CallTest.php index c5e1890a98..be1d77fe7a 100644 --- a/src/php/tests/unit_tests/CallTest.php +++ b/src/php/tests/unit_tests/CallTest.php @@ -24,12 +24,14 @@ class CallTest extends PHPUnit_Framework_TestCase public static function setUpBeforeClass() { self::$server = new Grpc\Server([]); - self::$port = self::$server->addHttp2Port('0.0.0.0:0'); + self::$port = self::$server->addHttp2Port('0.0.0.0:53000'); } public function setUp() { - $this->channel = new Grpc\Channel('localhost:'.self::$port, []); + $this->channel = new Grpc\Channel('localhost:'.self::$port, [ + 'force_new' => true, + ]); $this->call = new Grpc\Call($this->channel, '/foo', Grpc\Timeval::infFuture()); diff --git a/src/php/tests/unit_tests/EndToEndTest.php b/src/php/tests/unit_tests/EndToEndTest.php index b54f1d87c9..d0965655e0 100644 --- a/src/php/tests/unit_tests/EndToEndTest.php +++ b/src/php/tests/unit_tests/EndToEndTest.php @@ -22,13 +22,16 @@ class EndToEndTest extends PHPUnit_Framework_TestCase { $this->server = new Grpc\Server([]); $this->port = $this->server->addHttp2Port('0.0.0.0:0'); - $this->channel = new Grpc\Channel('localhost:'.$this->port, []); + $this->channel = new Grpc\Channel('localhost:'.$this->port, [ + "force_new" => true, + ]); $this->server->start(); } public function tearDown() { $this->channel->close(); + unset($this->server); } public function testSimpleRequestBody() diff --git a/src/php/tests/unit_tests/InterceptorTest.php b/src/php/tests/unit_tests/InterceptorTest.php index 11c5b4325a..d18c27c2c7 100644 --- a/src/php/tests/unit_tests/InterceptorTest.php +++ b/src/php/tests/unit_tests/InterceptorTest.php @@ -206,13 +206,16 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $this->server = new Grpc\Server([]); $this->port = $this->server->addHttp2Port('0.0.0.0:0'); - $this->channel = new Grpc\Channel('localhost:'.$this->port, ['credentials' => Grpc\ChannelCredentials::createInsecure()]); + $this->channel = new Grpc\Channel('localhost:'.$this->port, [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure()]); $this->server->start(); } public function tearDown() { $this->channel->close(); + unset($this->server); } @@ -222,6 +225,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $channel_matadata_interceptor = new ChangeMetadataInterceptor(); $intercept_channel = Grpc\Interceptor::intercept($this->channel, $channel_matadata_interceptor); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel); $req = new SimpleRequest($req_text); @@ -250,6 +254,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $intercept_channel1 = Grpc\Interceptor::intercept($this->channel, $channel_matadata_interceptor); $intercept_channel2 = Grpc\Interceptor::intercept($intercept_channel1, $channel_matadata_intercepto2); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel2); @@ -275,6 +280,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $intercept_channel3 = Grpc\Interceptor::intercept($this->channel, [$channel_matadata_intercepto2, $channel_matadata_interceptor]); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel3); @@ -304,6 +310,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $intercept_channel = Grpc\Interceptor::intercept($this->channel, $change_request_interceptor); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel); @@ -354,6 +361,7 @@ class InterceptorTest extends PHPUnit_Framework_TestCase $intercept_channel = Grpc\Interceptor::intercept($this->channel, $channel_request_interceptor); $client = new InterceptorClient('localhost:'.$this->port, [ + 'force_new' => true, 'credentials' => Grpc\ChannelCredentials::createInsecure(), ], $intercept_channel); @@ -374,7 +382,10 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $channel = new Grpc\Channel( 'localhost:0', - ['credentials' => Grpc\ChannelCredentials::createInsecure()] + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ] ); $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); $state = $interceptor_channel->getConnectivityState(); @@ -386,7 +397,10 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $channel = new Grpc\Channel( 'localhost:0', - ['credentials' => Grpc\ChannelCredentials::createInsecure()] + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ] ); $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); $now = Grpc\Timeval::now(); @@ -402,7 +416,10 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $channel = new Grpc\Channel( 'localhost:0', - ['credentials' => Grpc\ChannelCredentials::createInsecure()] + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ] ); $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); $this->assertNotNull($interceptor_channel); @@ -413,7 +430,10 @@ class InterceptorTest extends PHPUnit_Framework_TestCase { $channel = new Grpc\Channel( 'localhost:8888', - ['credentials' => Grpc\ChannelCredentials::createInsecure()] + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ] ); $interceptor_channel = Grpc\Interceptor::intercept($channel, new Grpc\Interceptor()); $target = $interceptor_channel->getTarget(); diff --git a/src/php/tests/unit_tests/SecureEndToEndTest.php b/src/php/tests/unit_tests/SecureEndToEndTest.php index dff4e878ea..071598c4c1 100644 --- a/src/php/tests/unit_tests/SecureEndToEndTest.php +++ b/src/php/tests/unit_tests/SecureEndToEndTest.php @@ -34,6 +34,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase $this->channel = new Grpc\Channel( 'localhost:'.$this->port, [ + 'force_new' => true, 'grpc.ssl_target_name_override' => $this->host_override, 'grpc.default_authority' => $this->host_override, 'credentials' => $credentials, @@ -44,6 +45,7 @@ class SecureEndToEndTest extends PHPUnit_Framework_TestCase public function tearDown() { $this->channel->close(); + unset($this->server); } public function testSimpleRequestBody() diff --git a/src/php/tests/unit_tests/ServerTest.php b/src/php/tests/unit_tests/ServerTest.php index ac6f2f0312..cab92e5941 100644 --- a/src/php/tests/unit_tests/ServerTest.php +++ b/src/php/tests/unit_tests/ServerTest.php @@ -55,7 +55,10 @@ class ServerTest extends PHPUnit_Framework_TestCase $port = $this->server->addHttp2Port('0.0.0.0:0'); $this->server->start(); $channel = new Grpc\Channel('localhost:'.$port, - ['credentials' => Grpc\ChannelCredentials::createInsecure()]); + [ + 'force_new' => true, + 'credentials' => Grpc\ChannelCredentials::createInsecure() + ]); $deadline = Grpc\Timeval::infFuture(); $call = new Grpc\Call($channel, 'dummy_method', $deadline); -- cgit v1.2.3 From 3c3f3ad75a478e8e3eac8d25bf72701fae6c02f7 Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Fri, 1 Jun 2018 10:21:14 -0700 Subject: Decrease GRPC_CHTTP2_HPACKC_NUM_VALUES --- .../transport/chttp2/transport/hpack_encoder.cc | 16 +++++++++------ .../ext/transport/chttp2/transport/hpack_encoder.h | 7 ++++--- test/core/transport/chttp2/hpack_encoder_test.cc | 23 +++++++++------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index d5ef063883..0eaf63f133 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -41,14 +41,18 @@ #include "src/core/lib/transport/static_metadata.h" #include "src/core/lib/transport/timeout_encoding.h" -#define HASH_FRAGMENT_1(x) ((x)&255) -#define HASH_FRAGMENT_2(x) ((x >> 8) & 255) -#define HASH_FRAGMENT_3(x) ((x >> 16) & 255) -#define HASH_FRAGMENT_4(x) ((x >> 24) & 255) +#define HASH_FRAGMENT_MASK (GRPC_CHTTP2_HPACKC_NUM_VALUES - 1) +#define HASH_FRAGMENT_1(x) ((x)&HASH_FRAGMENT_MASK) +#define HASH_FRAGMENT_2(x) \ + (((x) >> GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS) & HASH_FRAGMENT_MASK) +#define HASH_FRAGMENT_3(x) \ + (((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 2)) & HASH_FRAGMENT_MASK) +#define HASH_FRAGMENT_4(x) \ + (((x) >> (GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS * 3)) & HASH_FRAGMENT_MASK) /* if the probability of this item being seen again is < 1/x then don't add it to the table */ -#define ONE_ON_ADD_PROBABILITY 128 +#define ONE_ON_ADD_PROBABILITY (GRPC_CHTTP2_HPACKC_NUM_VALUES >> 1) /* don't consider adding anything bigger than this to the hpack table */ #define MAX_DECODER_SPACE_USAGE 512 @@ -135,7 +139,7 @@ static void inc_filter(uint8_t idx, uint32_t* sum, uint8_t* elems) { } else { int i; *sum = 0; - for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_FILTERS; i++) { + for (i = 0; i < GRPC_CHTTP2_HPACKC_NUM_VALUES; i++) { elems[i] /= 2; (*sum) += elems[i]; } diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h index b370932131..e31a7399d7 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h @@ -28,8 +28,9 @@ #include "src/core/lib/transport/metadata_batch.h" #include "src/core/lib/transport/transport.h" -#define GRPC_CHTTP2_HPACKC_NUM_FILTERS 256 -#define GRPC_CHTTP2_HPACKC_NUM_VALUES 256 +// This should be <= 8. We use 6 to save space. +#define GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS 6 +#define GRPC_CHTTP2_HPACKC_NUM_VALUES (1 << GRPC_CHTTP2_HPACKC_NUM_VALUES_BITS) /* initial table size, per spec */ #define GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE 4096 /* maximum table size we'll actually use */ @@ -58,7 +59,7 @@ typedef struct { a new literal should be added to the compression table or not. They track a single integer that counts how often a particular value has been seen. When that count reaches max (255), all values are halved. */ - uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_FILTERS]; + uint8_t filter_elems[GRPC_CHTTP2_HPACKC_NUM_VALUES]; /* entry tables for keys & elems: these tables track values that have been seen and *may* be in the decompressor table */ diff --git a/test/core/transport/chttp2/hpack_encoder_test.cc b/test/core/transport/chttp2/hpack_encoder_test.cc index d3ba50a91c..2a57198ab6 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.cc +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -160,6 +160,8 @@ static void encode_int_to_str(int i, char* p) { } static void test_decode_table_overflow() { + // Decrease the default table size to make decode table overflow easier. + grpc_chttp2_hpack_compressor_set_max_table_size(&g_compressor, 1024); int i; char key[3], value[3]; char* expect; @@ -170,27 +172,20 @@ static void test_decode_table_overflow() { false, }; - for (i = 0; i < 114; i++) { + for (i = 0; i < 29; i++) { encode_int_to_str(i, key); encode_int_to_str(i + 1, value); - - if (i + 61 >= 127) { + if (i == 0) { + // 3fe107 corresponds to the table size update. gpr_asprintf(&expect, - "000009 0104 deadbeef ff%02x 40 02%02x%02x 02%02x%02x", - i + 61 - 127, key[0], key[1], value[0], value[1]); - } else if (i > 0) { + "00000a 0104 deadbeef 3fe107 40 02%02x%02x 02%02x%02x", + key[0], key[1], value[0], value[1]); + verify(params, expect, 1, key, value); + } else { gpr_asprintf(&expect, "000008 0104 deadbeef %02x 40 02%02x%02x 02%02x%02x", 0x80 + 61 + i, key[0], key[1], value[0], value[1]); - } else { - gpr_asprintf(&expect, "000007 0104 deadbeef 40 02%02x%02x 02%02x%02x", - key[0], key[1], value[0], value[1]); - } - - if (i > 0) { verify(params, expect, 2, "aa", "ba", key, value); - } else { - verify(params, expect, 1, key, value); } gpr_free(expect); } -- cgit v1.2.3 From d8fac0bb7f7d47c6c74406978137507b5abc7c8a Mon Sep 17 00:00:00 2001 From: kpayson64 Date: Fri, 1 Jun 2018 10:46:09 -0700 Subject: Undo core version change --- BUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD b/BUILD index e3521f5b76..db1bdaa994 100644 --- a/BUILD +++ b/BUILD @@ -66,7 +66,7 @@ config_setting( # This should be updated along with build.yaml g_stands_for = "gloriosa" -core_version = "6.0.0" +core_version = "6.0.0-dev" version = "1.13.0-dev" -- cgit v1.2.3 From 45cd1f8a51485c66a82a955a4361db3a55797b39 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Fri, 1 Jun 2018 10:43:52 -0700 Subject: Install Python 3.7 in pyenv Dockerfile Bump pyenv Dockerfile to Debian stretch to install OpenSSL 1.0.2 which is required to build Python 3.7 and get Python 3.7 installed in the test docker image. --- templates/tools/dockerfile/apt_get_pyenv.include | 5 +++-- templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/tools/dockerfile/apt_get_pyenv.include b/templates/tools/dockerfile/apt_get_pyenv.include index ef0964e597..e12b3e2c7f 100644 --- a/templates/tools/dockerfile/apt_get_pyenv.include +++ b/templates/tools/dockerfile/apt_get_pyenv.include @@ -10,7 +10,7 @@ RUN apt-get update && apt-get install -y ${'\\'} mercurial ${'\\'} zlib1g-dev && apt-get clean -# Install Pyenv and dev Python versions 3.5 and 3.6 +# Install Pyenv and dev Python versions 3.{5,6,7} RUN curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash ENV PATH /root/.pyenv/bin:$PATH RUN eval "$(pyenv init -)" @@ -18,5 +18,6 @@ RUN eval "$(pyenv virtualenv-init -)" RUN pyenv update RUN pyenv install 3.5-dev RUN pyenv install 3.6-dev +RUN pyenv install 3.7-dev RUN pyenv install pypy-5.3.1 -RUN pyenv local 3.5-dev 3.6-dev pypy-5.3.1 +RUN pyenv local 3.5-dev 3.6-dev 3.7-dev pypy-5.3.1 diff --git a/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template index ba65c06a3b..b408b74c77 100644 --- a/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM debian:jessie + FROM debian:stretch <%include file="../../apt_get_basic.include"/> <%include file="../../gcp_api_libraries.include"/> -- cgit v1.2.3 From 4bdc6902223d78752aa70ad744764eddfa08fa41 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Fri, 1 Jun 2018 11:07:44 -0700 Subject: Use Python3.5 instead of Python3.4 on Debian 9 --- .../tools/dockerfile/test/python_pyenv_x64/Dockerfile.template | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template b/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template index b408b74c77..1e013b742c 100644 --- a/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template +++ b/templates/tools/dockerfile/test/python_pyenv_x64/Dockerfile.template @@ -20,9 +20,9 @@ <%include file="../../gcp_api_libraries.include"/> <%include file="../../python_deps.include"/> <%include file="../../apt_get_pyenv.include"/> - # Install pip and virtualenv for Python 3.4 - RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 - RUN python3.4 -m pip install virtualenv + # Install pip and virtualenv for Python 3.5 + RUN curl https://bootstrap.pypa.io/get-pip.py | python3.5 + RUN python3.5 -m pip install virtualenv <%include file="../../run_tests_addons.include"/> # Define the default command. -- cgit v1.2.3 From 144b279993b942f979098747e7791bc4960f60a8 Mon Sep 17 00:00:00 2001 From: Mehrdad Afshari Date: Fri, 1 Jun 2018 11:12:40 -0700 Subject: Regenerate Projects --- tools/dockerfile/test/python_pyenv_x64/Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/dockerfile/test/python_pyenv_x64/Dockerfile b/tools/dockerfile/test/python_pyenv_x64/Dockerfile index 43854aa689..c23e67c904 100644 --- a/tools/dockerfile/test/python_pyenv_x64/Dockerfile +++ b/tools/dockerfile/test/python_pyenv_x64/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM debian:jessie +FROM debian:stretch # Install Git and basic packages. RUN apt-get update && apt-get install -y \ @@ -80,7 +80,7 @@ RUN apt-get update && apt-get install -y \ mercurial \ zlib1g-dev && apt-get clean -# Install Pyenv and dev Python versions 3.5 and 3.6 +# Install Pyenv and dev Python versions 3.{5,6,7} RUN curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash ENV PATH /root/.pyenv/bin:$PATH RUN eval "$(pyenv init -)" @@ -88,12 +88,13 @@ RUN eval "$(pyenv virtualenv-init -)" RUN pyenv update RUN pyenv install 3.5-dev RUN pyenv install 3.6-dev +RUN pyenv install 3.7-dev RUN pyenv install pypy-5.3.1 -RUN pyenv local 3.5-dev 3.6-dev pypy-5.3.1 +RUN pyenv local 3.5-dev 3.6-dev 3.7-dev pypy-5.3.1 -# Install pip and virtualenv for Python 3.4 -RUN curl https://bootstrap.pypa.io/get-pip.py | python3.4 -RUN python3.4 -m pip install virtualenv +# Install pip and virtualenv for Python 3.5 +RUN curl https://bootstrap.pypa.io/get-pip.py | python3.5 +RUN python3.5 -m pip install virtualenv RUN mkdir /var/local/jenkins -- cgit v1.2.3 From 304ff8fcbb2025e15230d9cebae60c4ea43c8c0e Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Fri, 25 May 2018 15:50:45 -0700 Subject: Update bazel toolchain to RBE Ubuntu16_04 toolchain container --- bazel/grpc_deps.bzl | 8 ++++---- tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh | 4 ++-- tools/internal_ci/linux/grpc_msan_on_foundry.sh | 6 +++--- tools/internal_ci/linux/grpc_ubsan_on_foundry.sh | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl index 53073941f3..162ec1f5f5 100644 --- a/bazel/grpc_deps.bzl +++ b/bazel/grpc_deps.bzl @@ -130,12 +130,12 @@ def grpc_deps(): if "com_github_bazelbuild_bazeltoolchains" not in native.existing_rules(): native.http_archive( name = "com_github_bazelbuild_bazeltoolchains", - strip_prefix = "bazel-toolchains-09c850dbb8e785ded3d23a7003e9a0168fe1fb2f", + strip_prefix = "bazel-toolchains-4653c01284d8a4a536f8f9bb47b7d10f94c549e7", urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/09c850dbb8e785ded3d23a7003e9a0168fe1fb2f.tar.gz", - "https://github.com/bazelbuild/bazel-toolchains/archive/09c850dbb8e785ded3d23a7003e9a0168fe1fb2f.tar.gz", + "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/4653c01284d8a4a536f8f9bb47b7d10f94c549e7.tar.gz", + "https://github.com/bazelbuild/bazel-toolchains/archive/4653c01284d8a4a536f8f9bb47b7d10f94c549e7.tar.gz", ], - sha256 = "08e521cf2d0998e3d27a16c2e2542ebf4d3857b3ddadcfd145d128140754d7bd", + sha256 = "1c4a532b396c698e6467a1548554571cb85fa091e472b05e398ebc836c315d77", ) # TODO: move some dependencies from "grpc_deps" here? diff --git a/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh b/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh index 7881e3a7fb..4a64b004b9 100755 --- a/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh +++ b/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh @@ -49,8 +49,8 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --strategy=Closure=remote \ --genrule_strategy=remote \ --experimental_strict_action_env=true \ - --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-debian8@sha256:1ede2a929b44d629ec5abe86eee6d7ffea1d5a4d247489a8867d46cfde3e38bd" }' \ - --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/debian8_clang/0.3.0/bazel_0.10.0:toolchain \ + --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:59bf0e191a6b5cc1ab62c2224c810681d1326bad5a27b1d36c9f40113e79da7f" }' \ + --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/default:toolchain \ --define GRPC_PORT_ISOLATED_RUNTIME=1 \ $1 \ -- //test/... || FAILED="true" diff --git a/tools/internal_ci/linux/grpc_msan_on_foundry.sh b/tools/internal_ci/linux/grpc_msan_on_foundry.sh index 5e644793ad..de9319ba10 100644 --- a/tools/internal_ci/linux/grpc_msan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_msan_on_foundry.sh @@ -50,7 +50,7 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --strategy=Closure=remote \ --genrule_strategy=remote \ --experimental_strict_action_env=true \ - --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/asci-toolchain/nosla-debian8-clang-msan@sha256:8f381d55c0456fb65821c90ada902c2584977e03a1eaca8fba8ce77e644c775b" }' \ + --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:59bf0e191a6b5cc1ab62c2224c810681d1326bad5a27b1d36c9f40113e79da7f" }' \ --define GRPC_PORT_ISOLATED_RUNTIME=1 \ --copt=-gmlt \ --strip=never \ @@ -59,8 +59,8 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --linkopt=-fsanitize=memory \ --copt=-fsanitize-memory-track-origins \ --action_env=LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \ - --host_crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/debian8_clang/0.3.0/bazel_0.10.0:toolchain \ - --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/experimental/debian8_clang/0.3.0/bazel_0.10.0/msan:msan_experimental_toolchain \ + --host_crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/default:toolchain \ + --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/msan:toolchain \ -- //test/... || FAILED="true" # Sleep to let ResultStore finish writing results before querying diff --git a/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh b/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh index 5c0e2df09d..cfbea89252 100644 --- a/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh @@ -50,13 +50,13 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --strategy=Closure=remote \ --genrule_strategy=remote \ --experimental_strict_action_env=true \ - --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-debian8@sha256:1ede2a929b44d629ec5abe86eee6d7ffea1d5a4d247489a8867d46cfde3e38bd" }' \ + --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:59bf0e191a6b5cc1ab62c2224c810681d1326bad5a27b1d36c9f40113e79da7f" }' \ --define GRPC_PORT_ISOLATED_RUNTIME=1 \ --copt=-gmlt \ --strip=never \ --copt=-fsanitize=undefined \ --linkopt=-fsanitize=undefined \ - --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/experimental/debian8_clang/0.3.0/bazel_0.12.0/ubsan:toolchain \ + --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/experimental/ubuntu16_04_clang/1.0/bazel_0.13.0/ubsan:toolchain \ -- //test/... || FAILED="true" # Sleep to let ResultStore finish writing results before querying -- cgit v1.2.3 From e713dee6f2ed752af9bbfc7b9b91b2d74b76918e Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Tue, 29 May 2018 10:24:16 -0700 Subject: Added new flags to solve no local C compiler bug in bazel --- tools/internal_ci/linux/grpc_ubsan_on_foundry.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh b/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh index cfbea89252..90300acc10 100644 --- a/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh @@ -57,6 +57,9 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --copt=-fsanitize=undefined \ --linkopt=-fsanitize=undefined \ --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/experimental/ubuntu16_04_clang/1.0/bazel_0.13.0/ubsan:toolchain \ + --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 \ + --extra_toolchains=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/cpp:cc-toolchain-clang-x86_64-default \ + --extra_execution_platforms=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 \ -- //test/... || FAILED="true" # Sleep to let ResultStore finish writing results before querying -- cgit v1.2.3 From 64a56a83b6b5a4e8f70d8620dffd2776c1ec89a9 Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Fri, 1 Jun 2018 11:19:02 -0700 Subject: Merge --- tools/internal_ci/linux/grpc_ubsan_on_foundry.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh b/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh index 90300acc10..f5c12c27a3 100644 --- a/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_ubsan_on_foundry.sh @@ -23,8 +23,8 @@ mkdir -p ${KOKORO_KEYSTORE_DIR} cp ${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json ${KOKORO_KEYSTORE_DIR}/4321_grpc-testing-service temp_dir=$(mktemp -d) -ln -f "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" ${temp_dir}/bazel -chmod 755 "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" +ln -f "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" ${temp_dir}/bazel +chmod 755 "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" export PATH="${temp_dir}:${PATH}" # This should show ${temp_dir}/bazel which bazel -- cgit v1.2.3 From 300794903a9e42b9ceb1160e790443be7f4a2525 Mon Sep 17 00:00:00 2001 From: Adele Zhou Date: Fri, 1 Jun 2018 11:53:03 -0700 Subject: More flags for 0.14.0 --- tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh | 7 +++++-- tools/internal_ci/linux/grpc_msan_on_foundry.sh | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh b/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh index 4a64b004b9..d2dded051d 100755 --- a/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh +++ b/tools/internal_ci/linux/grpc_bazel_on_foundry_base.sh @@ -22,8 +22,8 @@ mkdir -p ${KOKORO_KEYSTORE_DIR} cp ${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json ${KOKORO_KEYSTORE_DIR}/4321_grpc-testing-service temp_dir=$(mktemp -d) -ln -f "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" ${temp_dir}/bazel -chmod 755 "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" +ln -f "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" ${temp_dir}/bazel +chmod 755 "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" export PATH="${temp_dir}:${PATH}" # This should show ${temp_dir}/bazel which bazel @@ -52,6 +52,9 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --experimental_remote_platform_override='properties:{name:"container-image" value:"docker://gcr.io/cloud-marketplace/google/rbe-ubuntu16-04@sha256:59bf0e191a6b5cc1ab62c2224c810681d1326bad5a27b1d36c9f40113e79da7f" }' \ --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/default:toolchain \ --define GRPC_PORT_ISOLATED_RUNTIME=1 \ + --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 \ + --extra_toolchains=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/cpp:cc-toolchain-clang-x86_64-default \ + --extra_execution_platforms=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 \ $1 \ -- //test/... || FAILED="true" diff --git a/tools/internal_ci/linux/grpc_msan_on_foundry.sh b/tools/internal_ci/linux/grpc_msan_on_foundry.sh index de9319ba10..e8ef249aa5 100644 --- a/tools/internal_ci/linux/grpc_msan_on_foundry.sh +++ b/tools/internal_ci/linux/grpc_msan_on_foundry.sh @@ -23,8 +23,8 @@ mkdir -p ${KOKORO_KEYSTORE_DIR} cp ${KOKORO_GFILE_DIR}/GrpcTesting-d0eeee2db331.json ${KOKORO_KEYSTORE_DIR}/4321_grpc-testing-service temp_dir=$(mktemp -d) -ln -f "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" ${temp_dir}/bazel -chmod 755 "${KOKORO_GFILE_DIR}/bazel-release-0.12.0" +ln -f "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" ${temp_dir}/bazel +chmod 755 "${KOKORO_GFILE_DIR}/bazel-rc-0.14.0rc5" export PATH="${temp_dir}:${PATH}" # This should show ${temp_dir}/bazel which bazel @@ -61,6 +61,9 @@ source tools/internal_ci/helper_scripts/prepare_build_linux_rc --action_env=LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH \ --host_crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/default:toolchain \ --crosstool_top=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/msan:toolchain \ + --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 \ + --extra_toolchains=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0/bazel_0.13.0/cpp:cc-toolchain-clang-x86_64-default \ + --extra_execution_platforms=@com_github_bazelbuild_bazeltoolchains//configs/ubuntu16_04_clang/1.0:rbe_ubuntu1604 \ -- //test/... || FAILED="true" # Sleep to let ResultStore finish writing results before querying -- cgit v1.2.3 From 7e0e2021f3e9a7d6b862a7e69ff88807dd9783f1 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Fri, 1 Jun 2018 12:04:16 -0700 Subject: C++-ify some client_channel internals. --- .../ext/filters/client_channel/client_channel.cc | 520 +++++++++++---------- 1 file changed, 277 insertions(+), 243 deletions(-) diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 936d70b959..ea6775a8d8 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -891,6 +891,7 @@ typedef struct client_channel_call_data { grpc_closure pick_cancel_closure; grpc_polling_entity* pollent; + bool pollent_added_to_interested_parties; // Batches are added to this list when received from above. // They are removed when we are done handling the batch (i.e., when @@ -949,7 +950,6 @@ static void retry_commit(grpc_call_element* elem, static void start_internal_recv_trailing_metadata(grpc_call_element* elem); static void on_complete(void* arg, grpc_error* error); static void start_retriable_subchannel_batches(void* arg, grpc_error* ignored); -static void pick_after_resolver_result_start_locked(grpc_call_element* elem); static void start_pick_locked(void* arg, grpc_error* ignored); // @@ -2684,59 +2684,133 @@ static void pick_done(void* arg, grpc_error* error) { } } +static void maybe_add_call_to_channel_interested_parties_locked( + grpc_call_element* elem) { + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); + if (!calld->pollent_added_to_interested_parties) { + calld->pollent_added_to_interested_parties = true; + grpc_polling_entity_add_to_pollset_set(calld->pollent, + chand->interested_parties); + } +} + +static void maybe_del_call_from_channel_interested_parties_locked( + grpc_call_element* elem) { + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); + if (calld->pollent_added_to_interested_parties) { + calld->pollent_added_to_interested_parties = false; + grpc_polling_entity_del_from_pollset_set(calld->pollent, + chand->interested_parties); + } +} + // Invoked when a pick is completed to leave the client_channel combiner // and continue processing in the call combiner. +// If needed, removes the call's polling entity from chand->interested_parties. static void pick_done_locked(grpc_call_element* elem, grpc_error* error) { call_data* calld = static_cast(elem->call_data); + maybe_del_call_from_channel_interested_parties_locked(elem); GRPC_CLOSURE_INIT(&calld->pick_closure, pick_done, elem, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_SCHED(&calld->pick_closure, error); } -// A wrapper around pick_done_locked() that is used in cases where -// either (a) the pick was deferred pending a resolver result or (b) the -// pick was done asynchronously. Removes the call's polling entity from -// chand->interested_parties before invoking pick_done_locked(). -static void async_pick_done_locked(grpc_call_element* elem, grpc_error* error) { - channel_data* chand = static_cast(elem->channel_data); - call_data* calld = static_cast(elem->call_data); - grpc_polling_entity_del_from_pollset_set(calld->pollent, - chand->interested_parties); - pick_done_locked(elem, error); -} +namespace grpc_core { -// Note: This runs under the client_channel combiner, but will NOT be -// holding the call combiner. -static void pick_callback_cancel_locked(void* arg, grpc_error* error) { - grpc_call_element* elem = static_cast(arg); - channel_data* chand = static_cast(elem->channel_data); - call_data* calld = static_cast(elem->call_data); - // Note: chand->lb_policy may have changed since we started our pick, - // in which case we will be cancelling the pick on a policy other than - // the one we started it on. However, this will just be a no-op. - if (GPR_LIKELY(error != GRPC_ERROR_NONE && chand->lb_policy != nullptr)) { +// Performs subchannel pick via LB policy. +class LbPicker { + public: + // Starts a pick on chand->lb_policy. + static void StartLocked(grpc_call_element* elem) { + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: cancelling pick from LB policy %p", + gpr_log(GPR_INFO, "chand=%p calld=%p: starting pick on lb_policy=%p", chand, calld, chand->lb_policy.get()); } - chand->lb_policy->CancelPickLocked(&calld->pick, GRPC_ERROR_REF(error)); + // If this is a retry, use the send_initial_metadata payload that + // we've cached; otherwise, use the pending batch. The + // send_initial_metadata batch will be the first pending batch in the + // list, as set by get_batch_index() above. + calld->pick.initial_metadata = + calld->seen_send_initial_metadata + ? &calld->send_initial_metadata + : calld->pending_batches[0] + .batch->payload->send_initial_metadata.send_initial_metadata; + calld->pick.initial_metadata_flags = + calld->seen_send_initial_metadata + ? calld->send_initial_metadata_flags + : calld->pending_batches[0] + .batch->payload->send_initial_metadata + .send_initial_metadata_flags; + GRPC_CLOSURE_INIT(&calld->pick_closure, &LbPicker::DoneLocked, elem, + grpc_combiner_scheduler(chand->combiner)); + calld->pick.on_complete = &calld->pick_closure; + GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback"); + const bool pick_done = chand->lb_policy->PickLocked(&calld->pick); + if (GPR_LIKELY(pick_done)) { + // Pick completed synchronously. + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "chand=%p calld=%p: pick completed synchronously", + chand, calld); + } + pick_done_locked(elem, GRPC_ERROR_NONE); + GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback"); + } else { + // Pick will be returned asynchronously. + // Add the polling entity from call_data to the channel_data's + // interested_parties, so that the I/O of the LB policy can be done + // under it. It will be removed in pick_done_locked(). + maybe_add_call_to_channel_interested_parties_locked(elem); + // Request notification on call cancellation. + GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback_cancel"); + grpc_call_combiner_set_notify_on_cancel( + calld->call_combiner, + GRPC_CLOSURE_INIT(&calld->pick_cancel_closure, + &LbPicker::CancelLocked, elem, + grpc_combiner_scheduler(chand->combiner))); + } } - GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback_cancel"); -} -// Callback invoked by LoadBalancingPolicy::PickLocked() for async picks. -// Unrefs the LB policy and invokes async_pick_done_locked(). -static void pick_callback_done_locked(void* arg, grpc_error* error) { - grpc_call_element* elem = static_cast(arg); - channel_data* chand = static_cast(elem->channel_data); - call_data* calld = static_cast(elem->call_data); - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: pick completed asynchronously", chand, - calld); + private: + // Callback invoked by LoadBalancingPolicy::PickLocked() for async picks. + // Unrefs the LB policy and invokes pick_done_locked(). + static void DoneLocked(void* arg, grpc_error* error) { + grpc_call_element* elem = static_cast(arg); + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "chand=%p calld=%p: pick completed asynchronously", + chand, calld); + } + pick_done_locked(elem, GRPC_ERROR_REF(error)); + GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback"); } - async_pick_done_locked(elem, GRPC_ERROR_REF(error)); - GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback"); -} + + // Note: This runs under the client_channel combiner, but will NOT be + // holding the call combiner. + static void CancelLocked(void* arg, grpc_error* error) { + grpc_call_element* elem = static_cast(arg); + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); + // Note: chand->lb_policy may have changed since we started our pick, + // in which case we will be cancelling the pick on a policy other than + // the one we started it on. However, this will just be a no-op. + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE && chand->lb_policy != nullptr)) { + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, + "chand=%p calld=%p: cancelling pick from LB policy %p", chand, + calld, chand->lb_policy.get()); + } + chand->lb_policy->CancelPickLocked(&calld->pick, GRPC_ERROR_REF(error)); + } + GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback_cancel"); + } +}; + +} // namespace grpc_core // Applies service config to the call. Must be invoked once we know // that the resolver has returned results to the channel. @@ -2766,6 +2840,24 @@ static void apply_service_config_to_call_locked(grpc_call_element* elem) { grpc_deadline_state_reset(elem, calld->deadline); } } + // If the service config set wait_for_ready and the application + // did not explicitly set it, use the value from the service config. + uint32_t* send_initial_metadata_flags = + &calld->pending_batches[0] + .batch->payload->send_initial_metadata + .send_initial_metadata_flags; + if (GPR_UNLIKELY( + calld->method_params->wait_for_ready() != + ClientChannelMethodParams::WAIT_FOR_READY_UNSET && + !(*send_initial_metadata_flags & + GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET))) { + if (calld->method_params->wait_for_ready() == + ClientChannelMethodParams::WAIT_FOR_READY_TRUE) { + *send_initial_metadata_flags |= GRPC_INITIAL_METADATA_WAIT_FOR_READY; + } else { + *send_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY; + } + } } } // If no retry policy, disable retries. @@ -2776,215 +2868,164 @@ static void apply_service_config_to_call_locked(grpc_call_element* elem) { } } -// Starts a pick on chand->lb_policy. -// Returns true if pick is completed synchronously. -static bool pick_callback_start_locked(grpc_call_element* elem) { - channel_data* chand = static_cast(elem->channel_data); +// Invoked once resolver results are available. +static void process_service_config_and_start_lb_pick_locked( + grpc_call_element* elem) { call_data* calld = static_cast(elem->call_data); - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: starting pick on lb_policy=%p", chand, - calld, chand->lb_policy.get()); - } // Only get service config data on the first attempt. if (GPR_LIKELY(calld->num_attempts_completed == 0)) { apply_service_config_to_call_locked(elem); } - // If the application explicitly set wait_for_ready, use that. - // Otherwise, if the service config specified a value for this - // method, use that. - // - // The send_initial_metadata batch will be the first one in the list, - // as set by get_batch_index() above. - calld->pick.initial_metadata = - calld->seen_send_initial_metadata - ? &calld->send_initial_metadata - : calld->pending_batches[0] - .batch->payload->send_initial_metadata.send_initial_metadata; - uint32_t send_initial_metadata_flags = - calld->seen_send_initial_metadata - ? calld->send_initial_metadata_flags - : calld->pending_batches[0] - .batch->payload->send_initial_metadata - .send_initial_metadata_flags; - const bool wait_for_ready_set_from_api = - send_initial_metadata_flags & - GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET; - const bool wait_for_ready_set_from_service_config = - calld->method_params != nullptr && - calld->method_params->wait_for_ready() != - ClientChannelMethodParams::WAIT_FOR_READY_UNSET; - if (GPR_UNLIKELY(!wait_for_ready_set_from_api && - wait_for_ready_set_from_service_config)) { - if (calld->method_params->wait_for_ready() == - ClientChannelMethodParams::WAIT_FOR_READY_TRUE) { - send_initial_metadata_flags |= GRPC_INITIAL_METADATA_WAIT_FOR_READY; - } else { - send_initial_metadata_flags &= ~GRPC_INITIAL_METADATA_WAIT_FOR_READY; - } - } - calld->pick.initial_metadata_flags = send_initial_metadata_flags; - GRPC_CLOSURE_INIT(&calld->pick_closure, pick_callback_done_locked, elem, - grpc_combiner_scheduler(chand->combiner)); - calld->pick.on_complete = &calld->pick_closure; - GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback"); - const bool pick_done = chand->lb_policy->PickLocked(&calld->pick); - if (GPR_LIKELY(pick_done)) { - // Pick completed synchronously. - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: pick completed synchronously", - chand, calld); - } - GRPC_CALL_STACK_UNREF(calld->owning_call, "pick_callback"); - } else { - GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback_cancel"); - grpc_call_combiner_set_notify_on_cancel( - calld->call_combiner, - GRPC_CLOSURE_INIT(&calld->pick_cancel_closure, - pick_callback_cancel_locked, elem, - grpc_combiner_scheduler(chand->combiner))); - } - return pick_done; + // Start LB pick. + grpc_core::LbPicker::StartLocked(elem); } -typedef struct { - grpc_call_element* elem; - bool finished; - grpc_closure closure; - grpc_closure cancel_closure; -} pick_after_resolver_result_args; - -// Note: This runs under the client_channel combiner, but will NOT be -// holding the call combiner. -static void pick_after_resolver_result_cancel_locked(void* arg, - grpc_error* error) { - pick_after_resolver_result_args* args = - static_cast(arg); - if (GPR_LIKELY(args->finished)) { - gpr_free(args); - return; - } - // If we don't yet have a resolver result, then a closure for - // pick_after_resolver_result_done_locked() will have been added to - // chand->waiting_for_resolver_result_closures, and it may not be invoked - // until after this call has been destroyed. We mark the operation as - // finished, so that when pick_after_resolver_result_done_locked() - // is called, it will be a no-op. We also immediately invoke - // async_pick_done_locked() to propagate the error back to the caller. - args->finished = true; - grpc_call_element* elem = args->elem; - channel_data* chand = static_cast(elem->channel_data); - call_data* calld = static_cast(elem->call_data); - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, - "chand=%p calld=%p: cancelling pick waiting for resolver result", - chand, calld); - } - // Note: Although we are not in the call combiner here, we are - // basically stealing the call combiner from the pending pick, so - // it's safe to call async_pick_done_locked() here -- we are - // essentially calling it here instead of calling it in - // pick_after_resolver_result_done_locked(). - async_pick_done_locked(elem, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( - "Pick cancelled", &error, 1)); -} - -static void pick_after_resolver_result_done_locked(void* arg, - grpc_error* error) { - pick_after_resolver_result_args* args = - static_cast(arg); - if (GPR_UNLIKELY(args->finished)) { - /* cancelled, do nothing */ - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "call cancelled before resolver result"); - } - gpr_free(args); - return; - } - args->finished = true; - grpc_call_element* elem = args->elem; - channel_data* chand = static_cast(elem->channel_data); - call_data* calld = static_cast(elem->call_data); - if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { +namespace grpc_core { + +// Handles waiting for a resolver result. +// Used only for the first call on an idle channel. +class ResolverResultWaiter { + public: + explicit ResolverResultWaiter(grpc_call_element* elem) : elem_(elem) { + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: resolver failed to return data", + gpr_log(GPR_INFO, + "chand=%p calld=%p: deferring pick pending resolver result", chand, calld); } - async_pick_done_locked(elem, GRPC_ERROR_REF(error)); - } else if (GPR_UNLIKELY(chand->resolver == nullptr)) { - // Shutting down. - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: resolver disconnected", chand, - calld); + // Add closure to be run when a resolver result is available. + GRPC_CLOSURE_INIT(&done_closure_, &ResolverResultWaiter::DoneLocked, this, + grpc_combiner_scheduler(chand->combiner)); + AddToWaitingList(); + // Set cancellation closure, so that we abort if the call is cancelled. + GRPC_CLOSURE_INIT(&cancel_closure_, &ResolverResultWaiter::CancelLocked, + this, grpc_combiner_scheduler(chand->combiner)); + grpc_call_combiner_set_notify_on_cancel(calld->call_combiner, + &cancel_closure_); + } + + private: + // Adds closure_ to chand->waiting_for_resolver_result_closures. + void AddToWaitingList() { + channel_data* chand = static_cast(elem_->channel_data); + grpc_closure_list_append(&chand->waiting_for_resolver_result_closures, + &done_closure_, GRPC_ERROR_NONE); + } + + // Invoked when a resolver result is available. + static void DoneLocked(void* arg, grpc_error* error) { + ResolverResultWaiter* self = static_cast(arg); + // If CancelLocked() has already run, delete ourselves without doing + // anything. Note that the call stack may have already been destroyed, + // so it's not safe to access anything in elem_. + if (GPR_UNLIKELY(self->finished_)) { + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "call cancelled before resolver result"); + } + Delete(self); + return; } - async_pick_done_locked( - elem, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); - } else if (GPR_UNLIKELY(chand->lb_policy == nullptr)) { - // Transient resolver failure. - // If call has wait_for_ready=true, try again; otherwise, fail. - uint32_t send_initial_metadata_flags = - calld->seen_send_initial_metadata - ? calld->send_initial_metadata_flags - : calld->pending_batches[0] - .batch->payload->send_initial_metadata - .send_initial_metadata_flags; - if (send_initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY) { + // Otherwise, process the resolver result. + grpc_call_element* elem = self->elem_; + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, - "chand=%p calld=%p: resolver returned but no LB policy; " - "wait_for_ready=true; trying again", + gpr_log(GPR_INFO, "chand=%p calld=%p: resolver failed to return data", chand, calld); } - pick_after_resolver_result_start_locked(elem); + pick_done_locked(elem, GRPC_ERROR_REF(error)); + } else if (GPR_UNLIKELY(chand->resolver == nullptr)) { + // Shutting down. + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, "chand=%p calld=%p: resolver disconnected", chand, + calld); + } + pick_done_locked(elem, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); + } else if (GPR_UNLIKELY(chand->lb_policy == nullptr)) { + // Transient resolver failure. + // If call has wait_for_ready=true, try again; otherwise, fail. + uint32_t send_initial_metadata_flags = + calld->seen_send_initial_metadata + ? calld->send_initial_metadata_flags + : calld->pending_batches[0] + .batch->payload->send_initial_metadata + .send_initial_metadata_flags; + if (send_initial_metadata_flags & GRPC_INITIAL_METADATA_WAIT_FOR_READY) { + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, + "chand=%p calld=%p: resolver returned but no LB policy; " + "wait_for_ready=true; trying again", + chand, calld); + } + // Re-add ourselves to the waiting list. + self->AddToWaitingList(); + // Return early so that we don't set finished_ to true below. + return; + } else { + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, + "chand=%p calld=%p: resolver returned but no LB policy; " + "wait_for_ready=false; failing", + chand, calld); + } + pick_done_locked( + elem, + grpc_error_set_int( + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Name resolution failure"), + GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); + } } else { if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, - "chand=%p calld=%p: resolver returned but no LB policy; " - "wait_for_ready=false; failing", + gpr_log(GPR_INFO, "chand=%p calld=%p: resolver returned, doing LB pick", chand, calld); } - async_pick_done_locked( - elem, - grpc_error_set_int( - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Name resolution failure"), - GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE)); + process_service_config_and_start_lb_pick_locked(elem); } - } else { - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, "chand=%p calld=%p: resolver returned, doing pick", - chand, calld); + self->finished_ = true; + } + + // Invoked when the call is cancelled. + // Note: This runs under the client_channel combiner, but will NOT be + // holding the call combiner. + static void CancelLocked(void* arg, grpc_error* error) { + ResolverResultWaiter* self = static_cast(arg); + // If DoneLocked() has already run, delete ourselves without doing anything. + if (GPR_LIKELY(self->finished_)) { + Delete(self); + return; } - if (GPR_LIKELY(pick_callback_start_locked(elem))) { - // Even if the LB policy returns a result synchronously, we have - // already added our polling entity to chand->interested_parties - // in order to wait for the resolver result, so we need to - // remove it here. Therefore, we call async_pick_done_locked() - // instead of pick_done_locked(). - async_pick_done_locked(elem, GRPC_ERROR_NONE); + // If we are being cancelled, immediately invoke pick_done_locked() + // to propagate the error back to the caller. + if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) { + grpc_call_element* elem = self->elem_; + channel_data* chand = static_cast(elem->channel_data); + call_data* calld = static_cast(elem->call_data); + if (grpc_client_channel_trace.enabled()) { + gpr_log(GPR_INFO, + "chand=%p calld=%p: cancelling call waiting for name " + "resolution", + chand, calld); + } + // Note: Although we are not in the call combiner here, we are + // basically stealing the call combiner from the pending pick, so + // it's safe to call pick_done_locked() here -- we are essentially + // calling it here instead of calling it in DoneLocked(). + pick_done_locked(elem, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( + "Pick cancelled", &error, 1)); } + self->finished_ = true; } -} -static void pick_after_resolver_result_start_locked(grpc_call_element* elem) { - channel_data* chand = static_cast(elem->channel_data); - call_data* calld = static_cast(elem->call_data); - if (grpc_client_channel_trace.enabled()) { - gpr_log(GPR_INFO, - "chand=%p calld=%p: deferring pick pending resolver result", chand, - calld); - } - pick_after_resolver_result_args* args = - static_cast(gpr_zalloc(sizeof(*args))); - args->elem = elem; - GRPC_CLOSURE_INIT(&args->closure, pick_after_resolver_result_done_locked, - args, grpc_combiner_scheduler(chand->combiner)); - grpc_closure_list_append(&chand->waiting_for_resolver_result_closures, - &args->closure, GRPC_ERROR_NONE); - grpc_call_combiner_set_notify_on_cancel( - calld->call_combiner, - GRPC_CLOSURE_INIT(&args->cancel_closure, - pick_after_resolver_result_cancel_locked, args, - grpc_combiner_scheduler(chand->combiner))); -} + grpc_call_element* elem_; + grpc_closure done_closure_; + grpc_closure cancel_closure_; + bool finished_ = false; +}; + +} // namespace grpc_core static void start_pick_locked(void* arg, grpc_error* ignored) { grpc_call_element* elem = static_cast(arg); @@ -2993,31 +3034,24 @@ static void start_pick_locked(void* arg, grpc_error* ignored) { GPR_ASSERT(calld->pick.connected_subchannel == nullptr); GPR_ASSERT(calld->subchannel_call == nullptr); if (GPR_LIKELY(chand->lb_policy != nullptr)) { - // We already have an LB policy, so ask it for a pick. - if (GPR_LIKELY(pick_callback_start_locked(elem))) { - // Pick completed synchronously. - pick_done_locked(elem, GRPC_ERROR_NONE); - return; - } + // We already have resolver results, so process the service config + // and start an LB pick. + process_service_config_and_start_lb_pick_locked(elem); + } else if (GPR_UNLIKELY(chand->resolver == nullptr)) { + pick_done_locked(elem, + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); } else { // We do not yet have an LB policy, so wait for a resolver result. - if (GPR_UNLIKELY(chand->resolver == nullptr)) { - pick_done_locked(elem, - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected")); - return; - } if (GPR_UNLIKELY(!chand->started_resolving)) { start_resolving_locked(chand); } - pick_after_resolver_result_start_locked(elem); + // Create a new waiter, which will delete itself when done. + grpc_core::New(elem); + // Add the polling entity from call_data to the channel_data's + // interested_parties, so that the I/O of the resolver can be done + // under it. It will be removed in pick_done_locked(). + maybe_add_call_to_channel_interested_parties_locked(elem); } - // We need to wait for either a resolver result or for an async result - // from the LB policy. Add the polling entity from call_data to the - // channel_data's interested_parties, so that the I/O of the LB policy - // and resolver can be done under it. The polling entity will be - // removed in async_pick_done_locked(). - grpc_polling_entity_add_to_pollset_set(calld->pollent, - chand->interested_parties); } // -- cgit v1.2.3 From f6246fd01d0ca90a53494253a579e156e280be31 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Fri, 1 Jun 2018 13:03:18 -0700 Subject: Change BoringSSL home page to github for China access --- src/objective-c/BoringSSL.podspec | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec index d55a56ec18..363983183e 100644 --- a/src/objective-c/BoringSSL.podspec +++ b/src/objective-c/BoringSSL.podspec @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.name = 'BoringSSL' - version = '10.0.4' + version = '10.0.5' s.version = version s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google’s needs.' # Adapted from the homepage: @@ -61,8 +61,7 @@ Pod::Spec.new do |s| Currently BoringSSL is the SSL library in Chrome/Chromium, Android (but it’s not part of the NDK) and a number of other apps/programs. DESC - s.homepage = 'https://boringssl.googlesource.com/boringssl/' - s.documentation_url = 'https://commondatastorage.googleapis.com/chromium-boringssl-docs/headers.html' + s.homepage = 'https://github.com/google/boringssl' s.license = { :type => 'Mixed', :file => 'LICENSE' } # "The name and email addresses of the library maintainers, not the Podspec maintainer." s.authors = 'Adam Langley', 'David Benjamin', 'Matt Braithwaite' -- cgit v1.2.3 From 5a412ac1130e602779478c2250dc8ac4b1dbcdcb Mon Sep 17 00:00:00 2001 From: Juanli Shen Date: Mon, 7 May 2018 20:25:44 -0700 Subject: Revert "Revert "Revert "Provide protocol for initializer of generated messages""" --- src/compiler/objective_c_generator.cc | 3 +-- src/objective-c/ProtoRPC/ProtoService.h | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc index e97494f64c..39f68cb956 100644 --- a/src/compiler/objective_c_generator.cc +++ b/src/compiler/objective_c_generator.cc @@ -222,8 +222,7 @@ void PrintMethodImplementations(Printer* printer, map< ::grpc::string, ::grpc::string> vars = { {"service_class", ServiceClassName(service)}}; - printer.Print( - vars, "@protocol $service_class$ \n\n"); + printer.Print(vars, "@protocol $service_class$ \n\n"); for (int i = 0; i < service->method_count(); i++) { PrintMethodDeclarations(&printer, service->method(i)); } diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h index c411bed60f..29c4e9be36 100644 --- a/src/objective-c/ProtoRPC/ProtoService.h +++ b/src/objective-c/ProtoRPC/ProtoService.h @@ -22,12 +22,6 @@ @protocol GRXWriteable; @class GRXWriter; -@protocol GRPCProtoServiceInit - -- (instancetype)initWithHost:(NSString *)host; - -@end - __attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService : NSObject - (instancetype)initWithHost : (NSString *)host packageName -- cgit v1.2.3 From 51ea031516f25509aeaf52c46aaae626c6f0842d Mon Sep 17 00:00:00 2001 From: kpayson64 Date: Fri, 1 Jun 2018 13:34:03 -0700 Subject: Bump 1.12.1 --- BUILD | 2 +- CMakeLists.txt | 2 +- Makefile | 4 ++-- build.yaml | 2 +- gRPC-C++.podspec | 4 ++-- gRPC-Core.podspec | 2 +- gRPC-ProtoRPC.podspec | 2 +- gRPC-RxLibrary.podspec | 2 +- gRPC.podspec | 2 +- package.xml | 4 ++-- src/cpp/common/version_cc.cc | 2 +- src/csharp/Grpc.Core/Version.csproj.include | 2 +- src/csharp/Grpc.Core/VersionInfo.cs | 4 ++-- src/csharp/build_packages_dotnetcli.bat | 2 +- src/csharp/build_packages_dotnetcli.sh | 4 ++-- src/objective-c/!ProtoCompiler-gRPCPlugin.podspec | 2 +- src/objective-c/GRPCClient/private/version.h | 2 +- src/objective-c/tests/version.h | 2 +- src/php/composer.json | 2 +- src/php/ext/grpc/version.h | 2 +- src/python/grpcio/grpc/_grpcio_metadata.py | 2 +- src/python/grpcio/grpc_version.py | 2 +- src/python/grpcio_health_checking/grpc_version.py | 2 +- src/python/grpcio_reflection/grpc_version.py | 2 +- src/python/grpcio_testing/grpc_version.py | 2 +- src/python/grpcio_tests/grpc_version.py | 2 +- src/ruby/lib/grpc/version.rb | 2 +- src/ruby/tools/version.rb | 2 +- tools/distrib/python/grpcio_tools/grpc_version.py | 2 +- tools/doxygen/Doxyfile.c++ | 2 +- tools/doxygen/Doxyfile.c++.internal | 2 +- 31 files changed, 36 insertions(+), 36 deletions(-) diff --git a/BUILD b/BUILD index 457c5f60ee..30871d7ea0 100644 --- a/BUILD +++ b/BUILD @@ -68,7 +68,7 @@ g_stands_for = "glorious" core_version = "6.0.0" -version = "1.12.0" +version = "1.12.1" GPR_PUBLIC_HDRS = [ "include/grpc/support/alloc.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index f58ee194f1..86ae6d470f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ cmake_minimum_required(VERSION 2.8) set(PACKAGE_NAME "grpc") -set(PACKAGE_VERSION "1.12.0") +set(PACKAGE_VERSION "1.12.1") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") set(PACKAGE_BUGREPORT "https://github.com/grpc/grpc/issues/") diff --git a/Makefile b/Makefile index a7f0c7d6f3..d1fa57d1f0 100644 --- a/Makefile +++ b/Makefile @@ -421,8 +421,8 @@ Q = @ endif CORE_VERSION = 6.0.0 -CPP_VERSION = 1.12.0 -CSHARP_VERSION = 1.12.0 +CPP_VERSION = 1.12.1 +CSHARP_VERSION = 1.12.1 CPPFLAGS_NO_ARCH += $(addprefix -I, $(INCLUDES)) $(addprefix -D, $(DEFINES)) CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS) diff --git a/build.yaml b/build.yaml index 115f9e7fc9..9a707c8b37 100644 --- a/build.yaml +++ b/build.yaml @@ -14,7 +14,7 @@ settings: '#10': See the expand_version.py for all the quirks here core_version: 6.0.0 g_stands_for: glorious - version: 1.12.0 + version: 1.12.1 filegroups: - name: alts_proto headers: diff --git a/gRPC-C++.podspec b/gRPC-C++.podspec index 6ad71e9221..7838add68f 100644 --- a/gRPC-C++.podspec +++ b/gRPC-C++.podspec @@ -23,7 +23,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-C++' # TODO (mxyan): use version that match gRPC version when pod is stabilized - # version = '1.12.0' + # version = '1.12.1' version = '0.0.2' s.version = version s.summary = 'gRPC C++ library' @@ -31,7 +31,7 @@ Pod::Spec.new do |s| s.license = 'Apache License, Version 2.0' s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' } - grpc_version = '1.12.0' + grpc_version = '1.12.1' s.source = { :git => 'https://github.com/grpc/grpc.git', diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 5409f4bd2e..5c70efaf8f 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -22,7 +22,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-Core' - version = '1.12.0' + version = '1.12.1' s.version = version s.summary = 'Core cross-platform gRPC library, written in C' s.homepage = 'https://grpc.io' diff --git a/gRPC-ProtoRPC.podspec b/gRPC-ProtoRPC.podspec index 27e1c9458b..7955c9f374 100644 --- a/gRPC-ProtoRPC.podspec +++ b/gRPC-ProtoRPC.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-ProtoRPC' - version = '1.12.0' + version = '1.12.1' s.version = version s.summary = 'RPC library for Protocol Buffers, based on gRPC' s.homepage = 'https://grpc.io' diff --git a/gRPC-RxLibrary.podspec b/gRPC-RxLibrary.podspec index bf57d318c7..e2a23e6246 100644 --- a/gRPC-RxLibrary.podspec +++ b/gRPC-RxLibrary.podspec @@ -21,7 +21,7 @@ Pod::Spec.new do |s| s.name = 'gRPC-RxLibrary' - version = '1.12.0' + version = '1.12.1' s.version = version s.summary = 'Reactive Extensions library for iOS/OSX.' s.homepage = 'https://grpc.io' diff --git a/gRPC.podspec b/gRPC.podspec index 730cd4908a..9fb2bc0681 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -20,7 +20,7 @@ Pod::Spec.new do |s| s.name = 'gRPC' - version = '1.12.0' + version = '1.12.1' s.version = version s.summary = 'gRPC client library for iOS/OSX' s.homepage = 'https://grpc.io' diff --git a/package.xml b/package.xml index 6ce9bd177f..0623c472af 100644 --- a/package.xml +++ b/package.xml @@ -13,8 +13,8 @@ 2018-01-19 - 1.12.0 - 1.12.0 + 1.12.1 + 1.12.1 stable diff --git a/src/cpp/common/version_cc.cc b/src/cpp/common/version_cc.cc index 61a9f9fa53..aef19eb446 100644 --- a/src/cpp/common/version_cc.cc +++ b/src/cpp/common/version_cc.cc @@ -22,5 +22,5 @@ #include namespace grpc { -grpc::string Version() { return "1.12.0"; } +grpc::string Version() { return "1.12.1"; } } // namespace grpc diff --git a/src/csharp/Grpc.Core/Version.csproj.include b/src/csharp/Grpc.Core/Version.csproj.include index d11510440e..38a713454c 100755 --- a/src/csharp/Grpc.Core/Version.csproj.include +++ b/src/csharp/Grpc.Core/Version.csproj.include @@ -1,7 +1,7 @@ - 1.12.0 + 1.12.1 3.5.1 diff --git a/src/csharp/Grpc.Core/VersionInfo.cs b/src/csharp/Grpc.Core/VersionInfo.cs index 56af8884bc..7c84bb84b8 100644 --- a/src/csharp/Grpc.Core/VersionInfo.cs +++ b/src/csharp/Grpc.Core/VersionInfo.cs @@ -33,11 +33,11 @@ namespace Grpc.Core /// /// Current AssemblyFileVersion of gRPC C# assemblies /// - public const string CurrentAssemblyFileVersion = "1.12.0.0"; + public const string CurrentAssemblyFileVersion = "1.12.1.0"; /// /// Current version of gRPC C# /// - public const string CurrentVersion = "1.12.0"; + public const string CurrentVersion = "1.12.1"; } } diff --git a/src/csharp/build_packages_dotnetcli.bat b/src/csharp/build_packages_dotnetcli.bat index be895a32dd..9d82a67d57 100755 --- a/src/csharp/build_packages_dotnetcli.bat +++ b/src/csharp/build_packages_dotnetcli.bat @@ -13,7 +13,7 @@ @rem limitations under the License. @rem Current package versions -set VERSION=1.12.0 +set VERSION=1.12.1 @rem Adjust the location of nuget.exe set NUGET=C:\nuget\nuget.exe diff --git a/src/csharp/build_packages_dotnetcli.sh b/src/csharp/build_packages_dotnetcli.sh index fc17da3e25..b3f7fc85a1 100755 --- a/src/csharp/build_packages_dotnetcli.sh +++ b/src/csharp/build_packages_dotnetcli.sh @@ -45,7 +45,7 @@ dotnet pack --configuration Release Grpc.Auth --output ../../../artifacts dotnet pack --configuration Release Grpc.HealthCheck --output ../../../artifacts dotnet pack --configuration Release Grpc.Reflection --output ../../../artifacts -nuget pack Grpc.nuspec -Version "1.12.0" -OutputDirectory ../../artifacts -nuget pack Grpc.Tools.nuspec -Version "1.12.0" -OutputDirectory ../../artifacts +nuget pack Grpc.nuspec -Version "1.12.1" -OutputDirectory ../../artifacts +nuget pack Grpc.Tools.nuspec -Version "1.12.1" -OutputDirectory ../../artifacts (cd ../../artifacts && zip csharp_nugets_dotnetcli.zip *.nupkg) diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec index f4a181655b..34811c6cf0 100644 --- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec +++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec @@ -42,7 +42,7 @@ Pod::Spec.new do |s| # exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed # before them. s.name = '!ProtoCompiler-gRPCPlugin' - v = '1.12.0' + v = '1.12.1' s.version = v s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.' s.description = <<-DESC diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/private/version.h index 41f0992686..508c706744 100644 --- a/src/objective-c/GRPCClient/private/version.h +++ b/src/objective-c/GRPCClient/private/version.h @@ -22,4 +22,4 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.12.0" +#define GRPC_OBJC_VERSION_STRING @"1.12.1" diff --git a/src/objective-c/tests/version.h b/src/objective-c/tests/version.h index 8073888f76..f4c9702598 100644 --- a/src/objective-c/tests/version.h +++ b/src/objective-c/tests/version.h @@ -22,5 +22,5 @@ // instead. This file can be regenerated from the template by running // `tools/buildgen/generate_projects.sh`. -#define GRPC_OBJC_VERSION_STRING @"1.12.0" +#define GRPC_OBJC_VERSION_STRING @"1.12.1" #define GRPC_C_VERSION_STRING @"6.0.0" diff --git a/src/php/composer.json b/src/php/composer.json index 57d911db79..b2a3063ea2 100644 --- a/src/php/composer.json +++ b/src/php/composer.json @@ -2,7 +2,7 @@ "name": "grpc/grpc-dev", "description": "gRPC library for PHP - for Developement use only", "license": "Apache-2.0", - "version": "1.12.0", + "version": "1.12.1", "require": { "php": ">=5.5.0", "google/protobuf": "^v3.3.0" diff --git a/src/php/ext/grpc/version.h b/src/php/ext/grpc/version.h index 33a1d75cb6..2e337579c8 100644 --- a/src/php/ext/grpc/version.h +++ b/src/php/ext/grpc/version.h @@ -20,6 +20,6 @@ #ifndef VERSION_H #define VERSION_H -#define PHP_GRPC_VERSION "1.12.0" +#define PHP_GRPC_VERSION "1.12.1" #endif /* VERSION_H */ diff --git a/src/python/grpcio/grpc/_grpcio_metadata.py b/src/python/grpcio/grpc/_grpcio_metadata.py index 2742d5f06d..5696ef4a40 100644 --- a/src/python/grpcio/grpc/_grpcio_metadata.py +++ b/src/python/grpcio/grpc/_grpcio_metadata.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc/_grpcio_metadata.py.template`!!! -__version__ = """1.12.0""" +__version__ = """1.12.1""" diff --git a/src/python/grpcio/grpc_version.py b/src/python/grpcio/grpc_version.py index 0b36438551..83cb55e372 100644 --- a/src/python/grpcio/grpc_version.py +++ b/src/python/grpcio/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio/grpc_version.py.template`!!! -VERSION = '1.12.0' +VERSION = '1.12.1' diff --git a/src/python/grpcio_health_checking/grpc_version.py b/src/python/grpcio_health_checking/grpc_version.py index 4942c78980..05987f3ac0 100644 --- a/src/python/grpcio_health_checking/grpc_version.py +++ b/src/python/grpcio_health_checking/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_health_checking/grpc_version.py.template`!!! -VERSION = '1.12.0' +VERSION = '1.12.1' diff --git a/src/python/grpcio_reflection/grpc_version.py b/src/python/grpcio_reflection/grpc_version.py index 35b20734dd..54530c42a2 100644 --- a/src/python/grpcio_reflection/grpc_version.py +++ b/src/python/grpcio_reflection/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_reflection/grpc_version.py.template`!!! -VERSION = '1.12.0' +VERSION = '1.12.1' diff --git a/src/python/grpcio_testing/grpc_version.py b/src/python/grpcio_testing/grpc_version.py index 24296d2fe5..5e67cfcf21 100644 --- a/src/python/grpcio_testing/grpc_version.py +++ b/src/python/grpcio_testing/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_testing/grpc_version.py.template`!!! -VERSION = '1.12.0' +VERSION = '1.12.1' diff --git a/src/python/grpcio_tests/grpc_version.py b/src/python/grpcio_tests/grpc_version.py index f303e53010..0bc911c572 100644 --- a/src/python/grpcio_tests/grpc_version.py +++ b/src/python/grpcio_tests/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/src/python/grpcio_tests/grpc_version.py.template`!!! -VERSION = '1.12.0' +VERSION = '1.12.1' diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index d949bf5e27..a6f04dd2e5 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -14,5 +14,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '1.12.0' + VERSION = '1.12.1' end diff --git a/src/ruby/tools/version.rb b/src/ruby/tools/version.rb index c56568a206..f7737ab681 100644 --- a/src/ruby/tools/version.rb +++ b/src/ruby/tools/version.rb @@ -14,6 +14,6 @@ module GRPC module Tools - VERSION = '1.12.0' + VERSION = '1.12.1' end end diff --git a/tools/distrib/python/grpcio_tools/grpc_version.py b/tools/distrib/python/grpcio_tools/grpc_version.py index e9430a0f21..dae87253d1 100644 --- a/tools/distrib/python/grpcio_tools/grpc_version.py +++ b/tools/distrib/python/grpcio_tools/grpc_version.py @@ -14,4 +14,4 @@ # AUTO-GENERATED FROM `$REPO_ROOT/templates/tools/distrib/python/grpcio_tools/grpc_version.py.template`!!! -VERSION = '1.12.0' +VERSION = '1.12.1' diff --git a/tools/doxygen/Doxyfile.c++ b/tools/doxygen/Doxyfile.c++ index 77ae01d82d..1201e34a2c 100644 --- a/tools/doxygen/Doxyfile.c++ +++ b/tools/doxygen/Doxyfile.c++ @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.12.0 +PROJECT_NUMBER = 1.12.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 07350d57fd..810ad64e79 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -40,7 +40,7 @@ PROJECT_NAME = "GRPC C++" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.12.0 +PROJECT_NUMBER = 1.12.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a -- cgit v1.2.3 From ebb53843b65942f7e05a179961558233b39bebb7 Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Fri, 1 Jun 2018 14:48:13 -0700 Subject: Remove orphaned test. --- test/cpp/end2end/round_robin_end2end_test.cc | 226 --------------------------- 1 file changed, 226 deletions(-) delete mode 100644 test/cpp/end2end/round_robin_end2end_test.cc diff --git a/test/cpp/end2end/round_robin_end2end_test.cc b/test/cpp/end2end/round_robin_end2end_test.cc deleted file mode 100644 index 846347e110..0000000000 --- a/test/cpp/end2end/round_robin_end2end_test.cc +++ /dev/null @@ -1,226 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * 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. - * - */ - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "src/proto/grpc/testing/echo.grpc.pb.h" -#include "test/core/util/port.h" -#include "test/core/util/test_config.h" -#include "test/cpp/end2end/test_service_impl.h" - -#include - -using grpc::testing::EchoRequest; -using grpc::testing::EchoResponse; -using std::chrono::system_clock; - -namespace grpc { -namespace testing { -namespace { - -// Subclass of TestServiceImpl that increments a request counter for -// every call to the Echo RPC. -class MyTestServiceImpl : public TestServiceImpl { - public: - MyTestServiceImpl() : request_count_(0) {} - - Status Echo(ServerContext* context, const EchoRequest* request, - EchoResponse* response) override { - { - std::unique_lock lock(mu_); - ++request_count_; - } - return TestServiceImpl::Echo(context, request, response); - } - - int request_count() { - std::unique_lock lock(mu_); - return request_count_; - } - - private: - std::mutex mu_; - int request_count_; -}; - -class RoundRobinEnd2endTest : public ::testing::Test { - protected: - RoundRobinEnd2endTest() : server_host_("localhost") {} - - void StartServers(size_t num_servers, - std::vector ports = std::vector()) { - for (size_t i = 0; i < num_servers; ++i) { - int port = 0; - if (ports.size() == num_servers) port = ports[i]; - servers_.emplace_back(new ServerData(server_host_, port)); - } - } - - void TearDown() override { - for (size_t i = 0; i < servers_.size(); ++i) { - servers_[i]->Shutdown(); - } - } - - void ResetStub(bool round_robin) { - ChannelArguments args; - if (round_robin) args.SetLoadBalancingPolicyName("round_robin"); - std::ostringstream uri; - uri << "ipv4:///"; - for (size_t i = 0; i < servers_.size() - 1; ++i) { - uri << "127.0.0.1:" << servers_[i]->port_ << ","; - } - uri << "127.0.0.1:" << servers_[servers_.size() - 1]->port_; - channel_ = - CreateCustomChannel(uri.str(), InsecureChannelCredentials(), args); - stub_ = grpc::testing::EchoTestService::NewStub(channel_); - } - - void SendRpc(int num_rpcs, bool expect_ok = true) { - EchoRequest request; - EchoResponse response; - request.set_message("Live long and prosper."); - for (int i = 0; i < num_rpcs; i++) { - ClientContext context; - Status status = stub_->Echo(&context, request, &response); - if (expect_ok) { - EXPECT_TRUE(status.ok()); - EXPECT_EQ(response.message(), request.message()); - } else { - EXPECT_FALSE(status.ok()); - } - } - } - - struct ServerData { - int port_; - std::unique_ptr server_; - MyTestServiceImpl service_; - - explicit ServerData(const grpc::string& server_host, int port = 0) { - port_ = port > 0 ? port : grpc_pick_unused_port_or_die(); - gpr_log(GPR_INFO, "starting server on port %d", port_); - std::ostringstream server_address; - server_address << server_host << ":" << port_; - ServerBuilder builder; - builder.AddListeningPort(server_address.str(), - InsecureServerCredentials()); - builder.RegisterService(&service_); - server_ = builder.BuildAndStart(); - gpr_log(GPR_INFO, "server startup complete"); - } - - void Shutdown() { server_->Shutdown(); } - }; - - const grpc::string server_host_; - std::shared_ptr channel_; - std::unique_ptr stub_; - std::vector> servers_; -}; - -TEST_F(RoundRobinEnd2endTest, PickFirst) { - // Start servers and send one RPC per server. - const int kNumServers = 3; - StartServers(kNumServers); - ResetStub(false /* round_robin */); - SendRpc(kNumServers); - // All requests should have gone to a single server. - bool found = false; - for (size_t i = 0; i < servers_.size(); ++i) { - const int request_count = servers_[i]->service_.request_count(); - if (request_count == kNumServers) { - found = true; - } else { - EXPECT_EQ(0, request_count); - } - } - EXPECT_TRUE(found); - // Check LB policy name for the channel. - EXPECT_EQ("pick_first", channel_->GetLoadBalancingPolicyName()); -} - -TEST_F(RoundRobinEnd2endTest, RoundRobin) { - // Start servers and send one RPC per server. - const int kNumServers = 3; - StartServers(kNumServers); - ResetStub(true /* round_robin */); - // Send one RPC per backend and make sure they are used in order. - // Note: This relies on the fact that the subchannels are reported in - // state READY in the order in which the addresses are specified, - // which is only true because the backends are all local. - for (size_t i = 0; i < servers_.size(); ++i) { - SendRpc(1); - EXPECT_EQ(1, servers_[i]->service_.request_count()) << "for backend #" << i; - } - // Check LB policy name for the channel. - EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName()); -} - -TEST_F(RoundRobinEnd2endTest, RoundRobinReconnect) { - // Start servers and send one RPC per server. - const int kNumServers = 1; - std::vector ports; - ports.push_back(grpc_pick_unused_port_or_die()); - StartServers(kNumServers, ports); - ResetStub(true /* round_robin */); - // Send one RPC per backend and make sure they are used in order. - // Note: This relies on the fact that the subchannels are reported in - // state READY in the order in which the addresses are specified, - // which is only true because the backends are all local. - for (size_t i = 0; i < servers_.size(); ++i) { - SendRpc(1); - EXPECT_EQ(1, servers_[i]->service_.request_count()) << "for backend #" << i; - } - // Check LB policy name for the channel. - EXPECT_EQ("round_robin", channel_->GetLoadBalancingPolicyName()); - - // Kill all servers - for (size_t i = 0; i < servers_.size(); ++i) { - servers_[i]->Shutdown(); - } - // Client request should fail. - SendRpc(1, false); - - // Bring servers back up on the same port (we aren't recreating the channel). - StartServers(kNumServers, ports); - - // Client request should succeed. - SendRpc(1); -} - -} // namespace -} // namespace testing -} // namespace grpc - -int main(int argc, char** argv) { - grpc_test_init(argc, argv); - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -- cgit v1.2.3 From c4b510246c0049d3c583efa8c6e7606b1131231c Mon Sep 17 00:00:00 2001 From: kailashs Date: Sun, 3 Jun 2018 13:39:32 -0700 Subject: Updated cc_grpc_library to refer to fully qualified rules including workspace name. This removes the need for the use_external = True flag for out of workspace build of gRPC client/server code. --- bazel/cc_grpc_library.bzl | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/bazel/cc_grpc_library.bzl b/bazel/cc_grpc_library.bzl index 5216a7a44b..3288565714 100644 --- a/bazel/cc_grpc_library.bzl +++ b/bazel/cc_grpc_library.bzl @@ -43,12 +43,7 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo ) if not proto_only: - if use_external: - # when this file is used by non-grpc projects - plugin = "//external:grpc_cpp_plugin" - else: - plugin = "//:grpc_cpp_plugin" - + plugin = "@com_github_grpc_grpc//:grpc_cpp_plugin" generate_cc( name = codegen_grpc_target, srcs = [proto_target], @@ -57,14 +52,8 @@ def cc_grpc_library(name, srcs, deps, proto_only, well_known_protos, generate_mo generate_mocks = generate_mocks, **kwargs ) - - if use_external: - # when this file is used by non-grpc projects - grpc_deps = ["//external:grpc++_codegen_proto", - "//external:protobuf"] - else: - grpc_deps = ["//:grpc++_codegen_proto", "//external:protobuf"] - + grpc_deps = ["@com_github_grpc_grpc//:grpc++_codegen_proto", + "//external:protobuf"] native.cc_library( name = name, srcs = [":" + codegen_grpc_target, ":" + codegen_target], -- cgit v1.2.3