Merge branch 'v1.0.x' into manual-upmerge

Conflicts:
	src/ruby/pb/test/client.rb
	src/ruby/pb/test/server.rb
	tools/dockerfile/test/php7_jessie_x64/Dockerfile
pull/7584/head
Nicolas "Pixel" Noble 8 years ago
commit 8302b123de
  1. 30
      examples/objective-c/auth_sample/Misc/GoogleService-Info.plist
  2. 4
      src/compiler/ruby_generator_helpers-inl.h
  3. 6
      src/csharp/.nuget/packages.config
  4. 3
      src/csharp/Grpc.Core.Tests/packages.config
  5. 5
      src/csharp/Grpc.Core.Tests/project.json
  6. 3
      src/csharp/Grpc.Examples.MathClient/packages.config
  7. 3
      src/csharp/Grpc.Examples.MathServer/packages.config
  8. 3
      src/csharp/Grpc.IntegrationTesting.QpsWorker/packages.config
  9. 3
      src/csharp/Grpc.IntegrationTesting.StressClient/packages.config
  10. 30
      src/node/ext/call_credentials.cc
  11. 4
      src/node/health_check/package.json
  12. 5
      src/node/src/credentials.js
  13. 4
      src/ruby/.rubocop.yml
  14. 2
      src/ruby/bin/math_client.rb
  15. 0
      src/ruby/bin/math_pb.rb
  16. 2
      src/ruby/bin/math_server.rb
  17. 2
      src/ruby/bin/math_services_pb.rb
  18. 2
      src/ruby/pb/grpc/health/checker.rb
  19. 0
      src/ruby/pb/grpc/health/v1/health_pb.rb
  20. 2
      src/ruby/pb/grpc/health/v1/health_services_pb.rb
  21. 4
      src/ruby/pb/grpc/testing/duplicate/echo_duplicate_services_pb.rb
  22. 2
      src/ruby/pb/grpc/testing/metrics_pb.rb
  23. 4
      src/ruby/pb/grpc/testing/metrics_services_pb.rb
  24. 0
      src/ruby/pb/src/proto/grpc/testing/empty_pb.rb
  25. 0
      src/ruby/pb/src/proto/grpc/testing/messages_pb.rb
  26. 4
      src/ruby/pb/src/proto/grpc/testing/test_pb.rb
  27. 2
      src/ruby/pb/src/proto/grpc/testing/test_services_pb.rb
  28. 6
      src/ruby/pb/test/client.rb
  29. 6
      src/ruby/pb/test/server.rb
  30. 2
      src/ruby/qps/client.rb
  31. 6
      src/ruby/qps/server.rb
  32. 6
      src/ruby/qps/src/proto/grpc/testing/control_pb.rb
  33. 0
      src/ruby/qps/src/proto/grpc/testing/messages_pb.rb
  34. 0
      src/ruby/qps/src/proto/grpc/testing/payloads_pb.rb
  35. 4
      src/ruby/qps/src/proto/grpc/testing/services_pb.rb
  36. 2
      src/ruby/qps/src/proto/grpc/testing/services_services_pb.rb
  37. 0
      src/ruby/qps/src/proto/grpc/testing/stats_pb.rb
  38. 2
      src/ruby/qps/worker.rb
  39. 4
      src/ruby/spec/pb/duplicate/codegen_spec.rb
  40. 8
      src/ruby/spec/pb/health/checker_spec.rb
  41. 4
      src/ruby/stress/metrics_server.rb
  42. 17
      src/ruby/tools/bin/grpc_tools_ruby_protoc
  43. 0
      src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin
  44. 2
      src/ruby/tools/grpc-tools.gemspec
  45. 5
      templates/src/csharp/Grpc.Core.Tests/project.json.template
  46. 4
      templates/src/node/health_check/package.json.template
  47. 7
      test/cpp/end2end/server_builder_plugin_test.cc
  48. 55
      tools/run_tests/pre_build_csharp.bat
  49. 51
      tools/run_tests/pre_build_csharp.sh

@ -2,9 +2,39 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>AD_UNIT_ID_FOR_BANNER_TEST</key>
<string>redacted</string>
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
<string>redacted</string>
<key>CLIENT_ID</key> <key>CLIENT_ID</key>
<string>15087385131-lh9bpkiai9nls53uadju0if6k7un3uih.apps.googleusercontent.com</string> <string>15087385131-lh9bpkiai9nls53uadju0if6k7un3uih.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key> <key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.15087385131-lh9bpkiai9nls53uadju0if6k7un3uih</string> <string>com.googleusercontent.apps.15087385131-lh9bpkiai9nls53uadju0if6k7un3uih</string>
<key>API_KEY</key>
<string>redacted</string>
<key>GCM_SENDER_ID</key>
<string>redacted</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>io.grpc.AuthSample</string>
<key>PROJECT_ID</key>
<string>grpc-authsample</string>
<key>STORAGE_BUCKET</key>
<string>grpc-authsample.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false/>
<key>IS_ANALYTICS_ENABLED</key>
<false/>
<key>IS_APPINVITE_ENABLED</key>
<false/>
<key>IS_GCM_ENABLED</key>
<false/>
<key>IS_SIGNIN_ENABLED</key>
<true/>
<key>GOOGLE_APP_ID</key>
<string>1:15087385131:ios:d547168abe3c362f</string>
<key>DATABASE_URL</key>
<string>https://grpc-authsample.firebaseio.com</string>
</dict> </dict>
</plist> </plist>

@ -48,7 +48,7 @@ inline bool ServicesFilename(const grpc::protobuf::FileDescriptor *file,
file->name().find_last_of(".proto") == file->name().size() - 1) { file->name().find_last_of(".proto") == file->name().size() - 1) {
*file_name_or_error = *file_name_or_error =
file->name().substr(0, file->name().size() - proto_suffix_length) + file->name().substr(0, file->name().size() - proto_suffix_length) +
"_services.rb"; "_services_pb.rb";
return true; return true;
} else { } else {
*file_name_or_error = "Invalid proto file name: must end with .proto"; *file_name_or_error = "Invalid proto file name: must end with .proto";
@ -58,7 +58,7 @@ inline bool ServicesFilename(const grpc::protobuf::FileDescriptor *file,
inline grpc::string MessagesRequireName( inline grpc::string MessagesRequireName(
const grpc::protobuf::FileDescriptor *file) { const grpc::protobuf::FileDescriptor *file) {
return Replace(file->name(), ".proto", ""); return Replace(file->name(), ".proto", "_pb");
} }
// Get leading or trailing comments in a string. Comment lines start with "# ". // Get leading or trailing comments in a string. Comment lines start with "# ".

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="NUnit.ConsoleRunner" version="3.2.0" />
<package id="OpenCover" version="4.6.519" />
<package id="ReportGenerator" version="2.4.4.0" />
</packages>

@ -4,4 +4,7 @@
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="NUnit" version="3.2.0" targetFramework="net45" /> <package id="NUnit" version="3.2.0" targetFramework="net45" />
<package id="NUnitLite" version="3.2.0" targetFramework="net45" /> <package id="NUnitLite" version="3.2.0" targetFramework="net45" />
<package id="NUnit.ConsoleRunner" version="3.2.0" />
<package id="OpenCover" version="4.6.519" />
<package id="ReportGenerator" version="2.4.4.0" />
</packages> </packages>

@ -54,7 +54,10 @@
}, },
"Newtonsoft.Json": "8.0.3", "Newtonsoft.Json": "8.0.3",
"NUnit": "3.2.0", "NUnit": "3.2.0",
"NUnitLite": "3.2.0-*" "NUnitLite": "3.2.0-*",
"NUnit.ConsoleRunner": "3.2.0",
"OpenCover": "4.6.519",
"ReportGenerator": "2.4.4.0"
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
</packages>

@ -68,6 +68,8 @@ using v8::Value;
Nan::Callback *CallCredentials::constructor; Nan::Callback *CallCredentials::constructor;
Persistent<FunctionTemplate> CallCredentials::fun_tpl; Persistent<FunctionTemplate> CallCredentials::fun_tpl;
static Callback *plugin_callback;
CallCredentials::CallCredentials(grpc_call_credentials *credentials) CallCredentials::CallCredentials(grpc_call_credentials *credentials)
: wrapped_credentials(credentials) {} : wrapped_credentials(credentials) {}
@ -88,6 +90,11 @@ void CallCredentials::Init(Local<Object> exports) {
Nan::New<FunctionTemplate>(CreateFromPlugin)).ToLocalChecked()); Nan::New<FunctionTemplate>(CreateFromPlugin)).ToLocalChecked());
Nan::Set(exports, Nan::New("CallCredentials").ToLocalChecked(), ctr); Nan::Set(exports, Nan::New("CallCredentials").ToLocalChecked(), ctr);
constructor = new Nan::Callback(ctr); constructor = new Nan::Callback(ctr);
Local<FunctionTemplate> callback_tpl =
Nan::New<FunctionTemplate>(PluginCallback);
plugin_callback = new Callback(
Nan::GetFunction(callback_tpl).ToLocalChecked());
} }
bool CallCredentials::HasInstance(Local<Value> val) { bool CallCredentials::HasInstance(Local<Value> val) {
@ -195,23 +202,28 @@ NAN_METHOD(PluginCallback) {
return Nan::ThrowTypeError( return Nan::ThrowTypeError(
"The callback's third argument must be an object"); "The callback's third argument must be an object");
} }
if (!info[3]->IsObject()) {
return Nan::ThrowTypeError(
"The callback's fourth argument must be an object");
}
shared_ptr<Resources> resources(new Resources); shared_ptr<Resources> resources(new Resources);
grpc_status_code code = static_cast<grpc_status_code>( grpc_status_code code = static_cast<grpc_status_code>(
Nan::To<uint32_t>(info[0]).FromJust()); Nan::To<uint32_t>(info[0]).FromJust());
Utf8String details_utf8_str(info[1]); Utf8String details_utf8_str(info[1]);
char *details = *details_utf8_str; char *details = *details_utf8_str;
grpc_metadata_array array; grpc_metadata_array array;
Local<Object> callback_data = Nan::To<Object>(info[3]).ToLocalChecked();
if (!CreateMetadataArray(Nan::To<Object>(info[2]).ToLocalChecked(), if (!CreateMetadataArray(Nan::To<Object>(info[2]).ToLocalChecked(),
&array, resources)){ &array, resources)){
return Nan::ThrowError("Failed to parse metadata"); return Nan::ThrowError("Failed to parse metadata");
} }
grpc_credentials_plugin_metadata_cb cb = grpc_credentials_plugin_metadata_cb cb =
reinterpret_cast<grpc_credentials_plugin_metadata_cb>( reinterpret_cast<grpc_credentials_plugin_metadata_cb>(
Nan::Get(info.Callee(), Nan::Get(callback_data,
Nan::New("cb").ToLocalChecked() Nan::New("cb").ToLocalChecked()
).ToLocalChecked().As<External>()->Value()); ).ToLocalChecked().As<External>()->Value());
void *user_data = void *user_data =
Nan::Get(info.Callee(), Nan::Get(callback_data,
Nan::New("user_data").ToLocalChecked() Nan::New("user_data").ToLocalChecked()
).ToLocalChecked().As<External>()->Value(); ).ToLocalChecked().As<External>()->Value();
cb(user_data, array.metadata, array.count, code, details); cb(user_data, array.metadata, array.count, code, details);
@ -227,17 +239,17 @@ NAUV_WORK_CB(SendPluginCallback) {
while (!callbacks.empty()) { while (!callbacks.empty()) {
plugin_callback_data *data = callbacks.front(); plugin_callback_data *data = callbacks.front();
callbacks.pop_front(); callbacks.pop_front();
// Attach cb and user_data to plugin_callback so that it can access them later Local<Object> callback_data = Nan::New<Object>();
v8::Local<v8::Function> plugin_callback = Nan::GetFunction( Nan::Set(callback_data, Nan::New("cb").ToLocalChecked(),
Nan::New<v8::FunctionTemplate>(PluginCallback)).ToLocalChecked();
Nan::Set(plugin_callback, Nan::New("cb").ToLocalChecked(),
Nan::New<v8::External>(reinterpret_cast<void*>(data->cb))); Nan::New<v8::External>(reinterpret_cast<void*>(data->cb)));
Nan::Set(plugin_callback, Nan::New("user_data").ToLocalChecked(), Nan::Set(callback_data, Nan::New("user_data").ToLocalChecked(),
Nan::New<v8::External>(data->user_data)); Nan::New<v8::External>(data->user_data));
const int argc = 2; const int argc = 3;
v8::Local<v8::Value> argv[argc] = { v8::Local<v8::Value> argv[argc] = {
Nan::New(data->service_url).ToLocalChecked(), Nan::New(data->service_url).ToLocalChecked(),
plugin_callback callback_data,
// Get Local<Function> from Nan::Callback*
**plugin_callback
}; };
Nan::Callback *callback = state->callback; Nan::Callback *callback = state->callback;
callback->Call(argc, argv); callback->Call(argc, argv);

@ -19,11 +19,11 @@
"lodash": "^3.9.3", "lodash": "^3.9.3",
"google-protobuf": "^3.0.0-alpha.5" "google-protobuf": "^3.0.0-alpha.5"
}, },
"files": { "files": [
"LICENSE", "LICENSE",
"health.js", "health.js",
"v1" "v1"
}, ],
"main": "src/node/index.js", "main": "src/node/index.js",
"license": "BSD-3-Clause" "license": "BSD-3-Clause"
} }

@ -92,7 +92,8 @@ exports.createSsl = ChannelCredentials.createSsl;
* @return {CallCredentials} The credentials object * @return {CallCredentials} The credentials object
*/ */
exports.createFromMetadataGenerator = function(metadata_generator) { exports.createFromMetadataGenerator = function(metadata_generator) {
return CallCredentials.createFromPlugin(function(service_url, callback) { return CallCredentials.createFromPlugin(function(service_url, cb_data,
callback) {
metadata_generator({service_url: service_url}, function(error, metadata) { metadata_generator({service_url: service_url}, function(error, metadata) {
var code = grpc.status.OK; var code = grpc.status.OK;
var message = ''; var message = '';
@ -107,7 +108,7 @@ exports.createFromMetadataGenerator = function(metadata_generator) {
metadata = new Metadata(); metadata = new Metadata();
} }
} }
callback(code, message, metadata._getCoreRepresentation()); callback(code, message, metadata._getCoreRepresentation(), cb_data);
}); });
}); });
}; };

@ -5,8 +5,8 @@ inherit_from: .rubocop_todo.yml
AllCops: AllCops:
Exclude: Exclude:
- 'bin/apis/**/*' - 'bin/apis/**/*'
- 'bin/math.rb' - 'bin/math_pb.rb'
- 'bin/math_services.rb' - 'bin/math_services_pb.rb'
- 'pb/grpc/health/v1/*' - 'pb/grpc/health/v1/*'
- 'pb/test/**/*' - 'pb/test/**/*'

@ -40,7 +40,7 @@ $LOAD_PATH.unshift(lib_dir) unless $LOAD_PATH.include?(lib_dir)
$LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir) $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
require 'grpc' require 'grpc'
require 'math_services' require 'math_services_pb'
require 'optparse' require 'optparse'
include GRPC::Core::TimeConsts include GRPC::Core::TimeConsts

@ -42,7 +42,7 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
require 'forwardable' require 'forwardable'
require 'grpc' require 'grpc'
require 'logger' require 'logger'
require 'math_services' require 'math_services_pb'
require 'optparse' require 'optparse'
# RubyLogger defines a logger for gRPC based on the standard ruby logger. # RubyLogger defines a logger for gRPC based on the standard ruby logger.

@ -32,7 +32,7 @@
# #
require 'grpc' require 'grpc'
require 'math' require 'math_pb'
module Math module Math
module Math module Math

@ -28,7 +28,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'grpc' require 'grpc'
require 'grpc/health/v1/health_services' require 'grpc/health/v1/health_services_pb'
require 'thread' require 'thread'
module Grpc module Grpc

@ -32,7 +32,7 @@
# #
require 'grpc' require 'grpc'
require 'grpc/health/v1/health' require 'grpc/health/v1/health_pb'
module Grpc module Grpc
module Health module Health

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: grpc/testing/duplicate/echo_duplicate.proto for package 'grpc.testing.duplicate' # Source: src/proto/grpc/testing/duplicate/echo_duplicate.proto for package 'grpc.testing.duplicate'
# Original file comments: # Original file comments:
# Copyright 2015, Google Inc. # Copyright 2015, Google Inc.
# All rights reserved. # All rights reserved.
@ -34,7 +34,7 @@
# #
require 'grpc' require 'grpc'
require 'grpc/testing/duplicate/echo_duplicate' require 'src/proto/grpc/testing/duplicate/echo_duplicate_pb'
module Grpc module Grpc
module Testing module Testing

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: grpc/testing/metrics.proto # source: src/proto/grpc/testing/metrics.proto
require 'google/protobuf' require 'google/protobuf'

@ -1,5 +1,5 @@
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# Source: grpc/testing/metrics.proto for package 'grpc.testing' # Source: src/proto/grpc/testing/metrics.proto for package 'grpc.testing'
# Original file comments: # Original file comments:
# Copyright 2015-2016, Google Inc. # Copyright 2015-2016, Google Inc.
# All rights reserved. # All rights reserved.
@ -38,7 +38,7 @@
# service. # service.
require 'grpc' require 'grpc'
require 'grpc/testing/metrics' require 'src/proto/grpc/testing/metrics_pb'
module Grpc module Grpc
module Testing module Testing

@ -3,8 +3,8 @@
require 'google/protobuf' require 'google/protobuf'
require 'src/proto/grpc/testing/empty' require 'src/proto/grpc/testing/empty_pb'
require 'src/proto/grpc/testing/messages' require 'src/proto/grpc/testing/messages_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do Google::Protobuf::DescriptorPool.generated_pool.build do
end end

@ -35,7 +35,7 @@
# #
require 'grpc' require 'grpc'
require 'src/proto/grpc/testing/test' require 'src/proto/grpc/testing/test_pb'
module Grpc module Grpc
module Testing module Testing

@ -52,9 +52,9 @@ require_relative '../../lib/grpc'
require 'googleauth' require 'googleauth'
require 'google/protobuf' require 'google/protobuf'
require_relative '../src/proto/grpc/testing/empty' require_relative '../src/proto/grpc/testing/empty_pb'
require_relative '../src/proto/grpc/testing/messages' require_relative '../src/proto/grpc/testing/messages_pb'
require_relative '../src/proto/grpc/testing/test_services' require_relative '../src/proto/grpc/testing/test_services_pb'
AUTH_ENV = Google::Auth::CredentialsLoader::ENV_VAR AUTH_ENV = Google::Auth::CredentialsLoader::ENV_VAR

@ -50,9 +50,9 @@ require 'optparse'
require 'grpc' require 'grpc'
require_relative '../src/proto/grpc/testing/empty' require_relative '../src/proto/grpc/testing/empty_pb'
require_relative '../src/proto/grpc/testing/messages' require_relative '../src/proto/grpc/testing/messages_pb'
require_relative '../src/proto/grpc/testing/test_services' require_relative '../src/proto/grpc/testing/test_services_pb'
# DebugIsTruncated extends the default Logger to truncate debug messages # DebugIsTruncated extends the default Logger to truncate debug messages
class DebugIsTruncated < Logger class DebugIsTruncated < Logger

@ -38,7 +38,7 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
require 'grpc' require 'grpc'
require 'histogram' require 'histogram'
require 'src/proto/grpc/testing/services_services' require 'src/proto/grpc/testing/services_services_pb'
class Poisson class Poisson
def interarrival def interarrival

@ -38,9 +38,9 @@ $LOAD_PATH.unshift(this_dir) unless $LOAD_PATH.include?(this_dir)
require 'grpc' require 'grpc'
require 'qps-common' require 'qps-common'
require 'src/proto/grpc/testing/messages' require 'src/proto/grpc/testing/messages_pb'
require 'src/proto/grpc/testing/services_services' require 'src/proto/grpc/testing/services_services_pb'
require 'src/proto/grpc/testing/stats' require 'src/proto/grpc/testing/stats_pb'
class BenchmarkServiceImpl < Grpc::Testing::BenchmarkService::Service class BenchmarkServiceImpl < Grpc::Testing::BenchmarkService::Service
def unary_call(req, _call) def unary_call(req, _call)

@ -3,8 +3,8 @@
require 'google/protobuf' require 'google/protobuf'
require 'src/proto/grpc/testing/payloads' require 'src/proto/grpc/testing/payloads_pb'
require 'src/proto/grpc/testing/stats' require 'src/proto/grpc/testing/stats_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "grpc.testing.PoissonParams" do add_message "grpc.testing.PoissonParams" do
optional :offered_load, :double, 1 optional :offered_load, :double, 1
@ -109,6 +109,8 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
repeated :server_stats, :message, 4, "grpc.testing.ServerStats" repeated :server_stats, :message, 4, "grpc.testing.ServerStats"
repeated :server_cores, :int32, 5 repeated :server_cores, :int32, 5
optional :summary, :message, 6, "grpc.testing.ScenarioResultSummary" optional :summary, :message, 6, "grpc.testing.ScenarioResultSummary"
repeated :client_success, :bool, 7
repeated :server_success, :bool, 8
end end
add_enum "grpc.testing.ClientType" do add_enum "grpc.testing.ClientType" do
value :SYNC_CLIENT, 0 value :SYNC_CLIENT, 0

@ -3,8 +3,8 @@
require 'google/protobuf' require 'google/protobuf'
require 'src/proto/grpc/testing/messages' require 'src/proto/grpc/testing/messages_pb'
require 'src/proto/grpc/testing/control' require 'src/proto/grpc/testing/control_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do Google::Protobuf::DescriptorPool.generated_pool.build do
end end

@ -34,7 +34,7 @@
# of unary/streaming requests/responses. # of unary/streaming requests/responses.
require 'grpc' require 'grpc'
require 'src/proto/grpc/testing/services' require 'src/proto/grpc/testing/services_pb'
module Grpc module Grpc
module Testing module Testing

@ -44,7 +44,7 @@ require 'facter'
require 'client' require 'client'
require 'qps-common' require 'qps-common'
require 'server' require 'server'
require 'src/proto/grpc/testing/services_services' require 'src/proto/grpc/testing/services_services_pb'
class WorkerServiceImpl < Grpc::Testing::WorkerService::Service class WorkerServiceImpl < Grpc::Testing::WorkerService::Service
def cpu_cores def cpu_cores

@ -44,7 +44,7 @@ describe 'Ping protobuf code generation' do
# Get the current content # Get the current content
service_path = File.join(root_dir, 'src', 'ruby', 'pb', 'grpc', service_path = File.join(root_dir, 'src', 'ruby', 'pb', 'grpc',
'testing', 'duplicate', 'testing', 'duplicate',
'echo_duplicate_services.rb') 'echo_duplicate_services_pb.rb')
want = nil want = nil
File.open(service_path) { |f| want = f.read } File.open(service_path) { |f| want = f.read }
@ -54,7 +54,7 @@ describe 'Ping protobuf code generation' do
got = nil got = nil
Dir.mktmpdir do |tmp_dir| Dir.mktmpdir do |tmp_dir|
gen_out = File.join(tmp_dir, 'src', 'proto', 'grpc', 'testing', gen_out = File.join(tmp_dir, 'src', 'proto', 'grpc', 'testing',
'duplicate', 'echo_duplicate_services.rb') 'duplicate', 'echo_duplicate_services_pb.rb')
pid = spawn( pid = spawn(
'protoc', 'protoc',
'-I.', '-I.',

@ -28,7 +28,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require 'grpc' require 'grpc'
require 'grpc/health/v1/health' require 'grpc/health/v1/health_pb'
require 'grpc/health/checker' require 'grpc/health/checker'
require 'open3' require 'open3'
require 'tmpdir' require 'tmpdir'
@ -43,7 +43,7 @@ describe 'Health protobuf code generation' do
skip 'protoc || grpc_ruby_plugin missing, cannot verify health code-gen' skip 'protoc || grpc_ruby_plugin missing, cannot verify health code-gen'
else else
it 'should already be loaded indirectly i.e, used by the other specs' do it 'should already be loaded indirectly i.e, used by the other specs' do
expect(require('grpc/health/v1/health_services')).to be(false) expect(require('grpc/health/v1/health_services_pb')).to be(false)
end end
it 'should have the same content as created by code generation' do it 'should have the same content as created by code generation' do
@ -52,7 +52,7 @@ describe 'Health protobuf code generation' do
# Get the current content # Get the current content
service_path = File.join(root_dir, 'ruby', 'pb', 'grpc', service_path = File.join(root_dir, 'ruby', 'pb', 'grpc',
'health', 'v1', 'health_services.rb') 'health', 'v1', 'health_services_pb.rb')
want = nil want = nil
File.open(service_path) { |f| want = f.read } File.open(service_path) { |f| want = f.read }
@ -62,7 +62,7 @@ describe 'Health protobuf code generation' do
got = nil got = nil
Dir.mktmpdir do |tmp_dir| Dir.mktmpdir do |tmp_dir|
gen_out = File.join(tmp_dir, 'grpc', 'health', 'v1', gen_out = File.join(tmp_dir, 'grpc', 'health', 'v1',
'health_services.rb') 'health_services_pb.rb')
pid = spawn( pid = spawn(
'protoc', 'protoc',
'-I.', '-I.',

@ -27,8 +27,8 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
require_relative '../pb/grpc/testing/metrics.rb' require_relative '../pb/grpc/testing/metrics_pb.rb'
require_relative '../pb/grpc/testing/metrics_services.rb' require_relative '../pb/grpc/testing/metrics_services_pb.rb'
class Gauge class Gauge
def get_name def get_name

@ -32,10 +32,17 @@ require 'rbconfig'
require_relative '../os_check' require_relative '../os_check'
protoc_name = 'protoc' + RbConfig::CONFIG['EXEEXT'] ext = RbConfig::CONFIG['EXEEXT']
protoc_path = File.join(File.dirname(__FILE__), protoc_name = 'protoc' + ext
RbConfig::CONFIG['host_cpu'] + '-' + OS.os_name,
protoc_name)
exec([ protoc_path, protoc_path ], *ARGV) plugin_name = 'grpc_ruby_plugin' + ext
protoc_dir = File.join(File.dirname(__FILE__),
RbConfig::CONFIG['host_cpu'] + '-' + OS.os_name)
protoc_path = File.join(protoc_dir, protoc_name)
plugin_path = File.join(protoc_dir, plugin_name)
exec([ protoc_path, protoc_path ], "--plugin=protoc-gen-grpc=#{plugin_path}", *ARGV)

@ -18,5 +18,5 @@ Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY s.platform = Gem::Platform::RUBY
s.executables = %w( grpc_tools_ruby_protoc.rb grpc_tools_ruby_protoc_plugin.rb ) s.executables = %w( grpc_tools_ruby_protoc grpc_tools_ruby_protoc_plugin )
end end

@ -8,7 +8,10 @@
}, },
"Newtonsoft.Json": "8.0.3", "Newtonsoft.Json": "8.0.3",
"NUnit": "3.2.0", "NUnit": "3.2.0",
"NUnitLite": "3.2.0-*" "NUnitLite": "3.2.0-*",
"NUnit.ConsoleRunner": "3.2.0",
"OpenCover": "4.6.519",
"ReportGenerator": "2.4.4.0"
}, },
"frameworks": { "frameworks": {
"net45": { }, "net45": { },

@ -21,11 +21,11 @@
"lodash": "^3.9.3", "lodash": "^3.9.3",
"google-protobuf": "^3.0.0-alpha.5" "google-protobuf": "^3.0.0-alpha.5"
}, },
"files": { "files": [
"LICENSE", "LICENSE",
"health.js", "health.js",
"v1" "v1"
}, ],
"main": "src/node/index.js", "main": "src/node/index.js",
"license": "BSD-3-Clause" "license": "BSD-3-Clause"
} }

@ -191,7 +191,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
// we run some tests without a service, and for those we need to supply a // we run some tests without a service, and for those we need to supply a
// frequently polled completion queue // frequently polled completion queue
cq_ = builder_->AddCompletionQueue(); cq_ = builder_->AddCompletionQueue();
cq_thread_ = grpc::thread(std::bind(&ServerBuilderPluginTest::RunCQ, this)); cq_thread_ = new grpc::thread(&ServerBuilderPluginTest::RunCQ, this);
server_ = builder_->BuildAndStart(); server_ = builder_->BuildAndStart();
EXPECT_TRUE(CheckPresent()); EXPECT_TRUE(CheckPresent());
} }
@ -209,7 +209,8 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
EXPECT_TRUE(plugin->finish_is_called()); EXPECT_TRUE(plugin->finish_is_called());
server_->Shutdown(); server_->Shutdown();
cq_->Shutdown(); cq_->Shutdown();
cq_thread_.join(); cq_thread_->join();
delete cq_thread_;
} }
string to_string(const int number) { string to_string(const int number) {
@ -224,7 +225,7 @@ class ServerBuilderPluginTest : public ::testing::TestWithParam<bool> {
std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_; std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
std::unique_ptr<ServerCompletionQueue> cq_; std::unique_ptr<ServerCompletionQueue> cq_;
std::unique_ptr<Server> server_; std::unique_ptr<Server> server_;
grpc::thread cq_thread_; grpc::thread* cq_thread_;
TestServiceImpl service_; TestServiceImpl service_;
int port_; int port_;

@ -38,8 +38,61 @@ cd /d %~dp0\..\..
set NUGET=C:\nuget\nuget.exe set NUGET=C:\nuget\nuget.exe
if exist %NUGET% ( if exist %NUGET% (
@rem Restore Grpc packages by packages since Nuget client 3.4.4 doesnt support restore
@rem by solution
@rem Moving into each directory to let the restores work with both nuget 3.4 and 2.8
%NUGET% restore vsprojects/grpc_csharp_ext.sln || goto :error %NUGET% restore vsprojects/grpc_csharp_ext.sln || goto :error
%NUGET% restore src/csharp/Grpc.sln || goto :error
cd src/csharp
cd Grpc.Auth || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.Core || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.Core.Tests || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.Examples.MathClient || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.Examples.MathServer || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.Examples || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.HealthCheck.Tests || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.HealthCheck || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.IntegrationTesting.Client || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.IntegrationTesting.QpsWorker || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.IntegrationTesting.StressClient || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd ..
cd Grpc.IntegrationTesting || goto :error
%NUGET% restore -PackagesDirectory ../packages || goto :error
cd /d %~dp0\..\.. || goto :error
) )
endlocal endlocal

@ -37,5 +37,54 @@ root=`pwd`
if [ -x "$(command -v nuget)" ] if [ -x "$(command -v nuget)" ]
then then
nuget restore Grpc.sln # Restoring Nuget packages by packages rather than by solution because of
# inability to restore by solution with Nuget client 3.4.4
# Moving into each directory to let the restores work with nuget 3.4 and 2.8
cd Grpc.Auth
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.Core.Tests
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.Core
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.Examples.MathClient
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.Examples.MathServer
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.Examples
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.HealthCheck.Tests
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.HealthCheck
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.IntegrationTesting.Client
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.IntegrationTesting.QpsWorker
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.IntegrationTesting.StressClient
nuget restore -PackagesDirectory ../packages
cd ..
cd Grpc.IntegrationTesting
nuget restore -PackagesDirectory ../packages
cd ..
fi fi

Loading…
Cancel
Save