From 548dc2ee5facdf46a3ded97c86064b3044f652c5 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Wed, 3 Jun 2015 10:58:21 -0700 Subject: [PATCH 01/16] Replaced underscore and underscore.string modules with lodash --- src/node/cli/service_packager.js | 2 +- src/node/examples/perf_test.js | 2 +- src/node/examples/route_guide_client.js | 2 +- src/node/examples/route_guide_server.js | 2 +- src/node/examples/stock_server.js | 2 +- src/node/index.js | 2 +- src/node/interop/interop_client.js | 2 +- src/node/interop/interop_server.js | 2 +- src/node/package.json | 5 ++--- src/node/src/client.js | 2 +- src/node/src/common.js | 11 ++++------- src/node/src/server.js | 4 +--- src/node/test/surface_test.js | 6 ++---- 13 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/node/cli/service_packager.js b/src/node/cli/service_packager.js index f29180b2526..c92c450a01e 100644 --- a/src/node/cli/service_packager.js +++ b/src/node/cli/service_packager.js @@ -36,7 +36,7 @@ var fs = require('fs'); var path = require('path'); -var _ = require('underscore'); +var _ = require('lodash'); var async = require('async'); var pbjs = require('protobufjs/cli/pbjs'); var parseArgs = require('minimist'); diff --git a/src/node/examples/perf_test.js b/src/node/examples/perf_test.js index 31083e09872..da919eced53 100644 --- a/src/node/examples/perf_test.js +++ b/src/node/examples/perf_test.js @@ -35,7 +35,7 @@ var grpc = require('..'); var testProto = grpc.load(__dirname + '/../interop/test.proto').grpc.testing; -var _ = require('underscore'); +var _ = require('lodash'); var interop_server = require('../interop/interop_server.js'); function runTest(iterations, callback) { diff --git a/src/node/examples/route_guide_client.js b/src/node/examples/route_guide_client.js index 0b3e9c58192..8cd532fef17 100644 --- a/src/node/examples/route_guide_client.js +++ b/src/node/examples/route_guide_client.js @@ -37,7 +37,7 @@ var async = require('async'); var fs = require('fs'); var parseArgs = require('minimist'); var path = require('path'); -var _ = require('underscore'); +var _ = require('lodash'); var grpc = require('..'); var examples = grpc.load(__dirname + '/route_guide.proto').examples; var client = new examples.RouteGuide('localhost:50051'); diff --git a/src/node/examples/route_guide_server.js b/src/node/examples/route_guide_server.js index 95553684220..c777eab7bcf 100644 --- a/src/node/examples/route_guide_server.js +++ b/src/node/examples/route_guide_server.js @@ -36,7 +36,7 @@ var fs = require('fs'); var parseArgs = require('minimist'); var path = require('path'); -var _ = require('underscore'); +var _ = require('lodash'); var grpc = require('..'); var examples = grpc.load(__dirname + '/route_guide.proto').examples; diff --git a/src/node/examples/stock_server.js b/src/node/examples/stock_server.js index 8c22af147ed..caaf9f99bae 100644 --- a/src/node/examples/stock_server.js +++ b/src/node/examples/stock_server.js @@ -33,7 +33,7 @@ 'use strict'; -var _ = require('underscore'); +var _ = require('lodash'); var grpc = require('..'); var examples = grpc.load(__dirname + '/stock.proto').examples; diff --git a/src/node/index.js b/src/node/index.js index c09e416c6ed..b6a4e2d0ee5 100644 --- a/src/node/index.js +++ b/src/node/index.js @@ -33,7 +33,7 @@ 'use strict'; -var _ = require('underscore'); +var _ = require('lodash'); var ProtoBuf = require('protobufjs'); diff --git a/src/node/interop/interop_client.js b/src/node/interop/interop_client.js index 455055d9f3c..b61b0b63c02 100644 --- a/src/node/interop/interop_client.js +++ b/src/node/interop/interop_client.js @@ -35,7 +35,7 @@ var fs = require('fs'); var path = require('path'); -var _ = require('underscore'); +var _ = require('lodash'); var grpc = require('..'); var testProto = grpc.load(__dirname + '/test.proto').grpc.testing; var GoogleAuth = require('google-auth-library'); diff --git a/src/node/interop/interop_server.js b/src/node/interop/interop_server.js index dad59c13477..0baa78a094f 100644 --- a/src/node/interop/interop_server.js +++ b/src/node/interop/interop_server.js @@ -35,7 +35,7 @@ var fs = require('fs'); var path = require('path'); -var _ = require('underscore'); +var _ = require('lodash'); var grpc = require('..'); var testProto = grpc.load(__dirname + '/test.proto').grpc.testing; var Server = grpc.buildServer([testProto.TestService.service]); diff --git a/src/node/package.json b/src/node/package.json index d7e9af07bdd..3ea2c065e70 100644 --- a/src/node/package.json +++ b/src/node/package.json @@ -25,10 +25,9 @@ }, "dependencies": { "bindings": "^1.2.0", + "lodash": "^3.9.3", "nan": "^1.5.0", - "protobufjs": "dcodeIO/ProtoBuf.js", - "underscore": "^1.6.0", - "underscore.string": "^3.0.0" + "protobufjs": "dcodeIO/ProtoBuf.js" }, "devDependencies": { "async": "^0.9.0", diff --git a/src/node/src/client.js b/src/node/src/client.js index 65339406b2c..b7bad949d45 100644 --- a/src/node/src/client.js +++ b/src/node/src/client.js @@ -33,7 +33,7 @@ 'use strict'; -var _ = require('underscore'); +var _ = require('lodash'); var grpc = require('bindings')('grpc.node'); diff --git a/src/node/src/common.js b/src/node/src/common.js index 98917c0fdd0..7b543353ebb 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -33,10 +33,7 @@ 'use strict'; -var _ = require('underscore'); - -var capitalize = require('underscore.string/capitalize'); -var decapitalize = require('underscore.string/decapitalize'); +var _ = require('lodash'); /** * Get a function that deserializes a specific type of protobuf. @@ -81,7 +78,7 @@ function fullyQualifiedName(value) { } var name = value.name; if (value.className === 'Service.RPCMethod') { - name = capitalize(name); + name = _.capitalize(name); } if (value.hasOwnProperty('parent')) { var parent_name = fullyQualifiedName(value.parent); @@ -118,8 +115,8 @@ function wrapIgnoreNull(func) { function getProtobufServiceAttrs(service) { var prefix = '/' + fullyQualifiedName(service) + '/'; return _.object(_.map(service.children, function(method) { - return [decapitalize(method.name), { - path: prefix + capitalize(method.name), + return [_.camelCase(method.name), { + path: prefix + _.capitalize(method.name), requestStream: method.requestStream, responseStream: method.responseStream, requestSerialize: serializeCls(method.resolvedRequestType.build()), diff --git a/src/node/src/server.js b/src/node/src/server.js index 079495afd4c..c6cf9e7eb80 100644 --- a/src/node/src/server.js +++ b/src/node/src/server.js @@ -33,7 +33,7 @@ 'use strict'; -var _ = require('underscore'); +var _ = require('lodash'); var grpc = require('bindings')('grpc.node'); @@ -48,8 +48,6 @@ var util = require('util'); var EventEmitter = require('events').EventEmitter; -var common = require('./common.js'); - /** * Handle an error on a call by sending it as a status * @param {grpc.Call} call The call to send the error on diff --git a/src/node/test/surface_test.js b/src/node/test/surface_test.js index b390f8b2a55..8d1f99aaee0 100644 --- a/src/node/test/surface_test.js +++ b/src/node/test/surface_test.js @@ -45,9 +45,7 @@ var math_proto = ProtoBuf.loadProtoFile(__dirname + '/../examples/math.proto'); var mathService = math_proto.lookup('math.Math'); -var capitalize = require('underscore.string/capitalize'); - -var _ = require('underscore'); +var _ = require('lodash'); describe('File loader', function() { it('Should load a proto file by default', function() { @@ -159,7 +157,7 @@ describe('Generic client and server', function() { server = new Server({ string: { capitalize: function(call, callback) { - callback(null, capitalize(call.request)); + callback(null, _.capitalize(call.request)); } } }); From af7abf92cbc6755e548ec83b1ea6906eb7b701bb Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 3 Jun 2015 17:18:58 -0700 Subject: [PATCH 02/16] Enable runtime configuration of tracers --- include/grpc/grpc.h | 10 +++++ src/core/debug/trace.c | 42 +++++++++++-------- .../chttp2_socket_pair_with_grpc_trace.c | 4 ++ 3 files changed, 38 insertions(+), 18 deletions(-) diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 57bf2fad5ab..e95a5f2e92c 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -524,6 +524,16 @@ void grpc_server_shutdown_and_notify(grpc_server *server, void *tag); Implies grpc_server_shutdown() if one was not previously performed. */ void grpc_server_destroy(grpc_server *server); +/** Enable or disable a tracer. + + Tracers (usually controlled by the environment variable GRPC_TRACE) + allow printf-style debugging on GRPC internals, and are useful for + tracking down problems in the field. + + Use of this function is not strictly thread-safe, but the + thread-safety issues raised by it should not be of concern. */ +int grpc_tracer_set_enabled(const char *name, int enabled); + #ifdef __cplusplus } #endif diff --git a/src/core/debug/trace.c b/src/core/debug/trace.c index 32c35e7fb3a..e0b502bb9cc 100644 --- a/src/core/debug/trace.c +++ b/src/core/debug/trace.c @@ -35,6 +35,7 @@ #include +#include #include #include #include "src/core/support/env.h" @@ -80,27 +81,10 @@ static void parse(const char *s) { char **strings = NULL; size_t nstrings = 0; size_t i; - tracer *t; split(s, &strings, &nstrings); for (i = 0; i < nstrings; i++) { - const char *s = strings[i]; - if (0 == strcmp(s, "all")) { - for (t = tracers; t; t = t->next) { - *t->flag = 1; - } - } else { - int found = 0; - for (t = tracers; t; t = t->next) { - if (0 == strcmp(s, t->name)) { - *t->flag = 1; - found = 1; - } - } - if (!found) { - gpr_log(GPR_ERROR, "Unknown trace var: '%s'", s); - } - } + grpc_tracer_set_enabled(strings[i], 1); } for (i = 0; i < nstrings; i++) { @@ -121,3 +105,25 @@ void grpc_tracer_init(const char *env_var) { gpr_free(t); } } + +int grpc_tracer_set_enabled(const char *name, int enabled) { + tracer *t; + if (0 == strcmp(name, "all")) { + for (t = tracers; t; t = t->next) { + *t->flag = 1; + } + } else { + int found = 0; + for (t = tracers; t; t = t->next) { + if (0 == strcmp(name, t->name)) { + *t->flag = enabled; + found = 1; + } + } + if (!found) { + gpr_log(GPR_ERROR, "Unknown trace var: '%s'", name); + return 0; /* early return */ + } + } + return 1; +} diff --git a/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c b/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c index d32dbec25e7..0834987fbec 100644 --- a/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c +++ b/test/core/end2end/fixtures/chttp2_socket_pair_with_grpc_trace.c @@ -147,6 +147,10 @@ int main(int argc, char **argv) { grpc_test_init(argc, argv); grpc_init(); + GPR_ASSERT(0 == grpc_tracer_set_enabled("also-doesnt-exist", 0)); + GPR_ASSERT(1 == grpc_tracer_set_enabled("http", 1)); + GPR_ASSERT(1 == grpc_tracer_set_enabled("all", 1)); + for (i = 0; i < sizeof(configs) / sizeof(*configs); i++) { grpc_end2end_tests(configs[i]); } From 191c8466e4d752b3c8aa73c570cc8f5f0b69e613 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Thu, 4 Jun 2015 08:19:44 -0700 Subject: [PATCH 03/16] Re-organizes the GRPC_ROOT detection code in extconf.rb --- src/ruby/ext/grpc/extconf.rb | 47 +++++++++++++++--------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 1b801edc8ec..0ff8bb9aa7a 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -32,29 +32,6 @@ require 'mkmf' LIBDIR = RbConfig::CONFIG['libdir'] INCLUDEDIR = RbConfig::CONFIG['includedir'] -if ENV.key? 'GRPC_ROOT' - GRPC_ROOT = ENV['GRPC_ROOT'] -else - grpc_root = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) - if File.exist?(File.join(grpc_root, 'include/grpc/grpc.h')) - GRPC_ROOT = grpc_root - else - GRPC_ROOT = nil - end -end - -if ENV.key? 'CONFIG' - GRPC_CONFIG = ENV['CONFIG'] -else - GRPC_CONFIG = 'opt' -end - -if (ENV.key? 'GRPC_LIB_DIR') && (!GRPC_ROOT.nil?) - GRPC_LIB_DIR = File.join(GRPC_ROOT, ENV['GRPC_LIB_DIR']) -else - GRPC_LIB_DIR = File.join(File.join(GRPC_ROOT, 'libs'), GRPC_CONFIG) -end - HEADER_DIRS = [ # Search /opt/local (Mac source install) '/opt/local/include', @@ -77,12 +54,26 @@ LIB_DIRS = [ LIBDIR ] -unless GRPC_ROOT.nil? - HEADER_DIRS.unshift File.join(GRPC_ROOT, 'include') - LIB_DIRS.unshift GRPC_LIB_DIR - unless File.exist?(File.join(GRPC_LIB_DIR, 'libgrpc.a')) - system("make -C #{GRPC_ROOT} static_c CONFIG=#{GRPC_CONFIG}") +# Check to see if GRPC_ROOT is defined or available +grpc_root = ENV['GRPC_ROOT'] +if grpc_root.nil? + r = File.expand_path(File.join(File.dirname(__FILE__), '../../../..')) + grpc_root = r if File.exist?(File.join(r, 'include/grpc/grpc.h')) +end + +# When grpc_root is available attempt to build the grpc core. +unless grpc_root.nil? + grpc_config = ENV['GRPC_CONFIG'] || 'opt' + if ENV.key?('GRPC_LIB_DIR') + grpc_lib_dir = File.join(grpc_root, ENV['GRPC_LIB_DIR']) + else + grpc_lib_dir = File.join(File.join(grpc_root, 'libs'), grpc_config) + end + unless File.exist?(File.join(grpc_lib_dir, 'libgrpc.a')) + system("make -C #{grpc_root} static_c CONFIG=#{grpc_config}") end + HEADER_DIRS.unshift File.join(grpc_root, 'include') + LIB_DIRS.unshift grpc_lib_dir end def crash(msg) From 2f300e297f6fc549c38d61a259f674b678b3599e Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Thu, 4 Jun 2015 08:28:43 -0700 Subject: [PATCH 04/16] Proper init/shutdown --- src/core/debug/trace.c | 3 +++ src/core/debug/trace.h | 1 + src/core/surface/init.c | 1 + 3 files changed, 5 insertions(+) diff --git a/src/core/debug/trace.c b/src/core/debug/trace.c index e0b502bb9cc..b53dfe804bb 100644 --- a/src/core/debug/trace.c +++ b/src/core/debug/trace.c @@ -99,6 +99,9 @@ void grpc_tracer_init(const char *env_var) { parse(e); gpr_free(e); } +} + +void grpc_tracer_shutdown(void) { while (tracers) { tracer *t = tracers; tracers = t->next; diff --git a/src/core/debug/trace.h b/src/core/debug/trace.h index c02f14b7f20..fc8615bc693 100644 --- a/src/core/debug/trace.h +++ b/src/core/debug/trace.h @@ -38,5 +38,6 @@ void grpc_register_tracer(const char *name, int *flag); void grpc_tracer_init(const char *env_var_name); +void grpc_tracer_shutdown(void); #endif /* GRPC_INTERNAL_CORE_DEBUG_TRACE_H */ diff --git a/src/core/surface/init.c b/src/core/surface/init.c index ac6871c6f22..ca61a38a351 100644 --- a/src/core/surface/init.c +++ b/src/core/surface/init.c @@ -78,6 +78,7 @@ void grpc_shutdown(void) { grpc_iomgr_shutdown(); census_shutdown(); grpc_timers_global_destroy(); + grpc_tracer_shutdown(); } gpr_mu_unlock(&g_init_mu); } From 1a2988df2b300f25fb0924b0f405c97dd89d1bc8 Mon Sep 17 00:00:00 2001 From: Tim Emiola Date: Thu, 4 Jun 2015 09:01:14 -0700 Subject: [PATCH 05/16] Update version; fix dependency advisory comment --- src/ruby/grpc.gemspec | 2 +- src/ruby/lib/grpc/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ruby/grpc.gemspec b/src/ruby/grpc.gemspec index 3ddb7fac18f..319da9470ab 100755 --- a/src/ruby/grpc.gemspec +++ b/src/ruby/grpc.gemspec @@ -14,7 +14,7 @@ Gem::Specification.new do |s| s.license = 'BSD-3-Clause' s.required_ruby_version = '>= 2.0.0' - s.requirements << 'libgrpc ~> 0.6.0 needs to be installed' + s.requirements << 'libgrpc ~> 0.9.1 needs to be installed' s.files = `git ls-files`.split("\n") s.test_files = `git ls-files -- spec/*`.split("\n") diff --git a/src/ruby/lib/grpc/version.rb b/src/ruby/lib/grpc/version.rb index 8588bfd8080..53265c792c4 100644 --- a/src/ruby/lib/grpc/version.rb +++ b/src/ruby/lib/grpc/version.rb @@ -29,5 +29,5 @@ # GRPC contains the General RPC module. module GRPC - VERSION = '0.9.2' + VERSION = '0.9.3' end From 461b094cc807b4369a48e7ff78190325a9f5046c Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 2 Jun 2015 20:40:50 -0700 Subject: [PATCH 06/16] Fix gRPC.podspec to pass pod spec lint - Relax protobuf requirement to alpha version - Suppress warnings for GRPCClient - Fix headers search path - Document hacks. --- gRPC.podspec | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/gRPC.podspec b/gRPC.podspec index 217d5ca81e4..eaebb27423f 100644 --- a/gRPC.podspec +++ b/gRPC.podspec @@ -13,23 +13,27 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.8' s.requires_arc = true + # Reactive Extensions library for iOS. s.subspec 'RxLibrary' do |rs| - rs.summary = 'Reactive Extensions library for iOS.' - rs.source_files = 'src/objective-c/RxLibrary/*.{h,m}', 'src/objective-c/RxLibrary/transformations/*.{h,m}', 'src/objective-c/RxLibrary/private/*.{h,m}' rs.private_header_files = 'src/objective-c/RxLibrary/private/*.h' end + # Core cross-platform gRPC library, written in C. s.subspec 'C-Core' do |cs| - cs.summary = 'Core cross-platform gRPC library, written in C.' - cs.source_files = 'src/core/**/*.{h,c}', 'include/grpc/*.h', 'include/grpc/**/*.h' cs.private_header_files = 'src/core/**/*.h' cs.header_mappings_dir = '.' - cs.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Build/gRPC" ' - '"$(PODS_ROOT)/Headers/Build/gRPC/include"' } + # The core library includes its headers as either "src/core/..." or "grpc/...", meaning we have + # to tell XCode to look for headers under the "include" subdirectory too. + # + # TODO(jcanizales): Instead of doing this, during installation move everything under + # "include/grpc" one directory up. The directory names under PODS_ROOT are implementation + # details of Cocoapods, and have changed in the past, breaking this podspec. + cs.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Private/gRPC" ' + + '"$(PODS_ROOT)/Headers/Private/gRPC/include"' } cs.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w' cs.requires_arc = false @@ -41,35 +45,38 @@ Pod::Spec.new do |s| # It renames time.h and string.h to grpc_time.h and grpc_string.h. # It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run # prepare_command's of subspecs. + # + # TODO(jcanizales): Try out Todd Reed's solution at Issue #1437. s.prepare_command = <<-CMD DIR_TIME="grpc/support" BAD_TIME="$DIR_TIME/time.h" GOOD_TIME="$DIR_TIME/grpc_time.h" + grep -rl "$BAD_TIME" include/grpc src/core | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g if [ -f "include/$BAD_TIME" ]; then - grep -rl "$BAD_TIME" include/grpc src/core | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g - mv "include/$BAD_TIME" "include/$GOOD_TIME" + mv -f "include/$BAD_TIME" "include/$GOOD_TIME" fi DIR_STRING="src/core/support" BAD_STRING="$DIR_STRING/string.h" GOOD_STRING="$DIR_STRING/grpc_string.h" + grep -rl "$BAD_STRING" include/grpc src/core | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g if [ -f "$BAD_STRING" ]; then - grep -rl "$BAD_STRING" include/grpc src/core | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g - mv "$BAD_STRING" "$GOOD_STRING" + mv -f "$BAD_STRING" "$GOOD_STRING" fi CMD + # Objective-C wrapper around the core gRPC library. s.subspec 'GRPCClient' do |gs| - gs.summary = 'Objective-C wrapper around the core gRPC library.' - gs.source_files = 'src/objective-c/GRPCClient/*.{h,m}', 'src/objective-c/GRPCClient/private/*.{h,m}' gs.private_header_files = 'src/objective-c/GRPCClient/private/*.h' + gs.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w' gs.dependency 'gRPC/C-Core' - # Is this needed in all dependents? + # TODO(jcanizales): Remove this when the prepare_command moves everything under "include/grpc" + # one directory up. gs.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Public/gRPC/include"' } gs.dependency 'gRPC/RxLibrary' @@ -77,13 +84,12 @@ Pod::Spec.new do |s| gs.resource_bundles = { 'gRPC' => ['etc/roots.pem'] } end + # RPC library for ProtocolBuffers, based on gRPC s.subspec 'ProtoRPC' do |ps| - ps.summary = 'RPC library for ProtocolBuffers, based on gRPC' - ps.source_files = 'src/objective-c/ProtoRPC/*.{h,m}' ps.dependency 'gRPC/GRPCClient' ps.dependency 'gRPC/RxLibrary' - ps.dependency 'Protobuf', '~> 3.0' + ps.dependency 'Protobuf', '~> 3.0.0-alpha-3' end end From ba65a1028d5f7ef8f9f0703f3c1a46f3e730bed4 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 2 Jun 2015 21:24:22 -0700 Subject: [PATCH 07/16] Point test and sample podfiles to protobuf release --- src/objective-c/examples/Sample/Podfile | 1 - src/objective-c/tests/Podfile | 1 - 2 files changed, 2 deletions(-) diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile index f3c49c12a17..72308c16192 100644 --- a/src/objective-c/examples/Sample/Podfile +++ b/src/objective-c/examples/Sample/Podfile @@ -2,7 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'gRPC', :path => "../../../.." -pod 'Protobuf', :git => 'https://github.com/google/protobuf.git' pod 'RemoteTest', :path => "../../generated_libraries/RemoteTestClient" target 'Sample' do diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index c099fb51823..598e1595e88 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -2,7 +2,6 @@ source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' pod 'gRPC', :path => "../../.." -pod 'Protobuf', :git => 'https://github.com/google/protobuf.git' pod 'RemoteTest', :path => "../generated_libraries/RemoteTestClient" pod 'Route_guide', :path => "../generated_libraries/RouteGuideClient" From 9f95dcdc9a4766455c9be35837baeba55c464d07 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Tue, 2 Jun 2015 21:27:42 -0700 Subject: [PATCH 08/16] Fix version reqs in generated podspecs --- .../generated_libraries/RemoteTestClient/RemoteTest.podspec | 6 ++---- .../RouteGuideClient/Route_guide.podspec | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec b/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec index 36c2b509e86..c8ac0846504 100644 --- a/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec @@ -2,9 +2,7 @@ Pod::Spec.new do |s| s.name = 'RemoteTest' s.version = '0.0.1' s.summary = 'Protobuf library generated from test.proto, messages.proto, and empty.proto' - s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/RemoteTestClient' s.license = 'New BSD' - s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } s.ios.deployment_target = '6.0' s.osx.deployment_target = '10.8' @@ -12,13 +10,13 @@ Pod::Spec.new do |s| s.subspec 'Messages' do |ms| ms.source_files = '*.pbobjc.{h,m}' ms.requires_arc = false - ms.dependency 'Protobuf', '~> 3.0' + ms.dependency 'Protobuf', '~> 3.0.0-alpha-3' end s.subspec 'Services' do |ss| ss.source_files = '*.pbrpc.{h,m}' ss.requires_arc = true - ss.dependency 'gRPC', '~> 0.0' + ss.dependency 'gRPC', '~> 0.5' ss.dependency 'RemoteTest/Messages' end end diff --git a/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec b/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec index 5b1a68aad5e..803cdae5458 100644 --- a/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec +++ b/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec @@ -2,9 +2,7 @@ Pod::Spec.new do |s| s.name = 'Route_guide' s.version = '0.0.1' s.summary = 'Protobuf library generated from route_guide.proto' - s.homepage = 'https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample/RouteGuideClient' s.license = 'New BSD' - s.authors = { 'Jorge Canizales' => 'jcanizales@google.com' } s.ios.deployment_target = '6.0' s.osx.deployment_target = '10.8' @@ -12,13 +10,13 @@ Pod::Spec.new do |s| s.subspec 'Messages' do |ms| ms.source_files = '*.pbobjc.{h,m}' ms.requires_arc = false - ms.dependency 'Protobuf', '~> 3.0' + ms.dependency 'Protobuf', '~> 3.0.0-alpha-3' end s.subspec 'Services' do |ss| ss.source_files = '*.pbrpc.{h,m}' ss.requires_arc = true - ss.dependency 'gRPC', '~> 0.0' + ss.dependency 'gRPC', '~> 0.5' ss.dependency 'Route_guide/Messages' end end From c2e5be99d30b8c159a588bd57e72827b37cb3c19 Mon Sep 17 00:00:00 2001 From: Jan Tattermusch Date: Thu, 4 Jun 2015 13:54:27 -0700 Subject: [PATCH 09/16] fix C# test access violation exception on Windows --- src/core/iomgr/resolve_address_windows.c | 2 +- src/core/iomgr/socket_windows.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/iomgr/resolve_address_windows.c b/src/core/iomgr/resolve_address_windows.c index d388b04837b..fb5fd0d4f63 100644 --- a/src/core/iomgr/resolve_address_windows.c +++ b/src/core/iomgr/resolve_address_windows.c @@ -135,9 +135,9 @@ static void do_request(void *rp) { grpc_resolve_cb cb = r->cb; gpr_free(r->name); gpr_free(r->default_port); + grpc_iomgr_unregister_object(&r->iomgr_object); gpr_free(r); cb(arg, resolved); - grpc_iomgr_unregister_object(&r->iomgr_object); } void grpc_resolved_addresses_destroy(grpc_resolved_addresses *addrs) { diff --git a/src/core/iomgr/socket_windows.c b/src/core/iomgr/socket_windows.c index e4ba0a2b662..fbf3fdc9491 100644 --- a/src/core/iomgr/socket_windows.c +++ b/src/core/iomgr/socket_windows.c @@ -85,13 +85,13 @@ int grpc_winsocket_shutdown(grpc_winsocket *socket) { both memory and sockets. */ void grpc_winsocket_orphan(grpc_winsocket *winsocket) { SOCKET socket = winsocket->socket; + grpc_iomgr_unregister_object(&winsocket->iomgr_object); if (winsocket->read_info.outstanding || winsocket->write_info.outstanding) { grpc_iocp_socket_orphan(winsocket); } else { grpc_winsocket_destroy(winsocket); } closesocket(socket); - grpc_iomgr_unregister_object(&winsocket->iomgr_object); } void grpc_winsocket_destroy(grpc_winsocket *winsocket) { From e37a41cf664399bf3db5c73c3dc16f0b8ba37d9a Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Wed, 3 Jun 2015 23:07:41 -0700 Subject: [PATCH 10/16] Generate RouteGuide code on pod install --- .../RouteGuideClient/RouteGuide.pbobjc.h | 134 ------- .../RouteGuideClient/RouteGuide.pbobjc.m | 355 ------------------ .../RouteGuideClient/RouteGuide.pbrpc.h | 43 --- .../RouteGuideClient/RouteGuide.pbrpc.m | 72 ---- .../RouteGuideClient/RouteGuide.podspec | 24 ++ .../RouteGuideClient/Route_guide.podspec | 22 -- .../RouteGuideClient/route_guide.proto | 2 +- src/objective-c/tests/Podfile | 2 +- 8 files changed, 26 insertions(+), 628 deletions(-) delete mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h delete mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m delete mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h delete mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m create mode 100644 src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec delete mode 100644 src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h deleted file mode 100644 index 6efaec7f028..00000000000 --- a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.h +++ /dev/null @@ -1,134 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: route_guide.proto - -#import "GPBProtocolBuffers.h" - -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000 -#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources. -#endif - -CF_EXTERN_C_BEGIN - -@class RGDFeature; -@class RGDPoint; -@class RGDRectangle; -@class RGDRouteNote; -@class RGDRouteSummary; - - -#pragma mark - RGDRouteGuideRoot - -@interface RGDRouteGuideRoot : GPBRootObject -@end - -#pragma mark - RGDPoint - -typedef GPB_ENUM(RGDPoint_FieldNumber) { - RGDPoint_FieldNumber_Latitude = 1, - RGDPoint_FieldNumber_Longitude = 2, -}; - -// Points are represented as latitude-longitude pairs in the E7 representation -// (degrees multiplied by 10**7 and rounded to the nearest integer). -// Latitudes should be in the range +/- 90 degrees and longitude should be in -// the range +/- 180 degrees (inclusive). -@interface RGDPoint : GPBMessage - -@property(nonatomic, readwrite) int32_t latitude; - -@property(nonatomic, readwrite) int32_t longitude; - -@end - -#pragma mark - RGDRectangle - -typedef GPB_ENUM(RGDRectangle_FieldNumber) { - RGDRectangle_FieldNumber_Lo = 1, - RGDRectangle_FieldNumber_Hi = 2, -}; - -// A latitude-longitude rectangle, represented as two diagonally opposite -// points "lo" and "hi". -@interface RGDRectangle : GPBMessage - -// One corner of the rectangle. -@property(nonatomic, readwrite) BOOL hasLo; -@property(nonatomic, readwrite, strong) RGDPoint *lo; - -// The other corner of the rectangle. -@property(nonatomic, readwrite) BOOL hasHi; -@property(nonatomic, readwrite, strong) RGDPoint *hi; - -@end - -#pragma mark - RGDFeature - -typedef GPB_ENUM(RGDFeature_FieldNumber) { - RGDFeature_FieldNumber_Name = 1, - RGDFeature_FieldNumber_Location = 2, -}; - -// A feature names something at a given point. -// -// If a feature could not be named, the name is empty. -@interface RGDFeature : GPBMessage - -// The name of the feature. -@property(nonatomic, readwrite, copy) NSString *name; - -// The point where the feature is detected. -@property(nonatomic, readwrite) BOOL hasLocation; -@property(nonatomic, readwrite, strong) RGDPoint *location; - -@end - -#pragma mark - RGDRouteNote - -typedef GPB_ENUM(RGDRouteNote_FieldNumber) { - RGDRouteNote_FieldNumber_Location = 1, - RGDRouteNote_FieldNumber_Message = 2, -}; - -// A RouteNote is a message sent while at a given point. -@interface RGDRouteNote : GPBMessage - -// The location from which the message is sent. -@property(nonatomic, readwrite) BOOL hasLocation; -@property(nonatomic, readwrite, strong) RGDPoint *location; - -// The message to be sent. -@property(nonatomic, readwrite, copy) NSString *message; - -@end - -#pragma mark - RGDRouteSummary - -typedef GPB_ENUM(RGDRouteSummary_FieldNumber) { - RGDRouteSummary_FieldNumber_PointCount = 1, - RGDRouteSummary_FieldNumber_FeatureCount = 2, - RGDRouteSummary_FieldNumber_Distance = 3, - RGDRouteSummary_FieldNumber_ElapsedTime = 4, -}; - -// A RouteSummary is received in response to a RecordRoute rpc. -// -// It contains the number of individual points received, the number of -// detected features, and the total distance covered as the cumulative sum of -// the distance between each point. -@interface RGDRouteSummary : GPBMessage - -// The number of points received. -@property(nonatomic, readwrite) int32_t pointCount; - -// The number of known features passed while traversing the route. -@property(nonatomic, readwrite) int32_t featureCount; - -// The distance covered in metres. -@property(nonatomic, readwrite) int32_t distance; - -// The duration of the traversal in seconds. -@property(nonatomic, readwrite) int32_t elapsedTime; - -@end - -CF_EXTERN_C_END diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m deleted file mode 100644 index 16f291a61c7..00000000000 --- a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbobjc.m +++ /dev/null @@ -1,355 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: route_guide.proto - -#import "GPBProtocolBuffers_RuntimeSupport.h" - -#import "RouteGuide.pbobjc.h" - -#pragma mark - RGDRouteGuideRoot - -@implementation RGDRouteGuideRoot - -@end - -static GPBFileDescriptor *RGDRouteGuideRoot_FileDescriptor(void) { - // This is called by +initialize so there is no need to worry - // about thread safety of the singleton. - static GPBFileDescriptor *descriptor = NULL; - if (!descriptor) { - descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"grpc.example.routeguide" - syntax:GPBFileSyntaxProto3]; - } - return descriptor; -} - -#pragma mark - RGDPoint - -@implementation RGDPoint - -@dynamic latitude; -@dynamic longitude; - -typedef struct RGDPoint_Storage { - uint32_t _has_storage_[1]; - int32_t latitude; - int32_t longitude; -} RGDPoint_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "latitude", - .number = RGDPoint_FieldNumber_Latitude, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDPoint_Storage, latitude), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "longitude", - .number = RGDPoint_FieldNumber_Longitude, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDPoint_Storage, longitude), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDPoint class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDPoint_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RGDRectangle - -@implementation RGDRectangle - -@dynamic hasLo, lo; -@dynamic hasHi, hi; - -typedef struct RGDRectangle_Storage { - uint32_t _has_storage_[1]; - RGDPoint *lo; - RGDPoint *hi; -} RGDRectangle_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "lo", - .number = RGDRectangle_FieldNumber_Lo, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RGDRectangle_Storage, lo), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RGDPoint), - .fieldOptions = NULL, - }, - { - .name = "hi", - .number = RGDRectangle_FieldNumber_Hi, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RGDRectangle_Storage, hi), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RGDPoint), - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRectangle class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDRectangle_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RGDFeature - -@implementation RGDFeature - -@dynamic name; -@dynamic hasLocation, location; - -typedef struct RGDFeature_Storage { - uint32_t _has_storage_[1]; - NSString *name; - RGDPoint *location; -} RGDFeature_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "name", - .number = RGDFeature_FieldNumber_Name, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeString, - .offset = offsetof(RGDFeature_Storage, name), - .defaultValue.valueString = nil, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "location", - .number = RGDFeature_FieldNumber_Location, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RGDFeature_Storage, location), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RGDPoint), - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDFeature class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDFeature_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RGDRouteNote - -@implementation RGDRouteNote - -@dynamic hasLocation, location; -@dynamic message; - -typedef struct RGDRouteNote_Storage { - uint32_t _has_storage_[1]; - RGDPoint *location; - NSString *message; -} RGDRouteNote_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "location", - .number = RGDRouteNote_FieldNumber_Location, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RGDRouteNote_Storage, location), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RGDPoint), - .fieldOptions = NULL, - }, - { - .name = "message", - .number = RGDRouteNote_FieldNumber_Message, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeString, - .offset = offsetof(RGDRouteNote_Storage, message), - .defaultValue.valueString = nil, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRouteNote class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDRouteNote_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RGDRouteSummary - -@implementation RGDRouteSummary - -@dynamic pointCount; -@dynamic featureCount; -@dynamic distance; -@dynamic elapsedTime; - -typedef struct RGDRouteSummary_Storage { - uint32_t _has_storage_[1]; - int32_t pointCount; - int32_t featureCount; - int32_t distance; - int32_t elapsedTime; -} RGDRouteSummary_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "pointCount", - .number = RGDRouteSummary_FieldNumber_PointCount, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDRouteSummary_Storage, pointCount), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "featureCount", - .number = RGDRouteSummary_FieldNumber_FeatureCount, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDRouteSummary_Storage, featureCount), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "distance", - .number = RGDRouteSummary_FieldNumber_Distance, - .hasIndex = 2, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDRouteSummary_Storage, distance), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "elapsedTime", - .number = RGDRouteSummary_FieldNumber_ElapsedTime, - .hasIndex = 3, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RGDRouteSummary_Storage, elapsedTime), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RGDRouteSummary class] - rootClass:[RGDRouteGuideRoot class] - file:RGDRouteGuideRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RGDRouteSummary_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h deleted file mode 100644 index 9e60865d981..00000000000 --- a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.h +++ /dev/null @@ -1,43 +0,0 @@ -#import "RouteGuide.pbobjc.h" -#import - - -@protocol GRXWriteable; -@protocol GRXWriter; - -@protocol RGDRouteGuide - -#pragma mark GetFeature(Point) returns (Feature) - -- (void)getFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler; - -- (ProtoRPC *)RPCToGetFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler; - - -#pragma mark ListFeatures(Rectangle) returns (stream Feature) - -- (void)listFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler; - -- (ProtoRPC *)RPCToListFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler; - - -#pragma mark RecordRoute(stream Point) returns (RouteSummary) - -- (void)recordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler; - -- (ProtoRPC *)RPCToRecordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler; - - -#pragma mark RouteChat(stream RouteNote) returns (stream RouteNote) - -- (void)routeChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler; - -- (ProtoRPC *)RPCToRouteChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler; - - -@end - -// Basic service implementation, over gRPC, that only does marshalling and parsing. -@interface RGDRouteGuide : ProtoService -- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER; -@end diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m deleted file mode 100644 index 2ca3dc6768f..00000000000 --- a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.pbrpc.m +++ /dev/null @@ -1,72 +0,0 @@ -#import "RouteGuide.pbrpc.h" -#import -#import -#import - -static NSString *const kPackageName = @"grpc.example.routeguide"; -static NSString *const kServiceName = @"RouteGuide"; - -@implementation RGDRouteGuide - -// Designated initializer -- (instancetype)initWithHost:(NSString *)host { - return (self = [super initWithHost:host packageName:kPackageName serviceName:kServiceName]); -} - -// Override superclass initializer to disallow different package and service names. -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName { - return [self initWithHost:host]; -} - - -#pragma mark GetFeature(Point) returns (Feature) - -- (void)getFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler{ - [[self RPCToGetFeatureWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToGetFeatureWithRequest:(RGDPoint *)request handler:(void(^)(RGDFeature *response, NSError *error))handler{ - return [self RPCToMethod:@"GetFeature" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[RGDFeature class] - responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; -} -#pragma mark ListFeatures(Rectangle) returns (stream Feature) - -- (void)listFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler{ - [[self RPCToListFeaturesWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToListFeaturesWithRequest:(RGDRectangle *)request handler:(void(^)(BOOL done, RGDFeature *response, NSError *error))handler{ - return [self RPCToMethod:@"ListFeatures" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[RGDFeature class] - responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; -} -#pragma mark RecordRoute(stream Point) returns (RouteSummary) - -- (void)recordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler{ - [[self RPCToRecordRouteWithRequestsWriter:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToRecordRouteWithRequestsWriter:(id)request handler:(void(^)(RGDRouteSummary *response, NSError *error))handler{ - return [self RPCToMethod:@"RecordRoute" - requestsWriter:request - responseClass:[RGDRouteSummary class] - responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; -} -#pragma mark RouteChat(stream RouteNote) returns (stream RouteNote) - -- (void)routeChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler{ - [[self RPCToRouteChatWithRequestsWriter:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToRouteChatWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RGDRouteNote *response, NSError *error))handler{ - return [self RPCToMethod:@"RouteChat" - requestsWriter:request - responseClass:[RGDRouteNote class] - responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; -} -@end diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec new file mode 100644 index 00000000000..9df8e2337da --- /dev/null +++ b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec @@ -0,0 +1,24 @@ +Pod::Spec.new do |s| + s.name = "RouteGuide" + s.version = "0.0.1" + s.license = "New BSD" + + s.ios.deployment_target = "6.0" + s.osx.deployment_target = "10.8" + + # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. + s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto" + + s.subspec "Messages" do |ms| + ms.source_files = "*.pbobjc.{h,m}" + ms.requires_arc = false + ms.dependency "Protobuf", "~> 3.0.0-alpha-3" + end + + s.subspec "Services" do |ss| + ss.source_files = "*.pbrpc.{h,m}" + ss.requires_arc = true + ss.dependency "gRPC", "~> 0.5" + ss.dependency "#{s.name}/Messages" + end +end diff --git a/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec b/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec deleted file mode 100644 index 803cdae5458..00000000000 --- a/src/objective-c/generated_libraries/RouteGuideClient/Route_guide.podspec +++ /dev/null @@ -1,22 +0,0 @@ -Pod::Spec.new do |s| - s.name = 'Route_guide' - s.version = '0.0.1' - s.summary = 'Protobuf library generated from route_guide.proto' - s.license = 'New BSD' - - s.ios.deployment_target = '6.0' - s.osx.deployment_target = '10.8' - - s.subspec 'Messages' do |ms| - ms.source_files = '*.pbobjc.{h,m}' - ms.requires_arc = false - ms.dependency 'Protobuf', '~> 3.0.0-alpha-3' - end - - s.subspec 'Services' do |ss| - ss.source_files = '*.pbrpc.{h,m}' - ss.requires_arc = true - ss.dependency 'gRPC', '~> 0.5' - ss.dependency 'Route_guide/Messages' - end -end diff --git a/src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto b/src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto index 16dce26a2b3..dace1a5d260 100644 --- a/src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto +++ b/src/objective-c/generated_libraries/RouteGuideClient/route_guide.proto @@ -29,7 +29,7 @@ syntax = "proto3"; -package grpc.example.routeguide; +package examples; option objc_class_prefix = "RGD"; diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile index 598e1595e88..026868db12b 100644 --- a/src/objective-c/tests/Podfile +++ b/src/objective-c/tests/Podfile @@ -3,7 +3,7 @@ platform :ios, '8.0' pod 'gRPC', :path => "../../.." pod 'RemoteTest', :path => "../generated_libraries/RemoteTestClient" -pod 'Route_guide', :path => "../generated_libraries/RouteGuideClient" +pod 'RouteGuide', :path => "../generated_libraries/RouteGuideClient" link_with 'AllTests' From 3b309d69cc2eb37f3f78f4dea1b327c8b4a5cb81 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 4 Jun 2015 12:41:56 -0700 Subject: [PATCH 11/16] Generate RemoteTest code on podspec install --- .../RemoteTestClient/Empty.pbobjc.h | 33 - .../RemoteTestClient/Empty.pbobjc.m | 59 -- .../RemoteTestClient/Messages.pbobjc.h | 221 ------- .../RemoteTestClient/Messages.pbobjc.m | 603 ------------------ .../RemoteTestClient/RemoteTest.podspec | 28 +- .../RemoteTestClient/Test.pbobjc.h | 12 - .../RemoteTestClient/Test.pbobjc.m | 9 - .../RemoteTestClient/Test.pbrpc.h | 59 -- .../RemoteTestClient/Test.pbrpc.m | 96 --- 9 files changed, 15 insertions(+), 1105 deletions(-) delete mode 100644 src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.h delete mode 100644 src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.m delete mode 100644 src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.h delete mode 100644 src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.m delete mode 100644 src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.h delete mode 100644 src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.m delete mode 100644 src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.h delete mode 100644 src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.m diff --git a/src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.h b/src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.h deleted file mode 100644 index 809d0dde6ee..00000000000 --- a/src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.h +++ /dev/null @@ -1,33 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: empty.proto - -#import "GPBProtocolBuffers.h" - -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000 -#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources. -#endif - -CF_EXTERN_C_BEGIN - -@class RMTEmpty; - - -#pragma mark - RMTEmptyRoot - -@interface RMTEmptyRoot : GPBRootObject -@end - -#pragma mark - RMTEmpty - -// An empty message that you can re-use to avoid defining duplicated empty -// messages in your project. A typical example is to use it as argument or the -// return value of a service API. For instance: -// -// service Foo { -// rpc Bar (grpc.testing.Empty) returns (grpc.testing.Empty) { }; -// }; -@interface RMTEmpty : GPBMessage - -@end - -CF_EXTERN_C_END diff --git a/src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.m b/src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.m deleted file mode 100644 index 46d481af663..00000000000 --- a/src/objective-c/generated_libraries/RemoteTestClient/Empty.pbobjc.m +++ /dev/null @@ -1,59 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: empty.proto - -#import "GPBProtocolBuffers_RuntimeSupport.h" - -#import "Empty.pbobjc.h" - -#pragma mark - RMTEmptyRoot - -@implementation RMTEmptyRoot - -@end - -static GPBFileDescriptor *RMTEmptyRoot_FileDescriptor(void) { - // This is called by +initialize so there is no need to worry - // about thread safety of the singleton. - static GPBFileDescriptor *descriptor = NULL; - if (!descriptor) { - descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"grpc.testing" - syntax:GPBFileSyntaxProto3]; - } - return descriptor; -} - -#pragma mark - RMTEmpty - -@implementation RMTEmpty - - -typedef struct RMTEmpty_Storage { - uint32_t _has_storage_[0]; -} RMTEmpty_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTEmpty class] - rootClass:[RMTEmptyRoot class] - file:RMTEmptyRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTEmpty_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - diff --git a/src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.h b/src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.h deleted file mode 100644 index 5f323141750..00000000000 --- a/src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.h +++ /dev/null @@ -1,221 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: messages.proto - -#import "GPBProtocolBuffers.h" - -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000 -#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources. -#endif - -CF_EXTERN_C_BEGIN - -@class RMTPayload; -@class RMTResponseParameters; -@class RMTSimpleRequest; -@class RMTSimpleResponse; -@class RMTStreamingInputCallRequest; -@class RMTStreamingInputCallResponse; -@class RMTStreamingOutputCallRequest; -@class RMTStreamingOutputCallResponse; - -#pragma mark - Enum RMTPayloadType - -// The type of payload that should be returned. -typedef GPB_ENUM(RMTPayloadType) { - RMTPayloadType_GPBUnrecognizedEnumeratorValue = kGPBUnrecognizedEnumeratorValue, - // Compressable text format. - RMTPayloadType_Compressable = 0, - - // Uncompressable binary format. - RMTPayloadType_Uncompressable = 1, - - // Randomly chosen from all other formats defined in this enum. - RMTPayloadType_Random = 2, -}; - -GPBEnumDescriptor *RMTPayloadType_EnumDescriptor(void); - -BOOL RMTPayloadType_IsValidValue(int32_t value); - - -#pragma mark - RMTMessagesRoot - -@interface RMTMessagesRoot : GPBRootObject -@end - -#pragma mark - RMTPayload - -typedef GPB_ENUM(RMTPayload_FieldNumber) { - RMTPayload_FieldNumber_Type = 1, - RMTPayload_FieldNumber_Body = 2, -}; - -// A block of data, to simply increase gRPC message size. -@interface RMTPayload : GPBMessage - -// The type of data in body. -@property(nonatomic, readwrite) RMTPayloadType type; - -// Primary contents of payload. -@property(nonatomic, readwrite, copy) NSData *body; - -@end - -int32_t RMTPayload_Type_RawValue(RMTPayload *message); -void SetRMTPayload_Type_RawValue(RMTPayload *message, int32_t value); - -#pragma mark - RMTSimpleRequest - -typedef GPB_ENUM(RMTSimpleRequest_FieldNumber) { - RMTSimpleRequest_FieldNumber_ResponseType = 1, - RMTSimpleRequest_FieldNumber_ResponseSize = 2, - RMTSimpleRequest_FieldNumber_Payload = 3, - RMTSimpleRequest_FieldNumber_FillUsername = 4, - RMTSimpleRequest_FieldNumber_FillOauthScope = 5, -}; - -// Unary request. -@interface RMTSimpleRequest : GPBMessage - -// Desired payload type in the response from the server. -// If response_type is RANDOM, server randomly chooses one from other formats. -@property(nonatomic, readwrite) RMTPayloadType responseType; - -// Desired payload size in the response from the server. -// If response_type is COMPRESSABLE, this denotes the size before compression. -@property(nonatomic, readwrite) int32_t responseSize; - -// Optional input payload sent along with the request. -@property(nonatomic, readwrite) BOOL hasPayload; -@property(nonatomic, readwrite, strong) RMTPayload *payload; - -// Whether SimpleResponse should include username. -@property(nonatomic, readwrite) BOOL fillUsername; - -// Whether SimpleResponse should include OAuth scope. -@property(nonatomic, readwrite) BOOL fillOauthScope; - -@end - -int32_t RMTSimpleRequest_ResponseType_RawValue(RMTSimpleRequest *message); -void SetRMTSimpleRequest_ResponseType_RawValue(RMTSimpleRequest *message, int32_t value); - -#pragma mark - RMTSimpleResponse - -typedef GPB_ENUM(RMTSimpleResponse_FieldNumber) { - RMTSimpleResponse_FieldNumber_Payload = 1, - RMTSimpleResponse_FieldNumber_Username = 2, - RMTSimpleResponse_FieldNumber_OauthScope = 3, -}; - -// Unary response, as configured by the request. -@interface RMTSimpleResponse : GPBMessage - -// Payload to increase message size. -@property(nonatomic, readwrite) BOOL hasPayload; -@property(nonatomic, readwrite, strong) RMTPayload *payload; - -// The user the request came from, for verifying authentication was -// successful when the client expected it. -@property(nonatomic, readwrite, copy) NSString *username; - -// OAuth scope. -@property(nonatomic, readwrite, copy) NSString *oauthScope; - -@end - -#pragma mark - RMTStreamingInputCallRequest - -typedef GPB_ENUM(RMTStreamingInputCallRequest_FieldNumber) { - RMTStreamingInputCallRequest_FieldNumber_Payload = 1, -}; - -// Client-streaming request. -@interface RMTStreamingInputCallRequest : GPBMessage - -// Optional input payload sent along with the request. -@property(nonatomic, readwrite) BOOL hasPayload; -@property(nonatomic, readwrite, strong) RMTPayload *payload; - -@end - -#pragma mark - RMTStreamingInputCallResponse - -typedef GPB_ENUM(RMTStreamingInputCallResponse_FieldNumber) { - RMTStreamingInputCallResponse_FieldNumber_AggregatedPayloadSize = 1, -}; - -// Client-streaming response. -@interface RMTStreamingInputCallResponse : GPBMessage - -// Aggregated size of payloads received from the client. -@property(nonatomic, readwrite) int32_t aggregatedPayloadSize; - -@end - -#pragma mark - RMTResponseParameters - -typedef GPB_ENUM(RMTResponseParameters_FieldNumber) { - RMTResponseParameters_FieldNumber_Size = 1, - RMTResponseParameters_FieldNumber_IntervalUs = 2, -}; - -// Configuration for a particular response. -@interface RMTResponseParameters : GPBMessage - -// Desired payload sizes in responses from the server. -// If response_type is COMPRESSABLE, this denotes the size before compression. -@property(nonatomic, readwrite) int32_t size; - -// Desired interval between consecutive responses in the response stream in -// microseconds. -@property(nonatomic, readwrite) int32_t intervalUs; - -@end - -#pragma mark - RMTStreamingOutputCallRequest - -typedef GPB_ENUM(RMTStreamingOutputCallRequest_FieldNumber) { - RMTStreamingOutputCallRequest_FieldNumber_ResponseType = 1, - RMTStreamingOutputCallRequest_FieldNumber_ResponseParametersArray = 2, - RMTStreamingOutputCallRequest_FieldNumber_Payload = 3, -}; - -// Server-streaming request. -@interface RMTStreamingOutputCallRequest : GPBMessage - -// Desired payload type in the response from the server. -// If response_type is RANDOM, the payload from each response in the stream -// might be of different types. This is to simulate a mixed type of payload -// stream. -@property(nonatomic, readwrite) RMTPayloadType responseType; - -// Configuration for each expected response message. -// |responseParametersArray| contains |RMTResponseParameters| -@property(nonatomic, readwrite, strong) NSMutableArray *responseParametersArray; - -// Optional input payload sent along with the request. -@property(nonatomic, readwrite) BOOL hasPayload; -@property(nonatomic, readwrite, strong) RMTPayload *payload; - -@end - -int32_t RMTStreamingOutputCallRequest_ResponseType_RawValue(RMTStreamingOutputCallRequest *message); -void SetRMTStreamingOutputCallRequest_ResponseType_RawValue(RMTStreamingOutputCallRequest *message, int32_t value); - -#pragma mark - RMTStreamingOutputCallResponse - -typedef GPB_ENUM(RMTStreamingOutputCallResponse_FieldNumber) { - RMTStreamingOutputCallResponse_FieldNumber_Payload = 1, -}; - -// Server-streaming response, as configured by the request and parameters. -@interface RMTStreamingOutputCallResponse : GPBMessage - -// Payload to increase response size. -@property(nonatomic, readwrite) BOOL hasPayload; -@property(nonatomic, readwrite, strong) RMTPayload *payload; - -@end - -CF_EXTERN_C_END diff --git a/src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.m b/src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.m deleted file mode 100644 index 98eb1dc87c8..00000000000 --- a/src/objective-c/generated_libraries/RemoteTestClient/Messages.pbobjc.m +++ /dev/null @@ -1,603 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: messages.proto - -#import "GPBProtocolBuffers_RuntimeSupport.h" - -#import "Messages.pbobjc.h" - -#pragma mark - RMTMessagesRoot - -@implementation RMTMessagesRoot - -@end - -static GPBFileDescriptor *RMTMessagesRoot_FileDescriptor(void) { - // This is called by +initialize so there is no need to worry - // about thread safety of the singleton. - static GPBFileDescriptor *descriptor = NULL; - if (!descriptor) { - descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"grpc.testing" - syntax:GPBFileSyntaxProto3]; - } - return descriptor; -} - -#pragma mark - Enum RMTPayloadType - -GPBEnumDescriptor *RMTPayloadType_EnumDescriptor(void) { - static GPBEnumDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageEnumValueDescription values[] = { - { .name = "Compressable", .number = RMTPayloadType_Compressable }, - { .name = "Uncompressable", .number = RMTPayloadType_Uncompressable }, - { .name = "Random", .number = RMTPayloadType_Random }, - }; - descriptor = [GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(RMTPayloadType) - values:values - valueCount:sizeof(values) / sizeof(GPBMessageEnumValueDescription) - enumVerifier:RMTPayloadType_IsValidValue]; - } - return descriptor; -} - -BOOL RMTPayloadType_IsValidValue(int32_t value__) { - switch (value__) { - case RMTPayloadType_Compressable: - case RMTPayloadType_Uncompressable: - case RMTPayloadType_Random: - return YES; - default: - return NO; - } -} - -#pragma mark - RMTPayload - -@implementation RMTPayload - -@dynamic type; -@dynamic body; - -typedef struct RMTPayload_Storage { - uint32_t _has_storage_[1]; - RMTPayloadType type; - NSData *body; -} RMTPayload_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "type", - .number = RMTPayload_FieldNumber_Type, - .hasIndex = 0, - .flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, - .type = GPBTypeEnum, - .offset = offsetof(RMTPayload_Storage, type), - .defaultValue.valueEnum = RMTPayloadType_Compressable, - .typeSpecific.enumDescFunc = RMTPayloadType_EnumDescriptor, - .fieldOptions = NULL, - }, - { - .name = "body", - .number = RMTPayload_FieldNumber_Body, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeData, - .offset = offsetof(RMTPayload_Storage, body), - .defaultValue.valueData = nil, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTPayload class] - rootClass:[RMTMessagesRoot class] - file:RMTMessagesRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTPayload_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -int32_t RMTPayload_Type_RawValue(RMTPayload *message) { - GPBDescriptor *descriptor = [RMTPayload descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTPayload_FieldNumber_Type]; - return GPBGetInt32IvarWithField(message, field); -} - -void SetRMTPayload_Type_RawValue(RMTPayload *message, int32_t value) { - GPBDescriptor *descriptor = [RMTPayload descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTPayload_FieldNumber_Type]; - GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); -} - -#pragma mark - RMTSimpleRequest - -@implementation RMTSimpleRequest - -@dynamic responseType; -@dynamic responseSize; -@dynamic hasPayload, payload; -@dynamic fillUsername; -@dynamic fillOauthScope; - -typedef struct RMTSimpleRequest_Storage { - uint32_t _has_storage_[1]; - BOOL fillUsername; - BOOL fillOauthScope; - RMTPayloadType responseType; - int32_t responseSize; - RMTPayload *payload; -} RMTSimpleRequest_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "responseType", - .number = RMTSimpleRequest_FieldNumber_ResponseType, - .hasIndex = 0, - .flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, - .type = GPBTypeEnum, - .offset = offsetof(RMTSimpleRequest_Storage, responseType), - .defaultValue.valueEnum = RMTPayloadType_Compressable, - .typeSpecific.enumDescFunc = RMTPayloadType_EnumDescriptor, - .fieldOptions = NULL, - }, - { - .name = "responseSize", - .number = RMTSimpleRequest_FieldNumber_ResponseSize, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RMTSimpleRequest_Storage, responseSize), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "payload", - .number = RMTSimpleRequest_FieldNumber_Payload, - .hasIndex = 2, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RMTSimpleRequest_Storage, payload), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RMTPayload), - .fieldOptions = NULL, - }, - { - .name = "fillUsername", - .number = RMTSimpleRequest_FieldNumber_FillUsername, - .hasIndex = 3, - .flags = GPBFieldOptional, - .type = GPBTypeBool, - .offset = offsetof(RMTSimpleRequest_Storage, fillUsername), - .defaultValue.valueBool = NO, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "fillOauthScope", - .number = RMTSimpleRequest_FieldNumber_FillOauthScope, - .hasIndex = 4, - .flags = GPBFieldOptional, - .type = GPBTypeBool, - .offset = offsetof(RMTSimpleRequest_Storage, fillOauthScope), - .defaultValue.valueBool = NO, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTSimpleRequest class] - rootClass:[RMTMessagesRoot class] - file:RMTMessagesRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTSimpleRequest_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -int32_t RMTSimpleRequest_ResponseType_RawValue(RMTSimpleRequest *message) { - GPBDescriptor *descriptor = [RMTSimpleRequest descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTSimpleRequest_FieldNumber_ResponseType]; - return GPBGetInt32IvarWithField(message, field); -} - -void SetRMTSimpleRequest_ResponseType_RawValue(RMTSimpleRequest *message, int32_t value) { - GPBDescriptor *descriptor = [RMTSimpleRequest descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTSimpleRequest_FieldNumber_ResponseType]; - GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); -} - -#pragma mark - RMTSimpleResponse - -@implementation RMTSimpleResponse - -@dynamic hasPayload, payload; -@dynamic username; -@dynamic oauthScope; - -typedef struct RMTSimpleResponse_Storage { - uint32_t _has_storage_[1]; - RMTPayload *payload; - NSString *username; - NSString *oauthScope; -} RMTSimpleResponse_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "payload", - .number = RMTSimpleResponse_FieldNumber_Payload, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RMTSimpleResponse_Storage, payload), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RMTPayload), - .fieldOptions = NULL, - }, - { - .name = "username", - .number = RMTSimpleResponse_FieldNumber_Username, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeString, - .offset = offsetof(RMTSimpleResponse_Storage, username), - .defaultValue.valueString = nil, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "oauthScope", - .number = RMTSimpleResponse_FieldNumber_OauthScope, - .hasIndex = 2, - .flags = GPBFieldOptional, - .type = GPBTypeString, - .offset = offsetof(RMTSimpleResponse_Storage, oauthScope), - .defaultValue.valueString = nil, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTSimpleResponse class] - rootClass:[RMTMessagesRoot class] - file:RMTMessagesRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTSimpleResponse_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RMTStreamingInputCallRequest - -@implementation RMTStreamingInputCallRequest - -@dynamic hasPayload, payload; - -typedef struct RMTStreamingInputCallRequest_Storage { - uint32_t _has_storage_[1]; - RMTPayload *payload; -} RMTStreamingInputCallRequest_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "payload", - .number = RMTStreamingInputCallRequest_FieldNumber_Payload, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RMTStreamingInputCallRequest_Storage, payload), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RMTPayload), - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTStreamingInputCallRequest class] - rootClass:[RMTMessagesRoot class] - file:RMTMessagesRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTStreamingInputCallRequest_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RMTStreamingInputCallResponse - -@implementation RMTStreamingInputCallResponse - -@dynamic aggregatedPayloadSize; - -typedef struct RMTStreamingInputCallResponse_Storage { - uint32_t _has_storage_[1]; - int32_t aggregatedPayloadSize; -} RMTStreamingInputCallResponse_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "aggregatedPayloadSize", - .number = RMTStreamingInputCallResponse_FieldNumber_AggregatedPayloadSize, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RMTStreamingInputCallResponse_Storage, aggregatedPayloadSize), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTStreamingInputCallResponse class] - rootClass:[RMTMessagesRoot class] - file:RMTMessagesRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTStreamingInputCallResponse_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RMTResponseParameters - -@implementation RMTResponseParameters - -@dynamic size; -@dynamic intervalUs; - -typedef struct RMTResponseParameters_Storage { - uint32_t _has_storage_[1]; - int32_t size; - int32_t intervalUs; -} RMTResponseParameters_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "size", - .number = RMTResponseParameters_FieldNumber_Size, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RMTResponseParameters_Storage, size), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - { - .name = "intervalUs", - .number = RMTResponseParameters_FieldNumber_IntervalUs, - .hasIndex = 1, - .flags = GPBFieldOptional, - .type = GPBTypeInt32, - .offset = offsetof(RMTResponseParameters_Storage, intervalUs), - .defaultValue.valueInt32 = 0, - .typeSpecific.className = NULL, - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTResponseParameters class] - rootClass:[RMTMessagesRoot class] - file:RMTMessagesRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTResponseParameters_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -#pragma mark - RMTStreamingOutputCallRequest - -@implementation RMTStreamingOutputCallRequest - -@dynamic responseType; -@dynamic responseParametersArray; -@dynamic hasPayload, payload; - -typedef struct RMTStreamingOutputCallRequest_Storage { - uint32_t _has_storage_[1]; - RMTPayloadType responseType; - NSMutableArray *responseParametersArray; - RMTPayload *payload; -} RMTStreamingOutputCallRequest_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "responseType", - .number = RMTStreamingOutputCallRequest_FieldNumber_ResponseType, - .hasIndex = 0, - .flags = GPBFieldOptional | GPBFieldHasEnumDescriptor, - .type = GPBTypeEnum, - .offset = offsetof(RMTStreamingOutputCallRequest_Storage, responseType), - .defaultValue.valueEnum = RMTPayloadType_Compressable, - .typeSpecific.enumDescFunc = RMTPayloadType_EnumDescriptor, - .fieldOptions = NULL, - }, - { - .name = "responseParametersArray", - .number = RMTStreamingOutputCallRequest_FieldNumber_ResponseParametersArray, - .hasIndex = GPBNoHasBit, - .flags = GPBFieldRepeated, - .type = GPBTypeMessage, - .offset = offsetof(RMTStreamingOutputCallRequest_Storage, responseParametersArray), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RMTResponseParameters), - .fieldOptions = NULL, - }, - { - .name = "payload", - .number = RMTStreamingOutputCallRequest_FieldNumber_Payload, - .hasIndex = 2, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RMTStreamingOutputCallRequest_Storage, payload), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RMTPayload), - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTStreamingOutputCallRequest class] - rootClass:[RMTMessagesRoot class] - file:RMTMessagesRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTStreamingOutputCallRequest_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - -int32_t RMTStreamingOutputCallRequest_ResponseType_RawValue(RMTStreamingOutputCallRequest *message) { - GPBDescriptor *descriptor = [RMTStreamingOutputCallRequest descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTStreamingOutputCallRequest_FieldNumber_ResponseType]; - return GPBGetInt32IvarWithField(message, field); -} - -void SetRMTStreamingOutputCallRequest_ResponseType_RawValue(RMTStreamingOutputCallRequest *message, int32_t value) { - GPBDescriptor *descriptor = [RMTStreamingOutputCallRequest descriptor]; - GPBFieldDescriptor *field = [descriptor fieldWithNumber:RMTStreamingOutputCallRequest_FieldNumber_ResponseType]; - GPBSetInt32IvarWithFieldInternal(message, field, value, descriptor.file.syntax); -} - -#pragma mark - RMTStreamingOutputCallResponse - -@implementation RMTStreamingOutputCallResponse - -@dynamic hasPayload, payload; - -typedef struct RMTStreamingOutputCallResponse_Storage { - uint32_t _has_storage_[1]; - RMTPayload *payload; -} RMTStreamingOutputCallResponse_Storage; - -// This method is threadsafe because it is initially called -// in +initialize for each subclass. -+ (GPBDescriptor *)descriptor { - static GPBDescriptor *descriptor = NULL; - if (!descriptor) { - static GPBMessageFieldDescription fields[] = { - { - .name = "payload", - .number = RMTStreamingOutputCallResponse_FieldNumber_Payload, - .hasIndex = 0, - .flags = GPBFieldOptional, - .type = GPBTypeMessage, - .offset = offsetof(RMTStreamingOutputCallResponse_Storage, payload), - .defaultValue.valueMessage = nil, - .typeSpecific.className = GPBStringifySymbol(RMTPayload), - .fieldOptions = NULL, - }, - }; - descriptor = [GPBDescriptor allocDescriptorForClass:[RMTStreamingOutputCallResponse class] - rootClass:[RMTMessagesRoot class] - file:RMTMessagesRoot_FileDescriptor() - fields:fields - fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) - oneofs:NULL - oneofCount:0 - enums:NULL - enumCount:0 - ranges:NULL - rangeCount:0 - storageSize:sizeof(RMTStreamingOutputCallResponse_Storage) - wireFormat:NO]; - } - return descriptor; -} - -@end - diff --git a/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec b/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec index c8ac0846504..db497323fff 100644 --- a/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec @@ -1,22 +1,24 @@ Pod::Spec.new do |s| - s.name = 'RemoteTest' - s.version = '0.0.1' - s.summary = 'Protobuf library generated from test.proto, messages.proto, and empty.proto' - s.license = 'New BSD' + s.name = "RemoteTest" + s.version = "0.0.1" + s.license = "New BSD" - s.ios.deployment_target = '6.0' - s.osx.deployment_target = '10.8' + s.ios.deployment_target = "6.0" + s.osx.deployment_target = "10.8" - s.subspec 'Messages' do |ms| - ms.source_files = '*.pbobjc.{h,m}' + # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. + s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto" + + s.subspec "Messages" do |ms| + ms.source_files = "*.pbobjc.{h,m}" ms.requires_arc = false - ms.dependency 'Protobuf', '~> 3.0.0-alpha-3' + ms.dependency "Protobuf", "~> 3.0.0-alpha-3" end - s.subspec 'Services' do |ss| - ss.source_files = '*.pbrpc.{h,m}' + s.subspec "Services" do |ss| + ss.source_files = "*.pbrpc.{h,m}" ss.requires_arc = true - ss.dependency 'gRPC', '~> 0.5' - ss.dependency 'RemoteTest/Messages' + ss.dependency "gRPC", "~> 0.5" + ss.dependency "#{s.name}/Messages" end end diff --git a/src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.h b/src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.h deleted file mode 100644 index aaa0b6ce2db..00000000000 --- a/src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.h +++ /dev/null @@ -1,12 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: test.proto - -#import "GPBProtocolBuffers.h" - -#if GOOGLE_PROTOBUF_OBJC_GEN_VERSION != 30000 -#error This file was generated by a different version of protoc-gen-objc which is incompatible with your Protocol Buffer sources. -#endif - -CF_EXTERN_C_BEGIN - -CF_EXTERN_C_END diff --git a/src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.m b/src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.m deleted file mode 100644 index 08562b828a4..00000000000 --- a/src/objective-c/generated_libraries/RemoteTestClient/Test.pbobjc.m +++ /dev/null @@ -1,9 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: test.proto - -// File empty because all messages, extensions and enum have been filtered. - - -// Dummy symbol that will be stripped but will avoid linker warnings about -// no symbols in the .o form compiling this file. -static int RMTTestRoot_dummy __attribute__((unused,used)) = 0; diff --git a/src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.h b/src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.h deleted file mode 100644 index f799c4fc92f..00000000000 --- a/src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.h +++ /dev/null @@ -1,59 +0,0 @@ -#import "Test.pbobjc.h" -#import - -#import "Empty.pbobjc.h" -#import "Messages.pbobjc.h" - -@protocol GRXWriteable; -@protocol GRXWriter; - -@protocol RMTTestService - -#pragma mark EmptyCall(Empty) returns (Empty) - -- (void)emptyCallWithRequest:(RMTEmpty *)request handler:(void(^)(RMTEmpty *response, NSError *error))handler; - -- (ProtoRPC *)RPCToEmptyCallWithRequest:(RMTEmpty *)request handler:(void(^)(RMTEmpty *response, NSError *error))handler; - - -#pragma mark UnaryCall(SimpleRequest) returns (SimpleResponse) - -- (void)unaryCallWithRequest:(RMTSimpleRequest *)request handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler; - -- (ProtoRPC *)RPCToUnaryCallWithRequest:(RMTSimpleRequest *)request handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler; - - -#pragma mark StreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse) - -- (void)streamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler; - -- (ProtoRPC *)RPCToStreamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler; - - -#pragma mark StreamingInputCall(stream StreamingInputCallRequest) returns (StreamingInputCallResponse) - -- (void)streamingInputCallWithRequestsWriter:(id)request handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler; - -- (ProtoRPC *)RPCToStreamingInputCallWithRequestsWriter:(id)request handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler; - - -#pragma mark FullDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse) - -- (void)fullDuplexCallWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler; - -- (ProtoRPC *)RPCToFullDuplexCallWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler; - - -#pragma mark HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse) - -- (void)halfDuplexCallWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler; - -- (ProtoRPC *)RPCToHalfDuplexCallWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler; - - -@end - -// Basic service implementation, over gRPC, that only does marshalling and parsing. -@interface RMTTestService : ProtoService -- (instancetype)initWithHost:(NSString *)host NS_DESIGNATED_INITIALIZER; -@end diff --git a/src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.m b/src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.m deleted file mode 100644 index faba07769e5..00000000000 --- a/src/objective-c/generated_libraries/RemoteTestClient/Test.pbrpc.m +++ /dev/null @@ -1,96 +0,0 @@ -#import "Test.pbrpc.h" -#import -#import -#import - -static NSString *const kPackageName = @"grpc.testing"; -static NSString *const kServiceName = @"TestService"; - -@implementation RMTTestService - -// Designated initializer -- (instancetype)initWithHost:(NSString *)host { - return (self = [super initWithHost:host packageName:kPackageName serviceName:kServiceName]); -} - -// Override superclass initializer to disallow different package and service names. -- (instancetype)initWithHost:(NSString *)host - packageName:(NSString *)packageName - serviceName:(NSString *)serviceName { - return [self initWithHost:host]; -} - - -#pragma mark EmptyCall(Empty) returns (Empty) - -- (void)emptyCallWithRequest:(RMTEmpty *)request handler:(void(^)(RMTEmpty *response, NSError *error))handler{ - [[self RPCToEmptyCallWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToEmptyCallWithRequest:(RMTEmpty *)request handler:(void(^)(RMTEmpty *response, NSError *error))handler{ - return [self RPCToMethod:@"EmptyCall" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[RMTEmpty class] - responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; -} -#pragma mark UnaryCall(SimpleRequest) returns (SimpleResponse) - -- (void)unaryCallWithRequest:(RMTSimpleRequest *)request handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler{ - [[self RPCToUnaryCallWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToUnaryCallWithRequest:(RMTSimpleRequest *)request handler:(void(^)(RMTSimpleResponse *response, NSError *error))handler{ - return [self RPCToMethod:@"UnaryCall" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[RMTSimpleResponse class] - responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; -} -#pragma mark StreamingOutputCall(StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse) - -- (void)streamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{ - [[self RPCToStreamingOutputCallWithRequest:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToStreamingOutputCallWithRequest:(RMTStreamingOutputCallRequest *)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{ - return [self RPCToMethod:@"StreamingOutputCall" - requestsWriter:[GRXWriter writerWithValue:request] - responseClass:[RMTStreamingOutputCallResponse class] - responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; -} -#pragma mark StreamingInputCall(stream StreamingInputCallRequest) returns (StreamingInputCallResponse) - -- (void)streamingInputCallWithRequestsWriter:(id)request handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler{ - [[self RPCToStreamingInputCallWithRequestsWriter:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToStreamingInputCallWithRequestsWriter:(id)request handler:(void(^)(RMTStreamingInputCallResponse *response, NSError *error))handler{ - return [self RPCToMethod:@"StreamingInputCall" - requestsWriter:request - responseClass:[RMTStreamingInputCallResponse class] - responsesWriteable:[GRXWriteable writeableWithSingleValueHandler:handler]]; -} -#pragma mark FullDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse) - -- (void)fullDuplexCallWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{ - [[self RPCToFullDuplexCallWithRequestsWriter:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToFullDuplexCallWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{ - return [self RPCToMethod:@"FullDuplexCall" - requestsWriter:request - responseClass:[RMTStreamingOutputCallResponse class] - responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; -} -#pragma mark HalfDuplexCall(stream StreamingOutputCallRequest) returns (stream StreamingOutputCallResponse) - -- (void)halfDuplexCallWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{ - [[self RPCToHalfDuplexCallWithRequestsWriter:request handler:handler] start]; -} -// Returns a not-yet-started RPC object. -- (ProtoRPC *)RPCToHalfDuplexCallWithRequestsWriter:(id)request handler:(void(^)(BOOL done, RMTStreamingOutputCallResponse *response, NSError *error))handler{ - return [self RPCToMethod:@"HalfDuplexCall" - requestsWriter:request - responseClass:[RMTStreamingOutputCallResponse class] - responsesWriteable:[GRXWriteable writeableWithStreamHandler:handler]]; -} -@end From ceb43623bab1fc148ec6eb4f539eefc46b4deb97 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Wed, 3 Jun 2015 23:17:49 -0700 Subject: [PATCH 12/16] =?UTF-8?q?Use=20grpc-common=E2=80=99s=20route=5Fgui?= =?UTF-8?q?de=20in=20local=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/objective-c/tests/LocalClearTextTests.m | 82 +++++++++++---------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/src/objective-c/tests/LocalClearTextTests.m b/src/objective-c/tests/LocalClearTextTests.m index 6a9496b623a..68ffd232003 100644 --- a/src/objective-c/tests/LocalClearTextTests.m +++ b/src/objective-c/tests/LocalClearTextTests.m @@ -38,56 +38,62 @@ #import #import #import -#import -#import +#import +#import -// These tests require the gRPC-Java "RouteGuide" sample server to be running locally. To do so, -// install Gradle by following the instructions here: https://docs.gradle.org/current/userguide/installation.html -// And use it to run the server by following the instructions here: https://github.com/grpc/grpc-java/tree/master/examples +// These tests require a gRPC "RouteGuide" sample server to be running locally. You can compile and +// run one by following the instructions here: https://github.com/grpc/grpc-common/blob/master/cpp/cpptutorial.md#try-it-out +// Be sure to have the C gRPC library installed in your system (for example, by having followed the +// instructions at https://github.com/grpc/homebrew-grpc + +static NSString * const kRouteGuideHost = @"http://localhost:50051"; +static NSString * const kPackage = @"examples"; +static NSString * const kService = @"RouteGuide"; @interface LocalClearTextTests : XCTestCase @end @implementation LocalClearTextTests -- (void)testConnectionToLocalServer { - __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Server reachable."]; - - // This method isn't implemented by the local server. - GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing" - interface:@"TestService" - method:@"EmptyCall"]; - - id requestsWriter = [GRXWriter writerWithValue:[NSData data]]; - - GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980" - method:method - requestsWriter:requestsWriter]; - - id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { - XCTFail(@"Received unexpected response: %@", value); - } completionHandler:^(NSError *errorOrNil) { - XCTAssertNotNil(errorOrNil, @"Finished without error!"); - XCTAssertEqual(errorOrNil.code, 12, @"Finished with unexpected error: %@", errorOrNil); - [expectation fulfill]; - }]; - - [call startWithWriteable:responsesWriteable]; - - [self waitForExpectationsWithTimeout:2.0 handler:nil]; -} +// This test currently fails: see Issue #1907. +//- (void)testConnectionToLocalServer { +// __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Server reachable."]; +// +// // This method isn't implemented by the local server. +// GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:kPackage +// interface:kService +// method:@"EmptyCall"]; +// +// id requestsWriter = [GRXWriter writerWithValue:[NSData data]]; +// +// GRPCCall *call = [[GRPCCall alloc] initWithHost:kRouteGuideHost +// method:method +// requestsWriter:requestsWriter]; +// +// id responsesWriteable = [[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { +// XCTFail(@"Received unexpected response: %@", value); +// } completionHandler:^(NSError *errorOrNil) { +// XCTAssertNotNil(errorOrNil, @"Finished without error!"); +// XCTAssertEqual(errorOrNil.code, 12, @"Finished with unexpected error: %@", errorOrNil); +// [expectation fulfill]; +// }]; +// +// [call startWithWriteable:responsesWriteable]; +// +// [self waitForExpectationsWithTimeout:8.0 handler:nil]; +//} - (void)testEmptyRPC { __weak XCTestExpectation *response = [self expectationWithDescription:@"Empty response received."]; __weak XCTestExpectation *completion = [self expectationWithDescription:@"Empty RPC completed."]; - GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide" - interface:@"RouteGuide" + GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:kPackage + interface:kService method:@"RecordRoute"]; id requestsWriter = [GRXWriter emptyWriter]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980" + GRPCCall *call = [[GRPCCall alloc] initWithHost:kRouteGuideHost method:method requestsWriter:requestsWriter]; @@ -109,8 +115,8 @@ __weak XCTestExpectation *response = [self expectationWithDescription:@"Response received."]; __weak XCTestExpectation *completion = [self expectationWithDescription:@"RPC completed."]; - GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.example.routeguide" - interface:@"RouteGuide" + GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:kPackage + interface:kService method:@"GetFeature"]; RGDPoint *point = [RGDPoint message]; @@ -118,7 +124,7 @@ point.longitude = -15E7; id requestsWriter = [GRXWriter writerWithValue:[point data]]; - GRPCCall *call = [[GRPCCall alloc] initWithHost:@"http://127.0.0.1:8980" + GRPCCall *call = [[GRPCCall alloc] initWithHost:kRouteGuideHost method:method requestsWriter:requestsWriter]; @@ -145,7 +151,7 @@ point.latitude = 28E7; point.longitude = -15E7; - RGDRouteGuide *service = [[RGDRouteGuide alloc] initWithHost:@"http://127.0.0.1:8980"]; + RGDRouteGuide *service = [[RGDRouteGuide alloc] initWithHost:kRouteGuideHost]; [service getFeatureWithRequest:point handler:^(RGDFeature *response, NSError *error) { XCTAssertNil(error, @"Finished with unexpected error: %@", error); XCTAssertEqualObjects(point, response.location); From 27a0627917179b85cbf2f77efecc72cde8f4eebf Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 4 Jun 2015 14:13:20 -0700 Subject: [PATCH 13/16] Make podspecs work for nested dirs --- .../RemoteTestClient/RemoteTest.podspec | 8 +++++--- .../RouteGuideClient/RouteGuide.podspec | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec b/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec index db497323fff..0066313ff6c 100644 --- a/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec +++ b/src/objective-c/generated_libraries/RemoteTestClient/RemoteTest.podspec @@ -7,16 +7,18 @@ Pod::Spec.new do |s| s.osx.deployment_target = "10.8" # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. - s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto" + s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto **/*.proto" s.subspec "Messages" do |ms| - ms.source_files = "*.pbobjc.{h,m}" + ms.source_files = "*.pbobjc.{h,m}", "**/*.pbobjc.{h,m}" + ms.header_mappings_dir = "." ms.requires_arc = false ms.dependency "Protobuf", "~> 3.0.0-alpha-3" end s.subspec "Services" do |ss| - ss.source_files = "*.pbrpc.{h,m}" + ss.source_files = "*.pbrpc.{h,m}", "**/*.pbrpc.{h,m}" + ss.header_mappings_dir = "." ss.requires_arc = true ss.dependency "gRPC", "~> 0.5" ss.dependency "#{s.name}/Messages" diff --git a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec index 9df8e2337da..58ccb4873ee 100644 --- a/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec +++ b/src/objective-c/generated_libraries/RouteGuideClient/RouteGuide.podspec @@ -7,16 +7,18 @@ Pod::Spec.new do |s| s.osx.deployment_target = "10.8" # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. - s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto" + s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto **/*.proto" s.subspec "Messages" do |ms| - ms.source_files = "*.pbobjc.{h,m}" + ms.source_files = "*.pbobjc.{h,m}", "**/*.pbobjc.{h,m}" + ms.header_mappings_dir = "." ms.requires_arc = false ms.dependency "Protobuf", "~> 3.0.0-alpha-3" end s.subspec "Services" do |ss| - ss.source_files = "*.pbrpc.{h,m}" + ss.source_files = "*.pbrpc.{h,m}", "**/*.pbrpc.{h,m}" + ss.header_mappings_dir = "." ss.requires_arc = true ss.dependency "gRPC", "~> 0.5" ss.dependency "#{s.name}/Messages" From df1a29f7ed0572f2ba9a48b828f1f52bda59e882 Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 4 Jun 2015 15:34:04 -0700 Subject: [PATCH 14/16] Update README (minus table of content) --- src/objective-c/README.md | 115 ++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 47 deletions(-) diff --git a/src/objective-c/README.md b/src/objective-c/README.md index 921eb69231c..d99f83110c4 100644 --- a/src/objective-c/README.md +++ b/src/objective-c/README.md @@ -1,78 +1,80 @@ # gRPC for Objective-C -- [Install protoc with the gRPC plugin](#install) -- [Use protoc to generate a gRPC library](#protoc) -- [Integrate the generated gRPC library in your project](#cocoapods) -- [Use the generated library in your code](#use) -- [Alternative methods](#alternatives) - - [Install protoc and the gRPC plugin without using Homebrew](#nohomebrew) - - [Integrate the generated gRPC library without using Cocoapods](#nococoapods) +While gRPC doesn't require the use of an IDL to describe the API of services, using one simplifies +usage and adds some interoperability guarantees. Here we use [Protocol Buffers][], and provide a +plugin for the Protobuf Compiler (_protoc_) to generate client libraries to communicate with gRPC +services. ## Install protoc with the gRPC plugin On Mac OS X, install [homebrew][]. On Linux, install [linuxbrew][]. -Run the following command to install the Protocol Buffers compiler (_protoc_) and the gRPC _protoc_ plugin: +Run the following command to install _protoc_ and the gRPC _protoc_ plugin: ```sh $ curl -fsSL https://goo.gl/getgrpc | bash - ``` -This will download and run the [gRPC install script][]. After the command completes, you're ready to proceed. +This will download and run the [gRPC install script][]. After the command completes, you're ready to +proceed. - -## Use protoc to generate a gRPC library + +## Write your API declaration in proto format -Run _protoc_ with the following flags to generate the client library for your `.proto` files: - -```sh -protoc --objc_out=. --objcgrpc_out=. *.proto -``` - -This will generate a pair of `.pbobjc.h`/`.pbobjc.m` files for each `.proto` file, with the messages and enums defined in them. And a pair of `.pbrpc.h`/`.pbrpc.m` files for each `.proto` file with services defined. The latter contains the code to make remote calls to the specified API. +For this you can consult the [Protocol Buffers][]' official documentation, or learn from a quick +example [here](https://github.com/grpc/grpc-common#defining-a-service). -## Integrate the generated gRPC library in your project +## Integrate a proto library in your project Install [Cocoapods](https://cocoapods.org/#install). -You need to create a Podspec file for the generated library. You may simply copy the following example to the directory where the source files were generated, updating the name and other metadata of the Podspec as necessary: +You need to create a Podspec file for your proto library. You may simply copy the following example +to the directory where your `.proto` files are located, updating the name, version and license as +necessary: ```ruby Pod::Spec.new do |s| s.name = '' - s.version = '...' - s.summary = 'Client library to make RPCs to ' - s.homepage = '...' + s.version = '0.0.1' s.license = '...' - s.authors = { '' => '' } s.ios.deployment_target = '6.0' s.osx.deployment_target = '10.8' - s.subspec 'Messages' do |ms| - ms.source_files = '*.pbobjc.{h,m}', '**/*.pbobjc.{h,m}' - ms.header_mappings_dir = '.' + # Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients. + # You can run this command manually if you later change your protos and need to regenerate. + s.prepare_command = "protoc --objc_out=. --objcgrpc_out=. *.proto **/*.proto" + + # The --objc_out plugin generates a pair of .pbobjc.h/.pbobjc.m files for each .proto file. + s.subspec "Messages" do |ms| + ms.source_files = "*.pbobjc.{h,m}", "**/*.pbobjc.{h,m}" + ms.header_mappings_dir = "." ms.requires_arc = false - ms.dependency 'Protobuf', '~> 3.0' + ms.dependency "Protobuf", "~> 3.0.0-alpha-3" end - s.subspec 'Services' do |ss| - ss.source_files = '*.pbrpc.{h,m}', '**/*.pbrpc.{h,m}' - ss.header_mappings_dir = '.' + # The --objcgrpc_out plugin generates a pair of .pbrpc.h/.pbrpc.m files for each .proto file with + # a service defined. + s.subspec "Services" do |ss| + ss.source_files = "*.pbrpc.{h,m}", "**/*.pbrpc.{h,m}" + ss.header_mappings_dir = "." ss.requires_arc = true - ss.dependency 'gRPC', '~> 0.0' - ss.dependency '/Messages' + ss.dependency "gRPC", "~> 0.5" + ss.dependency "#{s.name}/Messages" end end ``` -The file should be named `.podspec`. You can refer to this [example Podspec][]. Once your library has a Podspec, Cocoapods can install it into any XCode project. For that, go into your project's directory and create a Podfile by running: +The file should be named `.podspec`. Once your library has a Podspec, Cocoapods +can install it into any XCode project. For that, go into your project's directory and create a +Podfile by running: ```sh pod init ``` -Next add a line to your Podfile to refer to your library's Podspec. Use `:path` as described [here](https://guides.cocoapods.org/using/the-podfile.html#using-the-files-from-a-folder-local-to-the-machine): +Next add a line to your Podfile to refer to your library's Podspec. Use `:path` as described +[here](https://guides.cocoapods.org/using/the-podfile.html#using-the-files-from-a-folder-local-to-the-machine): ```ruby pod '', :path => 'path/to/the/directory/of/your/podspec' @@ -91,15 +93,25 @@ pod install Please check this [sample app][] for examples of how to use a generated gRPC library. + +## Use gRPC without Protobuf + +The [sample app][] has an example of how to use the generic gRPC Objective-C client without +generated files. + -## Alternative methods +## Alternative installation methods - + ### Install protoc and the gRPC plugin without using Homebrew -First install v3 of the Protocol Buffers compiler (_protoc_), by cloning [its Git repository](https://github.com/google/protobuf) and following these [installation instructions](https://github.com/google/protobuf#c-installation---unix) (the ones titled C++; don't miss the note for Mac users). +First install v3 of the Protocol Buffers compiler (_protoc_), by cloning +[its Git repository](https://github.com/google/protobuf) and following these +[installation instructions](https://github.com/google/protobuf#c-installation---unix) +(the ones titled C++; don't miss the note for Mac users). -Then clone this repository and execute the following commands from the root directory where it was cloned. +Then clone this repository and execute the following commands from the root directory where it was +cloned. Compile the gRPC plugins for _protoc_: ```sh @@ -110,23 +122,32 @@ Create a symbolic link to the compiled plugin binary somewhere in your `$PATH`: ```sh ln -s `pwd`/bins/opt/grpc_objective_c_plugin /usr/local/bin/protoc-gen-objcgrpc ``` -(Notice that the name of the created link must begin with "protoc-gen-" for _protoc_ to recognize it as a plugin). +(Notice that the name of the created link must begin with "protoc-gen-" for _protoc_ to recognize it +as a plugin). -If you don't want to create the symbolic link, you can alternatively copy the binary (with the appropriate name). Or you might prefer instead to specify the plugin's path as a flag when invoking _protoc_, in which case no system modification nor renaming is necessary. +If you don't want to create the symbolic link, you can alternatively copy the binary (with the +appropriate name). Or you might prefer instead to specify the plugin's path as a flag when invoking +_protoc_, in which case no system modification nor renaming is necessary. - + ### Integrate the generated gRPC library without using Cocoapods -You need to compile the generated `.pbpbjc.*` files (the enums and messages) without ARC support, and the generated `.pbrpc.*` files (the services) with ARC support. The generated code depends on v0.3+ of the Objective-C gRPC runtime library and v3.0+ of the Objective-C Protobuf runtime library. +You need to compile the generated `.pbpbjc.*` files (the enums and messages) without ARC support, +and the generated `.pbrpc.*` files (the services) with ARC support. The generated code depends on +v0.5+ of the Objective-C gRPC runtime library and v3.0.0-alpha-3+ of the Objective-C Protobuf +runtime library. -These libraries need to be integrated into your project as described in their respective Podspec files: +These libraries need to be integrated into your project as described in their respective Podspec +files: -* [Podspec](https://github.com/grpc/grpc/blob/master/gRPC.podspec) for the Objective-C gRPC runtime library. This can be tedious to configure manually. -* [Podspec](https://github.com/jcanizales/protobuf/blob/add-podspec/Protobuf.podspec) for the Objective-C Protobuf runtime library. +* [Podspec](https://github.com/grpc/grpc/blob/master/gRPC.podspec) for the Objective-C gRPC runtime +library. This can be tedious to configure manually. +* [Podspec](https://github.com/jcanizales/protobuf/blob/add-podspec/Protobuf.podspec) for the +Objective-C Protobuf runtime library. +[Protocol Buffers]:https://developers.google.com/protocol-buffers/ [homebrew]:http://brew.sh [linuxbrew]:https://github.com/Homebrew/linuxbrew [gRPC install script]:https://raw.githubusercontent.com/grpc/homebrew-grpc/master/scripts/install -[example Podspec]:https://github.com/grpc/grpc/blob/master/src/objective-c/examples/Sample/RemoteTestClient/RemoteTest.podspec [example Podfile]:https://github.com/grpc/grpc/blob/master/src/objective-c/examples/Sample/Podfile [sample app]: https://github.com/grpc/grpc/tree/master/src/objective-c/examples/Sample From 80afb1436f1d73291a7e6d221cb1bff9385a060e Mon Sep 17 00:00:00 2001 From: Jorge Canizales Date: Thu, 4 Jun 2015 15:44:26 -0700 Subject: [PATCH 15/16] Regenerate README table of contents --- src/objective-c/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/objective-c/README.md b/src/objective-c/README.md index d99f83110c4..728e2264805 100644 --- a/src/objective-c/README.md +++ b/src/objective-c/README.md @@ -1,5 +1,14 @@ # gRPC for Objective-C +- [Install protoc with the gRPC plugin](#install) +- [Write your API declaration in proto format](#write-protos) +- [Integrate a proto library in your project](#cocoapods) +- [Use the generated library in your code](#use) +- [Use gRPC without Protobuf](#no-proto) +- [Alternative installation methods](#alternatives) + - [Install protoc and the gRPC plugin without using Homebrew](#no-homebrew) + - [Integrate the generated gRPC library without using Cocoapods](#no-cocoapods) + While gRPC doesn't require the use of an IDL to describe the API of services, using one simplifies usage and adds some interoperability guarantees. Here we use [Protocol Buffers][], and provide a plugin for the Protobuf Compiler (_protoc_) to generate client libraries to communicate with gRPC From 16d36362d4a6fd474b26520a53757e9f8785176b Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Thu, 4 Jun 2015 15:49:03 -0700 Subject: [PATCH 16/16] Set up Node, Python, and Ruby environment in Jenkins slave. Made other minor changes to make those work --- tools/jenkins/grpc_jenkins_slave/Dockerfile | 36 +++++++++++++++++++++ tools/jenkins/run_jenkins.sh | 4 ++- tools/run_tests/build_node.sh | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/tools/jenkins/grpc_jenkins_slave/Dockerfile b/tools/jenkins/grpc_jenkins_slave/Dockerfile index a98ad6f5522..c3722457dbe 100644 --- a/tools/jenkins/grpc_jenkins_slave/Dockerfile +++ b/tools/jenkins/grpc_jenkins_slave/Dockerfile @@ -79,5 +79,41 @@ ENV NUGET mono /var/local/NuGet.exe # TODO(jtattermusch): add dependencies for other languages +################## +# Node dependencies + +# Install nvm +RUN curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash +RUN /bin/bash -l -c "nvm install 0.12" + +################## +# Ruby dependencies + +# Install rvm +RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 +RUN \curl -sSL https://get.rvm.io | bash -s stable + +# Install Ruby 2.1 +RUN /bin/bash -l -c "rvm install ruby-2.1" +RUN /bin/bash -l -c "rvm use --default ruby-2.1" +RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc" +RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc" +RUN /bin/bash -l -c "echo 'rvm --default use ruby-2.1' >> ~/.bashrc" +RUN /bin/bash -l -c "gem install bundler --no-ri --no-rdoc" + +################## +# Python dependencies + +# Install dependencies + +RUN apt-get update && apt-get install -y \ + python-all-dev \ + python3-all-dev \ + python-pip \ + python-virtualenv + +# Install Python packages from PyPI +RUN pip install futures==2.2.0 enum34==1.0.4 protobuf==3.0.0a2 + # Define the default command. CMD ["bash"] diff --git a/tools/jenkins/run_jenkins.sh b/tools/jenkins/run_jenkins.sh index 8afaa91ea7f..a95819af601 100755 --- a/tools/jenkins/run_jenkins.sh +++ b/tools/jenkins/run_jenkins.sh @@ -42,9 +42,11 @@ then echo "building $language on Linux" # Run tests inside docker - docker run grpc/grpc_jenkins_slave bash -c "git clone --recursive $GIT_URL /var/local/git/grpc \ + docker run grpc/grpc_jenkins_slave bash -c -l "git clone --recursive $GIT_URL /var/local/git/grpc \ && cd /var/local/git/grpc && git checkout -f $GIT_COMMIT \ && git submodule update \ + && nvm use 0.12 \ + && rvm use ruby-2.1 \ && tools/run_tests/run_tests.py -t -l $language" elif [ "$platform" == "windows" ] then diff --git a/tools/run_tests/build_node.sh b/tools/run_tests/build_node.sh index c85ecf1b259..95ffb94c6ea 100755 --- a/tools/run_tests/build_node.sh +++ b/tools/run_tests/build_node.sh @@ -41,4 +41,4 @@ export LDFLAGS=-L`pwd`/libs/$CONFIG cd src/node -npm install +npm install --unsafe-perm