address comments
diff --git a/gRPC.podspec b/gRPC.podspec
index f329f3b..a44f207 100644
--- a/gRPC.podspec
+++ b/gRPC.podspec
@@ -77,7 +77,8 @@
'src/objective-c/GRPCClient/GRPCCallOptions.h',
'src/objective-c/GRPCClient/GRPCInterceptor.h',
'src/objective-c/GRPCClient/GRPCTransport.h',
- 'src/objective-c/GRPCClient/GRPCDispatchable.h'
+ 'src/objective-c/GRPCClient/GRPCDispatchable.h',
+ 'src/objective-c/GRPCClient/version.h'
ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h',
'src/objective-c/GRPCClient/GRPCCall.m',
@@ -92,7 +93,8 @@
'src/objective-c/GRPCClient/GRPCTransport.m',
'src/objective-c/GRPCClient/internal/*.h',
'src/objective-c/GRPCClient/private/GRPCTransport+Private.h',
- 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m'
+ 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m',
+ 'src/objective-c/GRPCClient/version.h'
ss.dependency "#{s.name}/Interface-Legacy", version
end
diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc
index 122ea3c..ed26230 100644
--- a/src/compiler/objective_c_generator.cc
+++ b/src/compiler/objective_c_generator.cc
@@ -297,7 +297,7 @@
"that have been deprecated. They do not\n"
" * recognize call options provided in the initializer. Using "
"the v2 protocol is recommended.\n"
- " */\n\n");
+ " */\n");
printer.Print(vars, "@protocol $service_class$ <NSObject>\n\n");
for (int i = 0; i < service->method_count(); i++) {
PrintMethodDeclarations(&printer, service->method(i));
diff --git a/src/objective-c/BUILD b/src/objective-c/BUILD
index 2af1d85..322c84b 100644
--- a/src/objective-c/BUILD
+++ b/src/objective-c/BUILD
@@ -28,7 +28,6 @@
name = "rx_library_headers",
hdrs = glob([
"RxLibrary/*.h",
- "RxLibrary/transformations/*.h",
]),
includes = ["."],
)
@@ -37,7 +36,6 @@
name = "rx_library",
srcs = glob([
"RxLibrary/*.m",
- "RxLibrary/transformations/*.m",
]),
includes = ["."],
deps = [
@@ -83,6 +81,7 @@
"GRPCClient/GRPCTransport.h",
"GRPCClient/GRPCDispatchable.h",
"GRPCClient/internal/GRPCCallOptions+Internal.h",
+ "GRPCClient/version.h",
],
srcs = [
"GRPCClient/GRPCCall.m",
diff --git a/src/objective-c/GRPCClient/GRPCCallLegacy.m b/src/objective-c/GRPCClient/GRPCCallLegacy.m
index b122099..d06048c 100644
--- a/src/objective-c/GRPCClient/GRPCCallLegacy.m
+++ b/src/objective-c/GRPCClient/GRPCCallLegacy.m
@@ -18,7 +18,6 @@
#import "GRPCCallLegacy.h"
-#import "GRPCCall+Cronet.h"
#import "GRPCCall+OAuth2.h"
#import "GRPCCallOptions.h"
#import "GRPCTypes.h"
@@ -588,13 +587,11 @@
// retain cycle.
_retainSelf = self;
+ // If _callOptions is nil, people must be using the deprecated v1 interface. In this case,
+ // generate the call options from the corresponding GRPCHost configs and apply other options
+ // that are not covered by GRPCHost.
if (_callOptions == nil) {
GRPCMutableCallOptions *callOptions = [[GRPCHost callOptionsForHost:_host] mutableCopy];
- // By v1 API logic, insecure channel precedes Cronet channel; Cronet channel preceeds default
- // channel. We maintain backwards compatibility here with v1 API by keep this logic.
- if (callOptions.transport == GRPCTransportTypeDefault && [GRPCCall isUsingCronet]) {
- callOptions.transport = gGRPCCoreCronetId;
- }
if (_serverName.length != 0) {
callOptions.serverAuthority = _serverName;
}
diff --git a/src/objective-c/GRPCClient/GRPCInterceptor.m b/src/objective-c/GRPCClient/GRPCInterceptor.m
index b18f755..9a41c39 100644
--- a/src/objective-c/GRPCClient/GRPCInterceptor.m
+++ b/src/objective-c/GRPCClient/GRPCInterceptor.m
@@ -174,10 +174,7 @@
/** Forward initial metadata to the previous interceptor in the chain */
- (void)forwardPreviousInterceptorWithInitialMetadata:(NSDictionary *)initialMetadata {
- if (_nextInterceptor == nil && !_shutDown) {
- [self createNextInterceptor];
- }
- if (_nextInterceptor == nil) {
+ if (_previousInterceptor == nil) {
return;
}
id<GRPCResponseHandler> copiedPreviousInterceptor = _previousInterceptor;
diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m
index e0fd4c1..cd2b431 100644
--- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m
+++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannel.m
@@ -29,10 +29,10 @@
#import "GRPCCoreFactory.h"
#import "GRPCInsecureChannelFactory.h"
#import "GRPCSecureChannelFactory.h"
-#import "version.h"
#import <GRPCClient/GRPCCall+Cronet.h>
#import <GRPCClient/GRPCCallOptions.h>
+#import <GRPCClient/version.h>
@implementation GRPCChannelConfiguration
diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m
index faabb3a..92f52e6 100644
--- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m
+++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCChannelPool.m
@@ -27,7 +27,6 @@
#import "GRPCInsecureChannelFactory.h"
#import "GRPCSecureChannelFactory.h"
#import "GRPCWrappedCall.h"
-#import "version.h"
#include <grpc/support/log.h>
diff --git a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m
index 98f4606..04f91e4 100644
--- a/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m
+++ b/src/objective-c/GRPCClient/private/GRPCCore/GRPCHost.m
@@ -31,7 +31,6 @@
#import "GRPCCompletionQueue.h"
#import "GRPCSecureChannelFactory.h"
#import "NSDictionary+GRPC.h"
-#import "version.h"
NS_ASSUME_NONNULL_BEGIN
@@ -115,6 +114,8 @@
options.hostNameOverride = _hostNameOverride;
if (_transportType == GRPCTransportTypeInsecure) {
options.transport = GRPCDefaultTransportImplList.core_insecure;
+ } else if ([GRPCCall isUsingCronet]){
+ options.transport = gGRPCCoreCronetId;
} else {
options.transport = GRPCDefaultTransportImplList.core_secure;
}
@@ -132,9 +133,15 @@
GRPCCallOptions *callOptions = nil;
@synchronized(gHostCache) {
- callOptions = [gHostCache[host] callOptions];
+ GRPCHost *hostConfig = gHostCache[host];
+ if (hostConfig == nil) {
+ hostConfig = [GRPCHost hostWithAddress:host];
+ }
+ callOptions = [hostConfig callOptions];
}
+ NSAssert(callOptions != nil, @"Unable to create call options object");
if (callOptions == nil) {
+ NSLog(@"Unable to create call options object");
callOptions = [[GRPCCallOptions alloc] init];
}
return callOptions;
diff --git a/src/objective-c/GRPCClient/private/GRPCCore/version.h b/src/objective-c/GRPCClient/private/GRPCCore/version.h
deleted file mode 100644
index 3b248db..0000000
--- a/src/objective-c/GRPCClient/private/GRPCCore/version.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// This file is autogenerated from a template file. Please make
-// modifications to
-// `templates/src/objective-c/GRPCClient/private/version.h.template`
-// instead. This file can be regenerated from the template by running
-// `tools/buildgen/generate_projects.sh`.
-
-#define GRPC_OBJC_VERSION_STRING @"1.23.0-dev"
diff --git a/src/objective-c/GRPCClient/private/version.h b/src/objective-c/GRPCClient/version.h
similarity index 96%
rename from src/objective-c/GRPCClient/private/version.h
rename to src/objective-c/GRPCClient/version.h
index fc6982c..6478118 100644
--- a/src/objective-c/GRPCClient/private/version.h
+++ b/src/objective-c/GRPCClient/version.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m
index 1c1c1dd..30d8f4c 100644
--- a/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m
+++ b/src/objective-c/tests/InteropTests/InteropTestsLocalSSL.m
@@ -57,10 +57,6 @@
return kLocalInteropServerOverhead; // bytes
}
-+ (GRPCTransportType)transportType {
- return GRPCTransportTypeDefault;
-}
-
+ (GRPCTransportId)transport {
return GRPCDefaultTransportImplList.core_secure;
}
diff --git a/src/objective-c/tests/UnitTests/APIv2Tests.m b/src/objective-c/tests/UnitTests/APIv2Tests.m
index 86d4e8b..6d99f3b 100644
--- a/src/objective-c/tests/UnitTests/APIv2Tests.m
+++ b/src/objective-c/tests/UnitTests/APIv2Tests.m
@@ -17,6 +17,7 @@
*/
#import <GRPCClient/GRPCCall.h>
+#import <GRPCClient/version.h>
#import <ProtoRPC/ProtoMethod.h>
#import <XCTest/XCTest.h>
#import "src/objective-c/tests/RemoteTestClient/Messages.pbobjc.h"
@@ -24,7 +25,6 @@
#include <grpc/grpc.h>
#include <grpc/support/port_platform.h>
-#import "../version.h"
// The server address is derived from preprocessor macro, which is
// in turn derived from environment variable of the same name.
diff --git a/src/objective-c/tests/UnitTests/GRPCClientTests.m b/src/objective-c/tests/UnitTests/GRPCClientTests.m
index 3d144c3..5dbea09 100644
--- a/src/objective-c/tests/UnitTests/GRPCClientTests.m
+++ b/src/objective-c/tests/UnitTests/GRPCClientTests.m
@@ -25,6 +25,7 @@
#import <GRPCClient/GRPCCall+Tests.h>
#import <GRPCClient/GRPCCall.h>
#import <GRPCClient/internal_testing/GRPCCall+InternalTests.h>
+#import <GRPCClient/version.h>
#import <ProtoRPC/ProtoMethod.h>
#import <RxLibrary/GRXBufferedPipe.h>
#import <RxLibrary/GRXWriteable.h>
@@ -33,8 +34,6 @@
#include <netinet/in.h>
-#import "../version.h"
-
#define TEST_TIMEOUT 16
// The server address is derived from preprocessor macro, which is
diff --git a/templates/gRPC.podspec.template b/templates/gRPC.podspec.template
index 6bea89d..a9b6dc6 100644
--- a/templates/gRPC.podspec.template
+++ b/templates/gRPC.podspec.template
@@ -79,7 +79,8 @@
'src/objective-c/GRPCClient/GRPCCallOptions.h',
'src/objective-c/GRPCClient/GRPCInterceptor.h',
'src/objective-c/GRPCClient/GRPCTransport.h',
- 'src/objective-c/GRPCClient/GRPCDispatchable.h'
+ 'src/objective-c/GRPCClient/GRPCDispatchable.h',
+ 'src/objective-c/GRPCClient/version.h'
ss.source_files = 'src/objective-c/GRPCClient/GRPCCall.h',
'src/objective-c/GRPCClient/GRPCCall.m',
@@ -94,7 +95,8 @@
'src/objective-c/GRPCClient/GRPCTransport.m',
'src/objective-c/GRPCClient/internal/*.h',
'src/objective-c/GRPCClient/private/GRPCTransport+Private.h',
- 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m'
+ 'src/objective-c/GRPCClient/private/GRPCTransport+Private.m',
+ 'src/objective-c/GRPCClient/version.h'
ss.dependency "#{s.name}/Interface-Legacy", version
end
diff --git a/templates/src/objective-c/GRPCClient/private/version.h.template b/templates/src/objective-c/GRPCClient/version.h.template
similarity index 96%
rename from templates/src/objective-c/GRPCClient/private/version.h.template
rename to templates/src/objective-c/GRPCClient/version.h.template
index 22b3bb2..5623ddd 100644
--- a/templates/src/objective-c/GRPCClient/private/version.h.template
+++ b/templates/src/objective-c/GRPCClient/version.h.template
@@ -2,7 +2,7 @@
--- |
/*
*
- * Copyright 2015 gRPC authors.
+ * Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.