Merge branch 'that-which-we-call-a-rose' into tis-but-thy-name

pull/2303/head
Craig Tiller 10 years ago
commit cf4db6d9a7
  1. 31
      BUILD
  2. 2
      Makefile
  3. 2
      build.json
  4. 81
      gRPC.podspec
  5. 12
      src/compiler/objective_c_plugin.cc
  6. 6
      src/core/client_config/lb_policy.h
  7. 34
      src/core/client_config/resolver_factory.c
  8. 64
      src/core/client_config/resolver_factory.h
  9. 7
      src/cpp/server/server.cc
  10. 2
      src/objective-c/GRPCClient/GRPCCall.h
  11. 2
      src/objective-c/GRPCClient/GRPCCall.m
  12. 2
      src/objective-c/GRPCClient/private/GRPCDelegateWrapper.m
  13. 2
      src/objective-c/GRPCClient/private/GRPCMethodName+HTTP2Encoding.h
  14. 2
      src/objective-c/GRPCClient/private/NSError+GRPC.m
  15. 2
      src/objective-c/ProtoRPC/ProtoRPC.h
  16. 6
      src/objective-c/ProtoRPC/ProtoRPC.m
  17. 6
      src/objective-c/ProtoRPC/ProtoService.m
  18. 2
      src/objective-c/RxLibrary/transformations/GRXMappingWriter.h
  19. 8
      src/objective-c/examples/Sample/Sample/ViewController.m
  20. 8
      src/objective-c/tests/GRPCClientTests.m
  21. 6
      src/objective-c/tests/InteropTests.m
  22. 8
      src/objective-c/tests/LocalClearTextTests.m
  23. 6
      src/objective-c/tests/RxLibraryUnitTests.m
  24. 2
      src/ruby/lib/grpc/version.rb
  25. 27
      templates/BUILD.template
  26. 88
      templates/gRPC.podspec.template
  27. 2
      tools/doxygen/Doxyfile.core.internal
  28. 3
      vsprojects/grpc/grpc.vcxproj
  29. 6
      vsprojects/grpc/grpc.vcxproj.filters
  30. 3
      vsprojects/grpc_unsecure/grpc_unsecure.vcxproj
  31. 6
      vsprojects/grpc_unsecure/grpc_unsecure.vcxproj.filters

31
BUILD

@ -161,6 +161,7 @@ cc_library(
"src/core/client_config/client_config.h", "src/core/client_config/client_config.h",
"src/core/client_config/lb_policy.h", "src/core/client_config/lb_policy.h",
"src/core/client_config/resolver.h", "src/core/client_config/resolver.h",
"src/core/client_config/resolver_factory.h",
"src/core/client_config/subchannel.h", "src/core/client_config/subchannel.h",
"src/core/client_config/subchannel_factory.h", "src/core/client_config/subchannel_factory.h",
"src/core/compression/message_compress.h", "src/core/compression/message_compress.h",
@ -271,6 +272,7 @@ cc_library(
"src/core/client_config/client_config.c", "src/core/client_config/client_config.c",
"src/core/client_config/lb_policy.c", "src/core/client_config/lb_policy.c",
"src/core/client_config/resolver.c", "src/core/client_config/resolver.c",
"src/core/client_config/resolver_factory.c",
"src/core/client_config/subchannel.c", "src/core/client_config/subchannel.c",
"src/core/client_config/subchannel_factory.c", "src/core/client_config/subchannel_factory.c",
"src/core/compression/algorithm.c", "src/core/compression/algorithm.c",
@ -397,6 +399,7 @@ cc_library(
"src/core/client_config/client_config.h", "src/core/client_config/client_config.h",
"src/core/client_config/lb_policy.h", "src/core/client_config/lb_policy.h",
"src/core/client_config/resolver.h", "src/core/client_config/resolver.h",
"src/core/client_config/resolver_factory.h",
"src/core/client_config/subchannel.h", "src/core/client_config/subchannel.h",
"src/core/client_config/subchannel_factory.h", "src/core/client_config/subchannel_factory.h",
"src/core/compression/message_compress.h", "src/core/compression/message_compress.h",
@ -485,6 +488,7 @@ cc_library(
"src/core/client_config/client_config.c", "src/core/client_config/client_config.c",
"src/core/client_config/lb_policy.c", "src/core/client_config/lb_policy.c",
"src/core/client_config/resolver.c", "src/core/client_config/resolver.c",
"src/core/client_config/resolver_factory.c",
"src/core/client_config/subchannel.c", "src/core/client_config/subchannel.c",
"src/core/client_config/subchannel_factory.c", "src/core/client_config/subchannel_factory.c",
"src/core/compression/algorithm.c", "src/core/compression/algorithm.c",
@ -873,3 +877,30 @@ cc_binary(
objc_path = "src/objective-c"
rx_library_path = objc_path + "/RxLibrary"
objc_library(
name = "rx_library",
hdrs = glob([
rx_library_path + "/*.h",
rx_library_path + "/transformations/*.h",
]),
srcs = glob([
rx_library_path + "/*.m",
rx_library_path + "/transformations/*.m",
]),
includes = [objc_path],
deps = [
":rx_library_private",
],
)
objc_library(
name = "rx_library_private",
hdrs = glob([rx_library_path + "/private/*.h"]),
srcs = glob([rx_library_path + "/private/*.m"]),
visibility = ["//visibility:private"],
)

@ -3023,6 +3023,7 @@ LIBGRPC_SRC = \
src/core/client_config/client_config.c \ src/core/client_config/client_config.c \
src/core/client_config/lb_policy.c \ src/core/client_config/lb_policy.c \
src/core/client_config/resolver.c \ src/core/client_config/resolver.c \
src/core/client_config/resolver_factory.c \
src/core/client_config/subchannel.c \ src/core/client_config/subchannel.c \
src/core/client_config/subchannel_factory.c \ src/core/client_config/subchannel_factory.c \
src/core/compression/algorithm.c \ src/core/compression/algorithm.c \
@ -3274,6 +3275,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/client_config/client_config.c \ src/core/client_config/client_config.c \
src/core/client_config/lb_policy.c \ src/core/client_config/lb_policy.c \
src/core/client_config/resolver.c \ src/core/client_config/resolver.c \
src/core/client_config/resolver_factory.c \
src/core/client_config/subchannel.c \ src/core/client_config/subchannel.c \
src/core/client_config/subchannel_factory.c \ src/core/client_config/subchannel_factory.c \
src/core/compression/algorithm.c \ src/core/compression/algorithm.c \

@ -122,6 +122,7 @@
"src/core/client_config/client_config.h", "src/core/client_config/client_config.h",
"src/core/client_config/lb_policy.h", "src/core/client_config/lb_policy.h",
"src/core/client_config/resolver.h", "src/core/client_config/resolver.h",
"src/core/client_config/resolver_factory.h",
"src/core/client_config/subchannel.h", "src/core/client_config/subchannel.h",
"src/core/client_config/subchannel_factory.h", "src/core/client_config/subchannel_factory.h",
"src/core/compression/message_compress.h", "src/core/compression/message_compress.h",
@ -210,6 +211,7 @@
"src/core/client_config/client_config.c", "src/core/client_config/client_config.c",
"src/core/client_config/lb_policy.c", "src/core/client_config/lb_policy.c",
"src/core/client_config/resolver.c", "src/core/client_config/resolver.c",
"src/core/client_config/resolver_factory.c",
"src/core/client_config/subchannel.c", "src/core/client_config/subchannel.c",
"src/core/client_config/subchannel_factory.c", "src/core/client_config/subchannel_factory.c",
"src/core/compression/algorithm.c", "src/core/compression/algorithm.c",

File diff suppressed because one or more lines are too long

@ -62,8 +62,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
{ {
// Generate .pbrpc.h // Generate .pbrpc.h
string imports = string("#import \"") + file_name + ".pbobjc.h\"\n" string imports = string("#import \"") + file_name + ".pbobjc.h\"\n\n"
"#import <gRPC/ProtoService.h>\n"; "#import <ProtoRPC/ProtoService.h>\n";
// TODO(jcanizales): Instead forward-declare the input and output types // TODO(jcanizales): Instead forward-declare the input and output types
// and import the files in the .pbrpc.m // and import the files in the .pbrpc.m
@ -87,10 +87,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
{ {
// Generate .pbrpc.m // Generate .pbrpc.m
string imports = string("#import \"") + file_name + ".pbrpc.h\"\n" string imports = string("#import \"") + file_name + ".pbrpc.h\"\n\n"
"#import <gRPC/GRXWriteable.h>\n" "#import <ProtoRPC/ProtoRPC.h>\n"
"#import <gRPC/GRXWriter+Immediate.h>\n" "#import <RxLibrary/GRXWriteable.h>\n"
"#import <gRPC/ProtoRPC.h>\n"; "#import <RxLibrary/GRXWriter+Immediate.h>\n";
string definitions; string definitions;
for (int i = 0; i < file->service_count(); i++) { for (int i = 0; i < file->service_count(); i++) {

@ -41,8 +41,7 @@
typedef struct grpc_lb_policy grpc_lb_policy; typedef struct grpc_lb_policy grpc_lb_policy;
typedef struct grpc_lb_policy_vtable grpc_lb_policy_vtable; typedef struct grpc_lb_policy_vtable grpc_lb_policy_vtable;
typedef void (*grpc_lb_completion)(void *cb_arg, typedef void (*grpc_lb_completion)(void *cb_arg, grpc_subchannel *subchannel,
grpc_subchannel *subchannel,
grpc_status_code status, const char *errmsg); grpc_status_code status, const char *errmsg);
struct grpc_lb_policy_vtable { struct grpc_lb_policy_vtable {
@ -53,8 +52,7 @@ struct grpc_lb_policy_vtable {
/** implement grpc_lb_policy_pick */ /** implement grpc_lb_policy_pick */
void (*pick)(grpc_lb_policy *policy, grpc_pollset *pollset, void (*pick)(grpc_lb_policy *policy, grpc_pollset *pollset,
grpc_metadata_batch *initial_metadata, grpc_metadata_batch *initial_metadata, grpc_subchannel **target,
grpc_subchannel **target,
grpc_iomgr_closure *on_complete); grpc_iomgr_closure *on_complete);
}; };

@ -0,0 +1,34 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "src/core/client_config/resolver_factory.h"

@ -0,0 +1,64 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H
#define GRPC_INTERNAL_CORE_CLIENT_CONFIG_RESOLVER_FACTORY_H
#include "src/core/client_config/client_config.h"
#include "src/core/iomgr/iomgr.h"
#include "src/core/iomgr/sockaddr.h"
typedef struct grpc_resolver grpc_resolver;
typedef struct grpc_resolver_vtable grpc_resolver_vtable;
/** grpc_resolver provides grpc_client_config objects to grpc_channel
objects */
struct grpc_resolver {
const grpc_resolver_vtable *vtable;
};
struct grpc_resolver_factory_vtable {
void (*ref)(grpc_resolver *resolver);
void (*unref)(grpc_resolver *resolver);
grpc_resolver *(*create_resolver)(const char *name);
};
void grpc_resolver_factory_ref(grpc_resolver *resolver);
void grpc_resolver_factory_unref(grpc_resolver *resolver);
/** Create a resolver instance for a name */
grpc_resolver *grpc_resolver_factory_create_resolver(
grpc_resolver_factory *resolver, const char *name);
#endif /* GRPC_INTERNAL_CORE_CONFIG_RESOLVER_FACTORY_H */

@ -368,8 +368,11 @@ Server::GenericAsyncRequest::GenericAsyncRequest(
bool Server::GenericAsyncRequest::FinalizeResult(void** tag, bool* status) { bool Server::GenericAsyncRequest::FinalizeResult(void** tag, bool* status) {
// TODO(yangg) remove the copy here. // TODO(yangg) remove the copy here.
static_cast<GenericServerContext*>(context_)->method_ = call_details_.method; if (*status) {
static_cast<GenericServerContext*>(context_)->host_ = call_details_.host; static_cast<GenericServerContext*>(context_)->method_ =
call_details_.method;
static_cast<GenericServerContext*>(context_)->host_ = call_details_.host;
}
gpr_free(call_details_.method); gpr_free(call_details_.method);
gpr_free(call_details_.host); gpr_free(call_details_.host);
return BaseAsyncRequest::FinalizeResult(tag, status); return BaseAsyncRequest::FinalizeResult(tag, status);

@ -46,7 +46,7 @@
// transparently on the same TCP connection. // transparently on the same TCP connection.
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <gRPC/GRXWriter.h> #import <RxLibrary/GRXWriter.h>
@class GRPCMethodName; @class GRPCMethodName;

@ -34,7 +34,7 @@
#import "GRPCCall.h" #import "GRPCCall.h"
#include <grpc/grpc.h> #include <grpc/grpc.h>
#include <grpc/support/grpc_time.h> #include <grpc/support/time.h>
#import "GRPCMethodName.h" #import "GRPCMethodName.h"
#import "private/GRPCChannel.h" #import "private/GRPCChannel.h"

@ -33,7 +33,7 @@
#import "GRPCDelegateWrapper.h" #import "GRPCDelegateWrapper.h"
#import <gRPC/GRXWriteable.h> #import <RxLibrary/GRXWriteable.h>
@interface GRPCDelegateWrapper () @interface GRPCDelegateWrapper ()
// These are atomic so that cancellation can nillify them from any thread. // These are atomic so that cancellation can nillify them from any thread.

@ -33,7 +33,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "GRPCMethodName.h" #import "GRPCClient/GRPCMethodName.h"
@interface GRPCMethodName (HTTP2Encoding) @interface GRPCMethodName (HTTP2Encoding)
- (NSString *)HTTP2Path; - (NSString *)HTTP2Path;

@ -33,7 +33,7 @@
#import "NSError+GRPC.h" #import "NSError+GRPC.h"
#include <grpc.h> #include <grpc/grpc.h>
NSString * const kGRPCErrorDomain = @"io.grpc"; NSString * const kGRPCErrorDomain = @"io.grpc";

@ -32,7 +32,7 @@
*/ */
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <gRPC/GRPCCall.h> #import <GRPCClient/GRPCCall.h>
@interface ProtoRPC : GRPCCall @interface ProtoRPC : GRPCCall

@ -33,10 +33,10 @@
#import "ProtoRPC.h" #import "ProtoRPC.h"
#import <gRPC/GRXWriteable.h>
#import <gRPC/GRXWriter.h>
#import <gRPC/GRXWriter+Transformations.h>
#import <Protobuf/GPBProtocolBuffers.h> #import <Protobuf/GPBProtocolBuffers.h>
#import <RxLibrary/GRXWriteable.h>
#import <RxLibrary/GRXWriter.h>
#import <RxLibrary/GRXWriter+Transformations.h>
@implementation ProtoRPC { @implementation ProtoRPC {
id<GRXWriteable> _responseWriteable; id<GRXWriteable> _responseWriteable;

@ -33,9 +33,9 @@
#import "ProtoService.h" #import "ProtoService.h"
#import <gRPC/GRPCMethodName.h> #import <GRPCClient/GRPCMethodName.h>
#import <gRPC/GRXWriteable.h> #import <RxLibrary/GRXWriteable.h>
#import <gRPC/GRXWriter.h> #import <RxLibrary/GRXWriter.h>
#import "ProtoRPC.h" #import "ProtoRPC.h"

@ -31,7 +31,7 @@
* *
*/ */
#import "GRXWriter.h" #import "RxLibrary/GRXWriter.h"
// A "proxy" writer that transforms all the values of its input writer by using a mapping function. // A "proxy" writer that transforms all the values of its input writer by using a mapping function.
@interface GRXMappingWriter : GRXWriter @interface GRXMappingWriter : GRXWriter

@ -33,12 +33,12 @@
#import "ViewController.h" #import "ViewController.h"
#import <gRPC/GRPCCall.h> #import <GRPCClient/GRPCCall.h>
#import <gRPC/GRPCMethodName.h> #import <GRPCClient/GRPCMethodName.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/GRXWriteable.h>
#import <RemoteTest/Messages.pbobjc.h> #import <RemoteTest/Messages.pbobjc.h>
#import <RemoteTest/Test.pbrpc.h> #import <RemoteTest/Test.pbrpc.h>
#import <RxLibrary/GRXWriter+Immediate.h>
#import <RxLibrary/GRXWriteable.h>
@implementation ViewController @implementation ViewController

@ -34,11 +34,11 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
#import <gRPC/GRPCCall.h> #import <GRPCClient/GRPCCall.h>
#import <gRPC/GRPCMethodName.h> #import <GRPCClient/GRPCMethodName.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/GRXWriteable.h>
#import <RemoteTest/Messages.pbobjc.h> #import <RemoteTest/Messages.pbobjc.h>
#import <RxLibrary/GRXWriteable.h>
#import <RxLibrary/GRXWriter+Immediate.h>
// These are a few tests similar to InteropTests, but which use the generic gRPC client (GRPCCall) // These are a few tests similar to InteropTests, but which use the generic gRPC client (GRPCCall)
// rather than a generated proto library on top of it. // rather than a generated proto library on top of it.

@ -36,13 +36,13 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
#import <gRPC/GRXWriter+Immediate.h> #import <ProtoRPC/ProtoRPC.h>
#import <gRPC/GRXBufferedPipe.h>
#import <gRPC/ProtoRPC.h>
#import <RemoteTest/Empty.pbobjc.h> #import <RemoteTest/Empty.pbobjc.h>
#import <RemoteTest/Messages.pbobjc.h> #import <RemoteTest/Messages.pbobjc.h>
#import <RemoteTest/Test.pbobjc.h> #import <RemoteTest/Test.pbobjc.h>
#import <RemoteTest/Test.pbrpc.h> #import <RemoteTest/Test.pbrpc.h>
#import <RxLibrary/GRXBufferedPipe.h>
#import <RxLibrary/GRXWriter+Immediate.h>
// Convenience constructors for the generated proto messages: // Convenience constructors for the generated proto messages:

@ -34,12 +34,12 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
#import <gRPC/GRPCCall.h> #import <GRPCClient/GRPCCall.h>
#import <gRPC/GRPCMethodName.h> #import <GRPCClient/GRPCMethodName.h>
#import <gRPC/GRXWriter+Immediate.h>
#import <gRPC/GRXWriteable.h>
#import <RouteGuide/RouteGuide.pbobjc.h> #import <RouteGuide/RouteGuide.pbobjc.h>
#import <RouteGuide/RouteGuide.pbrpc.h> #import <RouteGuide/RouteGuide.pbrpc.h>
#import <RxLibrary/GRXWriteable.h>
#import <RxLibrary/GRXWriter+Immediate.h>
// These tests require a gRPC "RouteGuide" sample server to be running locally. You can compile and // 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 // run one by following the instructions here: https://github.com/grpc/grpc-common/blob/master/cpp/cpptutorial.md#try-it-out

@ -34,9 +34,9 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import <XCTest/XCTest.h> #import <XCTest/XCTest.h>
#import <gRPC/GRXBufferedPipe.h> #import <RxLibrary/GRXBufferedPipe.h>
#import <gRPC/GRXWriter.h> #import <RxLibrary/GRXWriteable.h>
#import <gRPC/GRXWriteable.h> #import <RxLibrary/GRXWriter.h>
// A mock of a GRXSingleValueHandler block that can be queried for how many times it was called and // A mock of a GRXSingleValueHandler block that can be queried for how many times it was called and
// what were the last values passed to it. // what were the last values passed to it.

@ -29,5 +29,5 @@
# GRPC contains the General RPC module. # GRPC contains the General RPC module.
module GRPC module GRPC
VERSION = '0.9.3' VERSION = '0.9.4'
end end

@ -112,3 +112,30 @@ cc_binary(
], ],
) )
</%def> </%def>
objc_path = "src/objective-c"
rx_library_path = objc_path + "/RxLibrary"
objc_library(
name = "rx_library",
hdrs = glob([
rx_library_path + "/*.h",
rx_library_path + "/transformations/*.h",
]),
srcs = glob([
rx_library_path + "/*.m",
rx_library_path + "/transformations/*.m",
]),
includes = [objc_path],
deps = [
":rx_library_private",
],
)
objc_library(
name = "rx_library_private",
hdrs = glob([rx_library_path + "/private/*.h"]),
srcs = glob([rx_library_path + "/private/*.m"]),
visibility = ["//visibility:private"],
)

@ -38,11 +38,11 @@ bad_header_names = ('time.h', 'string.h')
def fix_header_name(name): def fix_header_name(name):
split_name = name.split('/') split_name = name.split('/')
if split_name[-1] in bad_header_names: if split_name[-1] in bad_header_names:
return '/'.join(split_name[:-1] + ['grpc_' + split_name[-1]]) split_name[-1] = 'grpc_' + split_name[-1]
else: if split_name[0] == 'include':
return name split_name = split_name[1:]
return '/'.join(split_name)
%> %>
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'gRPC' s.name = 'gRPC'
s.version = '0.6.0' s.version = '0.6.0'
@ -58,17 +58,19 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.8' s.osx.deployment_target = '10.8'
s.requires_arc = true s.requires_arc = true
objc_dir = 'src/objective-c'
# Reactive Extensions library for iOS. # Reactive Extensions library for iOS.
s.subspec 'RxLibrary' do |rs| s.subspec 'RxLibrary' do |ss|
rs.source_files = 'src/objective-c/RxLibrary/*.{h,m}', src_dir = "#{objc_dir}/RxLibrary"
'src/objective-c/RxLibrary/transformations/*.{h,m}', ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}"
'src/objective-c/RxLibrary/private/*.{h,m}' ss.private_header_files = "#{src_dir}/private/*.h"
rs.private_header_files = 'src/objective-c/RxLibrary/private/*.h' ss.header_mappings_dir = "#{objc_dir}"
end end
# Core cross-platform gRPC library, written in C. # Core cross-platform gRPC library, written in C.
s.subspec 'C-Core' do |cs| s.subspec 'C-Core' do |ss|
cs.source_files = \ ss.source_files = \
% for lib in libs: % for lib in libs:
% if lib.name in ("grpc", "gpr"): % if lib.name in ("grpc", "gpr"):
% for hdr in lib.get("headers", []): % for hdr in lib.get("headers", []):
@ -83,7 +85,7 @@ Pod::Spec.new do |s|
% endif % endif
% endfor % endfor
cs.private_header_files = \ ss.private_header_files = \
% for lib in libs: % for lib in libs:
% if lib.name in ("grpc", "gpr"): % if lib.name in ("grpc", "gpr"):
% for hdr in lib.get("headers", []): % for hdr in lib.get("headers", []):
@ -92,19 +94,11 @@ Pod::Spec.new do |s|
% endif % endif
% endfor % endfor
cs.header_mappings_dir = '.' ss.header_mappings_dir = '.'
# 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. ss.requires_arc = false
# ss.libraries = 'z'
# TODO(jcanizales): Instead of doing this, during installation move everything under ss.dependency 'OpenSSL', '~> 1.0.200'
# "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.requires_arc = false
cs.libraries = 'z'
cs.dependency 'OpenSSL', '~> 1.0.200'
end end
# This is a workaround for Cocoapods Issue #1437. # This is a workaround for Cocoapods Issue #1437.
@ -112,12 +106,15 @@ Pod::Spec.new do |s|
# It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run # It needs to be here (top-level) instead of in the C-Core subspec because Cocoapods doesn't run
# prepare_command's of subspecs. # prepare_command's of subspecs.
# #
# TODO(jcanizales): Try out Todd Reed's solution at Issue #1437. # TODO(jcanizales): Try out others' solutions at Issue #1437.
s.prepare_command = <<-CMD s.prepare_command = <<-CMD
# Move contents of include up a level to avoid manually specifying include paths
cp -r "include/grpc" "."
DIR_TIME="grpc/support" DIR_TIME="grpc/support"
BAD_TIME="$DIR_TIME/time.h" BAD_TIME="$DIR_TIME/time.h"
GOOD_TIME="$DIR_TIME/grpc_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 grep -rl "$BAD_TIME" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_TIME@$GOOD_TIME@g
if [ -f "include/$BAD_TIME" ]; if [ -f "include/$BAD_TIME" ];
then then
mv -f "include/$BAD_TIME" "include/$GOOD_TIME" mv -f "include/$BAD_TIME" "include/$GOOD_TIME"
@ -126,7 +123,7 @@ Pod::Spec.new do |s|
DIR_STRING="src/core/support" DIR_STRING="src/core/support"
BAD_STRING="$DIR_STRING/string.h" BAD_STRING="$DIR_STRING/string.h"
GOOD_STRING="$DIR_STRING/grpc_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 grep -rl "$BAD_STRING" grpc src/core src/objective-c/GRPCClient | xargs sed -i '' -e s@$BAD_STRING@$GOOD_STRING@g
if [ -f "$BAD_STRING" ]; if [ -f "$BAD_STRING" ];
then then
mv -f "$BAD_STRING" "$GOOD_STRING" mv -f "$BAD_STRING" "$GOOD_STRING"
@ -134,28 +131,27 @@ Pod::Spec.new do |s|
CMD CMD
# Objective-C wrapper around the core gRPC library. # Objective-C wrapper around the core gRPC library.
s.subspec 'GRPCClient' do |gs| s.subspec 'GRPCClient' do |ss|
gs.source_files = 'src/objective-c/GRPCClient/*.{h,m}', src_dir = "#{objc_dir}/GRPCClient"
'src/objective-c/GRPCClient/private/*.{h,m}' ss.source_files = "#{src_dir}/*.{h,m}", "#{src_dir}/**/*.{h,m}"
gs.private_header_files = 'src/objective-c/GRPCClient/private/*.h' ss.private_header_files = "#{src_dir}/private/*.h"
gs.compiler_flags = '-GCC_WARN_INHIBIT_ALL_WARNINGS', '-w' ss.header_mappings_dir = "#{objc_dir}"
gs.dependency 'gRPC/C-Core' ss.dependency 'gRPC/C-Core'
# TODO(jcanizales): Remove this when the prepare_command moves everything under "include/grpc" ss.dependency 'gRPC/RxLibrary'
# one directory up.
gs.xcconfig = { 'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Headers/Public/gRPC/include"' }
gs.dependency 'gRPC/RxLibrary'
# Certificates, to be able to establish TLS connections: # Certificates, to be able to establish TLS connections:
gs.resource_bundles = { 'gRPC' => ['etc/roots.pem'] } ss.resource_bundles = { 'gRPC' => ['etc/roots.pem'] }
end end
# RPC library for ProtocolBuffers, based on gRPC # RPC library for ProtocolBuffers, based on gRPC
s.subspec 'ProtoRPC' do |ps| s.subspec 'ProtoRPC' do |ss|
ps.source_files = 'src/objective-c/ProtoRPC/*.{h,m}' src_dir = "#{objc_dir}/ProtoRPC"
ss.source_files = "#{src_dir}/*.{h,m}"
ps.dependency 'gRPC/GRPCClient' ss.header_mappings_dir = "#{objc_dir}"
ps.dependency 'gRPC/RxLibrary'
ps.dependency 'Protobuf', '~> 3.0.0-alpha-3' ss.dependency 'gRPC/GRPCClient'
ss.dependency 'gRPC/RxLibrary'
ss.dependency 'Protobuf', '~> 3.0.0-alpha-3'
end end
end end

File diff suppressed because one or more lines are too long

@ -187,6 +187,7 @@
<ClInclude Include="..\..\src\core\client_config\client_config.h" /> <ClInclude Include="..\..\src\core\client_config\client_config.h" />
<ClInclude Include="..\..\src\core\client_config\lb_policy.h" /> <ClInclude Include="..\..\src\core\client_config\lb_policy.h" />
<ClInclude Include="..\..\src\core\client_config\resolver.h" /> <ClInclude Include="..\..\src\core\client_config\resolver.h" />
<ClInclude Include="..\..\src\core\client_config\resolver_factory.h" />
<ClInclude Include="..\..\src\core\client_config\subchannel.h" /> <ClInclude Include="..\..\src\core\client_config\subchannel.h" />
<ClInclude Include="..\..\src\core\client_config\subchannel_factory.h" /> <ClInclude Include="..\..\src\core\client_config\subchannel_factory.h" />
<ClInclude Include="..\..\src\core\compression\message_compress.h" /> <ClInclude Include="..\..\src\core\compression\message_compress.h" />
@ -335,6 +336,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\client_config\resolver.c"> <ClCompile Include="..\..\src\core\client_config\resolver.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\client_config\resolver_factory.c">
</ClCompile>
<ClCompile Include="..\..\src\core\client_config\subchannel.c"> <ClCompile Include="..\..\src\core\client_config\subchannel.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\client_config\subchannel_factory.c"> <ClCompile Include="..\..\src\core\client_config\subchannel_factory.c">

@ -109,6 +109,9 @@
<ClCompile Include="..\..\src\core\client_config\resolver.c"> <ClCompile Include="..\..\src\core\client_config\resolver.c">
<Filter>src\core\client_config</Filter> <Filter>src\core\client_config</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\client_config\resolver_factory.c">
<Filter>src\core\client_config</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\client_config\subchannel.c"> <ClCompile Include="..\..\src\core\client_config\subchannel.c">
<Filter>src\core\client_config</Filter> <Filter>src\core\client_config</Filter>
</ClCompile> </ClCompile>
@ -488,6 +491,9 @@
<ClInclude Include="..\..\src\core\client_config\resolver.h"> <ClInclude Include="..\..\src\core\client_config\resolver.h">
<Filter>src\core\client_config</Filter> <Filter>src\core\client_config</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\core\client_config\resolver_factory.h">
<Filter>src\core\client_config</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\client_config\subchannel.h"> <ClInclude Include="..\..\src\core\client_config\subchannel.h">
<Filter>src\core\client_config</Filter> <Filter>src\core\client_config</Filter>
</ClInclude> </ClInclude>

@ -169,6 +169,7 @@
<ClInclude Include="..\..\src\core\client_config\client_config.h" /> <ClInclude Include="..\..\src\core\client_config\client_config.h" />
<ClInclude Include="..\..\src\core\client_config\lb_policy.h" /> <ClInclude Include="..\..\src\core\client_config\lb_policy.h" />
<ClInclude Include="..\..\src\core\client_config\resolver.h" /> <ClInclude Include="..\..\src\core\client_config\resolver.h" />
<ClInclude Include="..\..\src\core\client_config\resolver_factory.h" />
<ClInclude Include="..\..\src\core\client_config\subchannel.h" /> <ClInclude Include="..\..\src\core\client_config\subchannel.h" />
<ClInclude Include="..\..\src\core\client_config\subchannel_factory.h" /> <ClInclude Include="..\..\src\core\client_config\subchannel_factory.h" />
<ClInclude Include="..\..\src\core\compression\message_compress.h" /> <ClInclude Include="..\..\src\core\compression\message_compress.h" />
@ -273,6 +274,8 @@
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\client_config\resolver.c"> <ClCompile Include="..\..\src\core\client_config\resolver.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\client_config\resolver_factory.c">
</ClCompile>
<ClCompile Include="..\..\src\core\client_config\subchannel.c"> <ClCompile Include="..\..\src\core\client_config\subchannel.c">
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\client_config\subchannel_factory.c"> <ClCompile Include="..\..\src\core\client_config\subchannel_factory.c">

@ -43,6 +43,9 @@
<ClCompile Include="..\..\src\core\client_config\resolver.c"> <ClCompile Include="..\..\src\core\client_config\resolver.c">
<Filter>src\core\client_config</Filter> <Filter>src\core\client_config</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\core\client_config\resolver_factory.c">
<Filter>src\core\client_config</Filter>
</ClCompile>
<ClCompile Include="..\..\src\core\client_config\subchannel.c"> <ClCompile Include="..\..\src\core\client_config\subchannel.c">
<Filter>src\core\client_config</Filter> <Filter>src\core\client_config</Filter>
</ClCompile> </ClCompile>
@ -371,6 +374,9 @@
<ClInclude Include="..\..\src\core\client_config\resolver.h"> <ClInclude Include="..\..\src\core\client_config\resolver.h">
<Filter>src\core\client_config</Filter> <Filter>src\core\client_config</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\core\client_config\resolver_factory.h">
<Filter>src\core\client_config</Filter>
</ClInclude>
<ClInclude Include="..\..\src\core\client_config\subchannel.h"> <ClInclude Include="..\..\src\core\client_config\subchannel.h">
<Filter>src\core\client_config</Filter> <Filter>src\core\client_config</Filter>
</ClInclude> </ClInclude>

Loading…
Cancel
Save