aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c
diff options
context:
space:
mode:
Diffstat (limited to 'src/objective-c')
-rw-r--r--src/objective-c/!ProtoCompiler-gRPCPlugin.podspec4
-rw-r--r--src/objective-c/!ProtoCompiler.podspec3
-rw-r--r--src/objective-c/BoringSSL.podspec471
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+ChannelArg.h5
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+ChannelArg.m11
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+Tests.h6
-rw-r--r--src/objective-c/GRPCClient/GRPCCall+Tests.m3
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannel.m16
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.h5
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.m12
-rw-r--r--src/objective-c/README.md2
-rw-r--r--src/objective-c/examples/RemoteTestClient/RemoteTest.podspec2
-rw-r--r--src/objective-c/examples/RemoteTestClient/empty.proto44
-rw-r--r--src/objective-c/examples/RemoteTestClient/test.proto4
-rw-r--r--src/objective-c/examples/Sample/Podfile2
-rw-r--r--src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj13
-rw-r--r--src/objective-c/examples/Sample/Sample/Info.plist2
-rw-r--r--src/objective-c/examples/Sample/Sample/ViewController.m6
-rw-r--r--src/objective-c/examples/SwiftSample/Bridging-Header.h45
-rw-r--r--src/objective-c/examples/SwiftSample/Info.plist2
-rw-r--r--src/objective-c/examples/SwiftSample/Podfile2
-rw-r--r--src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj19
-rw-r--r--src/objective-c/examples/SwiftSample/ViewController.swift6
-rw-r--r--src/objective-c/tests/GRPCClientTests.m9
-rw-r--r--src/objective-c/tests/InteropTests.h7
-rw-r--r--src/objective-c/tests/InteropTests.m73
-rw-r--r--src/objective-c/tests/InteropTestsLocalCleartext.m8
-rw-r--r--src/objective-c/tests/InteropTestsLocalSSL.m8
-rw-r--r--src/objective-c/tests/InteropTestsRemote.m4
-rw-r--r--src/objective-c/tests/RemoteTestClient/RemoteTest.podspec2
-rw-r--r--src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme6
-rwxr-xr-xsrc/objective-c/tests/build_example_test.sh27
-rwxr-xr-xsrc/objective-c/tests/build_one_example.sh4
-rwxr-xr-xsrc/objective-c/tests/build_tests.sh26
-rwxr-xr-xsrc/objective-c/tests/run_tests.sh14
35 files changed, 439 insertions, 434 deletions
diff --git a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec
index 72cadb9319..97f4f586b7 100644
--- a/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec
+++ b/src/objective-c/!ProtoCompiler-gRPCPlugin.podspec
@@ -36,7 +36,7 @@ Pod::Spec.new do |s|
# exclamation mark ensures that other "regular" pods will be able to find it as it'll be installed
# before them.
s.name = '!ProtoCompiler-gRPCPlugin'
- v = '0.14.0'
+ v = '1.0.0-pre1'
s.version = v
s.summary = 'The gRPC ProtoC plugin generates Objective-C files from .proto services.'
s.description = <<-DESC
@@ -82,7 +82,7 @@ Pod::Spec.new do |s|
s.authors = { 'The gRPC contributors' => 'grpc-packages@google.com' }
repo = 'grpc/grpc'
- release = 'release-0_14_1'
+ release = "objective-c-v#{v}"
file = "grpc_objective_c_plugin-#{v}-macos-x86_64.zip"
s.source = {
:http => "https://github.com/#{repo}/releases/download/#{release}/#{file}",
diff --git a/src/objective-c/!ProtoCompiler.podspec b/src/objective-c/!ProtoCompiler.podspec
index 5e59b25aee..56aacc3330 100644
--- a/src/objective-c/!ProtoCompiler.podspec
+++ b/src/objective-c/!ProtoCompiler.podspec
@@ -97,10 +97,9 @@ Pod::Spec.new do |s|
s.authors = { 'The Protocol Buffers contributors' => 'protobuf@googlegroups.com' }
repo = 'google/protobuf'
- release = "v#{v}"
file = "protoc-#{v}-osx-x86_64.zip"
s.source = {
- :http => "https://github.com/#{repo}/releases/download/#{release}/#{file}",
+ :http => "https://github.com/#{repo}/releases/download/v#{v}/#{file}",
# TODO(jcanizales): Add sha1 or sha256
# :sha1 => '??',
}
diff --git a/src/objective-c/BoringSSL.podspec b/src/objective-c/BoringSSL.podspec
index 42b4434d0d..b759997c11 100644
--- a/src/objective-c/BoringSSL.podspec
+++ b/src/objective-c/BoringSSL.podspec
@@ -31,7 +31,7 @@
Pod::Spec.new do |s|
s.name = 'BoringSSL'
- version = '4.0'
+ version = '5.0'
s.version = version
s.summary = 'BoringSSL is a fork of OpenSSL that is designed to meet Google’s needs.'
# Adapted from the homepage:
@@ -67,8 +67,11 @@ Pod::Spec.new do |s|
# "The name and email addresses of the library maintainers, not the Podspec maintainer."
s.authors = 'Adam Langley', 'David Benjamin', 'Matt Braithwaite'
- s.source = { :git => 'https://boringssl.googlesource.com/boringssl',
- :tag => "version_for_cocoapods_#{version}" }
+ s.source = {
+ :git => 'https://boringssl.googlesource.com/boringssl',
+ :tag => "version_for_cocoapods_#{version}",
+ # :commit => '8d343b44bbab829d1a28fdef650ca95f7db4412e',
+ }
name = 'openssl'
@@ -219,7 +222,7 @@ Pod::Spec.new do |s|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
- /* This file was generated by err_data_generate.go. */
+ /* This file was generated by err_data_generate.go. */
#include <openssl/base.h>
#include <openssl/err.h>
@@ -385,42 +388,42 @@ Pod::Spec.new do |s|
0x28340c19,
0x283480ac,
0x283500ea,
- 0x2c322775,
- 0x2c32a783,
- 0x2c332795,
- 0x2c33a7a7,
- 0x2c3427bb,
- 0x2c34a7cd,
- 0x2c3527e8,
- 0x2c35a7fa,
- 0x2c36280d,
+ 0x2c3227cb,
+ 0x2c32a7d9,
+ 0x2c3327eb,
+ 0x2c33a7fd,
+ 0x2c342811,
+ 0x2c34a823,
+ 0x2c35283e,
+ 0x2c35a850,
+ 0x2c362863,
0x2c36832d,
- 0x2c37281a,
- 0x2c37a82c,
- 0x2c38283f,
- 0x2c38a856,
- 0x2c392864,
- 0x2c39a874,
- 0x2c3a2886,
- 0x2c3aa89a,
- 0x2c3b28ab,
- 0x2c3ba8ca,
- 0x2c3c28de,
- 0x2c3ca8f4,
- 0x2c3d290d,
- 0x2c3da92a,
- 0x2c3e293b,
- 0x2c3ea949,
- 0x2c3f2961,
- 0x2c3fa979,
- 0x2c402986,
+ 0x2c372870,
+ 0x2c37a882,
+ 0x2c382895,
+ 0x2c38a8ac,
+ 0x2c3928ba,
+ 0x2c39a8ca,
+ 0x2c3a28dc,
+ 0x2c3aa8f0,
+ 0x2c3b2901,
+ 0x2c3ba920,
+ 0x2c3c2934,
+ 0x2c3ca94a,
+ 0x2c3d2963,
+ 0x2c3da980,
+ 0x2c3e2991,
+ 0x2c3ea99f,
+ 0x2c3f29b7,
+ 0x2c3fa9cf,
+ 0x2c4029dc,
0x2c4090e7,
- 0x2c412997,
- 0x2c41a9aa,
+ 0x2c4129ed,
+ 0x2c41aa00,
0x2c4210c0,
- 0x2c42a9bb,
+ 0x2c42aa11,
0x2c430720,
- 0x2c43a8bc,
+ 0x2c43a912,
0x30320000,
0x30328015,
0x3033001f,
@@ -594,145 +597,148 @@ Pod::Spec.new do |s|
0x404619e8,
0x40469a08,
0x40471a16,
- 0x40479a2a,
- 0x40481a3f,
- 0x40489a58,
- 0x40491a6f,
- 0x40499a89,
- 0x404a1aa0,
- 0x404a9abe,
- 0x404b1ad6,
- 0x404b9aed,
- 0x404c1b03,
- 0x404c9b15,
- 0x404d1b36,
- 0x404d9b58,
- 0x404e1b6c,
- 0x404e9b79,
- 0x404f1b90,
- 0x404f9ba0,
- 0x40501bca,
- 0x40509bde,
- 0x40511bf9,
- 0x40519c09,
- 0x40521c20,
- 0x40529c32,
- 0x40531c4a,
- 0x40539c5d,
- 0x40541c72,
- 0x40549c95,
- 0x40551ca3,
- 0x40559cc0,
- 0x40561ccd,
- 0x40569ce6,
- 0x40571cfe,
- 0x40579d11,
- 0x40581d26,
- 0x40589d38,
- 0x40591d48,
- 0x40599d61,
- 0x405a1d75,
- 0x405a9d85,
- 0x405b1d9d,
- 0x405b9dae,
- 0x405c1dc1,
- 0x405c9dd2,
- 0x405d1ddf,
- 0x405d9df6,
- 0x405e1e16,
+ 0x40479a3d,
+ 0x40481a52,
+ 0x40489a6b,
+ 0x40491a82,
+ 0x40499a9c,
+ 0x404a1ab3,
+ 0x404a9ad1,
+ 0x404b1ae9,
+ 0x404b9b00,
+ 0x404c1b16,
+ 0x404c9b28,
+ 0x404d1b49,
+ 0x404d9b6b,
+ 0x404e1b7f,
+ 0x404e9b8c,
+ 0x404f1ba3,
+ 0x404f9bb3,
+ 0x40501bdd,
+ 0x40509bf1,
+ 0x40511c0c,
+ 0x40519c1c,
+ 0x40521c33,
+ 0x40529c45,
+ 0x40531c5d,
+ 0x40539c70,
+ 0x40541c85,
+ 0x40549ca8,
+ 0x40551cb6,
+ 0x40559cd3,
+ 0x40561ce0,
+ 0x40569cf9,
+ 0x40571d11,
+ 0x40579d24,
+ 0x40581d39,
+ 0x40589d4b,
+ 0x40591d7a,
+ 0x40599d93,
+ 0x405a1da7,
+ 0x405a9db7,
+ 0x405b1dcf,
+ 0x405b9de0,
+ 0x405c1df3,
+ 0x405c9e04,
+ 0x405d1e11,
+ 0x405d9e28,
+ 0x405e1e48,
0x405e8a95,
- 0x405f1e37,
- 0x405f9e44,
- 0x40601e52,
- 0x40609e74,
- 0x40611e9c,
- 0x40619eb1,
- 0x40621ec8,
- 0x40629ed9,
- 0x40631eea,
- 0x40639eff,
- 0x40641f16,
- 0x40649f27,
- 0x40651f42,
- 0x40659f59,
- 0x40661f71,
- 0x40669f9b,
- 0x40671fc6,
- 0x40679fe7,
- 0x40681ffa,
- 0x4068a01b,
- 0x4069204d,
- 0x4069a07b,
- 0x406a209c,
- 0x406aa0bc,
- 0x406b2244,
- 0x406ba267,
- 0x406c227d,
- 0x406ca4a9,
- 0x406d24d8,
- 0x406da500,
- 0x406e2519,
- 0x406ea531,
- 0x406f2550,
- 0x406fa565,
- 0x40702578,
- 0x4070a595,
+ 0x405f1e69,
+ 0x405f9e76,
+ 0x40601e84,
+ 0x40609ea6,
+ 0x40611ece,
+ 0x40619ee3,
+ 0x40621efa,
+ 0x40629f0b,
+ 0x40631f1c,
+ 0x40639f31,
+ 0x40641f48,
+ 0x40649f59,
+ 0x40651f74,
+ 0x40659f8b,
+ 0x40661fa3,
+ 0x40669fcd,
+ 0x40671ff8,
+ 0x4067a019,
+ 0x4068202c,
+ 0x4068a04d,
+ 0x4069207f,
+ 0x4069a0ad,
+ 0x406a20ce,
+ 0x406aa0ee,
+ 0x406b2276,
+ 0x406ba299,
+ 0x406c22af,
+ 0x406ca4db,
+ 0x406d250a,
+ 0x406da532,
+ 0x406e254b,
+ 0x406ea563,
+ 0x406f2582,
+ 0x406fa597,
+ 0x407025aa,
+ 0x4070a5c7,
0x40710800,
- 0x4071a5a7,
- 0x407225ba,
- 0x4072a5d3,
- 0x407325eb,
+ 0x4071a5d9,
+ 0x407225ec,
+ 0x4072a605,
+ 0x4073261d,
0x4073936d,
- 0x407425ff,
- 0x4074a619,
- 0x4075262a,
- 0x4075a63e,
- 0x4076264c,
+ 0x40742631,
+ 0x4074a64b,
+ 0x4075265c,
+ 0x4075a670,
+ 0x4076267e,
0x407691aa,
- 0x40772671,
- 0x4077a693,
- 0x407826ae,
- 0x4078a6c3,
- 0x407926da,
- 0x4079a6f0,
- 0x407a26fc,
- 0x407aa70f,
- 0x407b2724,
- 0x407ba736,
- 0x407c274b,
- 0x407ca754,
- 0x407d2036,
- 0x407d9bb0,
- 0x41f4216f,
- 0x41f92201,
- 0x41fe20f4,
- 0x41fea2d0,
- 0x41ff23c1,
- 0x42032188,
- 0x420821aa,
- 0x4208a1e6,
- 0x420920d8,
- 0x4209a220,
- 0x420a212f,
- 0x420aa10f,
- 0x420b214f,
- 0x420ba1c8,
- 0x420c23dd,
- 0x420ca29d,
- 0x420d22b7,
- 0x420da2ee,
- 0x42122308,
- 0x421723a4,
- 0x4217a34a,
- 0x421c236c,
- 0x421f2327,
- 0x422123f4,
- 0x42262387,
- 0x422b248d,
- 0x422ba456,
- 0x422c2475,
- 0x422ca430,
- 0x422d240f,
+ 0x407726a3,
+ 0x4077a6c5,
+ 0x407826e0,
+ 0x4078a719,
+ 0x40792730,
+ 0x4079a746,
+ 0x407a2752,
+ 0x407aa765,
+ 0x407b277a,
+ 0x407ba78c,
+ 0x407c27a1,
+ 0x407ca7aa,
+ 0x407d2068,
+ 0x407d9bc3,
+ 0x407e26f5,
+ 0x407e9d5b,
+ 0x407f1a2a,
+ 0x41f421a1,
+ 0x41f92233,
+ 0x41fe2126,
+ 0x41fea302,
+ 0x41ff23f3,
+ 0x420321ba,
+ 0x420821dc,
+ 0x4208a218,
+ 0x4209210a,
+ 0x4209a252,
+ 0x420a2161,
+ 0x420aa141,
+ 0x420b2181,
+ 0x420ba1fa,
+ 0x420c240f,
+ 0x420ca2cf,
+ 0x420d22e9,
+ 0x420da320,
+ 0x4212233a,
+ 0x421723d6,
+ 0x4217a37c,
+ 0x421c239e,
+ 0x421f2359,
+ 0x42212426,
+ 0x422623b9,
+ 0x422b24bf,
+ 0x422ba488,
+ 0x422c24a7,
+ 0x422ca462,
+ 0x422d2441,
0x4432072b,
0x4432873a,
0x44330746,
@@ -775,69 +781,69 @@ Pod::Spec.new do |s|
0x4c3d136d,
0x4c3d937c,
0x4c3e1389,
- 0x503229cd,
- 0x5032a9dc,
- 0x503329e7,
- 0x5033a9f7,
- 0x50342a10,
- 0x5034aa2a,
- 0x50352a38,
- 0x5035aa4e,
- 0x50362a60,
- 0x5036aa76,
- 0x50372a8f,
- 0x5037aaa2,
- 0x50382aba,
- 0x5038aacb,
- 0x50392ae0,
- 0x5039aaf4,
- 0x503a2b14,
- 0x503aab2a,
- 0x503b2b42,
- 0x503bab54,
- 0x503c2b70,
- 0x503cab87,
- 0x503d2ba0,
- 0x503dabb6,
- 0x503e2bc3,
- 0x503eabd9,
- 0x503f2beb,
+ 0x50322a23,
+ 0x5032aa32,
+ 0x50332a3d,
+ 0x5033aa4d,
+ 0x50342a66,
+ 0x5034aa80,
+ 0x50352a8e,
+ 0x5035aaa4,
+ 0x50362ab6,
+ 0x5036aacc,
+ 0x50372ae5,
+ 0x5037aaf8,
+ 0x50382b10,
+ 0x5038ab21,
+ 0x50392b36,
+ 0x5039ab4a,
+ 0x503a2b6a,
+ 0x503aab80,
+ 0x503b2b98,
+ 0x503babaa,
+ 0x503c2bc6,
+ 0x503cabdd,
+ 0x503d2bf6,
+ 0x503dac0c,
+ 0x503e2c19,
+ 0x503eac2f,
+ 0x503f2c41,
0x503f8382,
- 0x50402bfe,
- 0x5040ac0e,
- 0x50412c28,
- 0x5041ac37,
- 0x50422c51,
- 0x5042ac6e,
- 0x50432c7e,
- 0x5043ac8e,
- 0x50442c9d,
+ 0x50402c54,
+ 0x5040ac64,
+ 0x50412c7e,
+ 0x5041ac8d,
+ 0x50422ca7,
+ 0x5042acc4,
+ 0x50432cd4,
+ 0x5043ace4,
+ 0x50442cf3,
0x5044843f,
- 0x50452cb1,
- 0x5045accf,
- 0x50462ce2,
- 0x5046acf8,
- 0x50472d0a,
- 0x5047ad1f,
- 0x50482d45,
- 0x5048ad53,
- 0x50492d66,
- 0x5049ad7b,
- 0x504a2d91,
- 0x504aada1,
- 0x504b2dc1,
- 0x504badd4,
- 0x504c2df7,
- 0x504cae25,
- 0x504d2e37,
- 0x504dae54,
- 0x504e2e6f,
- 0x504eae8b,
- 0x504f2e9d,
- 0x504faeb4,
- 0x50502ec3,
+ 0x50452d07,
+ 0x5045ad25,
+ 0x50462d38,
+ 0x5046ad4e,
+ 0x50472d60,
+ 0x5047ad75,
+ 0x50482d9b,
+ 0x5048ada9,
+ 0x50492dbc,
+ 0x5049add1,
+ 0x504a2de7,
+ 0x504aadf7,
+ 0x504b2e17,
+ 0x504bae2a,
+ 0x504c2e4d,
+ 0x504cae7b,
+ 0x504d2e8d,
+ 0x504daeaa,
+ 0x504e2ec5,
+ 0x504eaee1,
+ 0x504f2ef3,
+ 0x504faf0a,
+ 0x50502f19,
0x505086ef,
- 0x50512ed6,
+ 0x50512f2c,
0x58320ec9,
0x68320e8b,
0x68328c25,
@@ -1218,6 +1224,7 @@ Pod::Spec.new do |s|
"DH_PUBLIC_VALUE_LENGTH_IS_WRONG\\0"
"DH_P_TOO_LONG\\0"
"DIGEST_CHECK_FAILED\\0"
+ "DOWNGRADE_DETECTED\\0"
"DTLS_MESSAGE_TOO_BIG\\0"
"ECC_CERT_NOT_FOR_SIGNING\\0"
"EMS_STATE_INCONSISTENT\\0"
@@ -1254,6 +1261,7 @@ Pod::Spec.new do |s|
"NO_CIPHERS_AVAILABLE\\0"
"NO_CIPHERS_PASSED\\0"
"NO_CIPHER_MATCH\\0"
+ "NO_COMMON_SIGNATURE_ALGORITHMS\\0"
"NO_COMPRESSION_SPECIFIED\\0"
"NO_METHOD_SPECIFIED\\0"
"NO_P256_SUPPORT\\0"
@@ -1344,6 +1352,7 @@ Pod::Spec.new do |s|
"UNSUPPORTED_COMPRESSION_ALGORITHM\\0"
"UNSUPPORTED_ELLIPTIC_CURVE\\0"
"UNSUPPORTED_PROTOCOL\\0"
+ "UNSUPPORTED_PROTOCOL_FOR_CUSTOM_KEY\\0"
"WRONG_CERTIFICATE_TYPE\\0"
"WRONG_CIPHER_RETURNED\\0"
"WRONG_CURVE\\0"
diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
index 646bf43b54..4a3f3fa4a1 100644
--- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
+++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.h
@@ -43,7 +43,10 @@
* Use the provided @c userAgentPrefix at the beginning of the HTTP User Agent string for all calls
* to the specified @c host.
*/
-+ (void)setUserAgentPrefix:(NSString *)userAgentPrefix forHost:(NSString *)host;
++ (void)setUserAgentPrefix:(nonnull NSString *)userAgentPrefix forHost:(nonnull NSString *)host;
+
+/** The default response size limit is 4MB. Set this to override that default. */
++ (void)setResponseSizeLimit:(NSUInteger)limit forHost:(nonnull NSString *)host;
+ (void)closeOpenConnections DEPRECATED_MSG_ATTRIBUTE("The API for this feature is experimental, "
"and might be removed or modified at any "
diff --git a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
index bcc3b91507..7fab357e93 100644
--- a/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
+++ b/src/objective-c/GRPCClient/GRPCCall+ChannelArg.m
@@ -37,15 +37,16 @@
@implementation GRPCCall (ChannelArg)
-+ (void)setUserAgentPrefix:(NSString *)userAgentPrefix forHost:(NSString *)host {
- if (!host) {
- [NSException raise:NSInvalidArgumentException
- format:@"host and userAgentPrefix must be provided."];
- }
++ (void)setUserAgentPrefix:(nonnull NSString *)userAgentPrefix forHost:(nonnull NSString *)host {
GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
hostConfig.userAgentPrefix = userAgentPrefix;
}
++ (void)setResponseSizeLimit:(NSUInteger)limit forHost:(nonnull NSString *)host {
+ GRPCHost *hostConfig = [GRPCHost hostWithAddress:host];
+ hostConfig.responseSizeLimitOverride = @(limit);
+}
+
+ (void)closeOpenConnections {
[GRPCHost flushChannelCache];
}
diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.h b/src/objective-c/GRPCClient/GRPCCall+Tests.h
index ccc5723ec7..184ad09c5c 100644
--- a/src/objective-c/GRPCClient/GRPCCall+Tests.h
+++ b/src/objective-c/GRPCClient/GRPCCall+Tests.h
@@ -57,4 +57,10 @@
* more than one invocation of the methods of this category.
*/
+ (void)useInsecureConnectionsForHost:(NSString *)host;
+
+/**
+ * Resets all host configurations to their default values, and flushes all connections from the
+ * cache.
+ */
++ (void)resetHostSettings;
@end
diff --git a/src/objective-c/GRPCClient/GRPCCall+Tests.m b/src/objective-c/GRPCClient/GRPCCall+Tests.m
index b9456691bd..656cba8fec 100644
--- a/src/objective-c/GRPCClient/GRPCCall+Tests.m
+++ b/src/objective-c/GRPCClient/GRPCCall+Tests.m
@@ -61,4 +61,7 @@
hostConfig.secure = NO;
}
++ (void)resetHostSettings {
+ [GRPCHost resetAllHostSettings];
+}
@end
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m
index 7b7b79e1c6..e49aceefe1 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannel.m
+++ b/src/objective-c/GRPCClient/private/GRPCChannel.m
@@ -47,7 +47,7 @@
#endif
#import "GRPCCompletionQueue.h"
-void freeChannelArgs(grpc_channel_args *channel_args) {
+static void FreeChannelArgs(grpc_channel_args *channel_args) {
for (size_t i = 0; i < channel_args->num_args; ++i) {
grpc_arg *arg = &channel_args->args[i];
gpr_free(arg->key);
@@ -65,7 +65,7 @@ void freeChannelArgs(grpc_channel_args *channel_args) {
* value responds to @c @selector(intValue). Otherwise, an exception will be raised. The caller of
* this function is responsible for calling @c freeChannelArgs on a non-NULL returned value.
*/
-grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
+static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) {
if (!dictionary) {
return NULL;
}
@@ -115,10 +115,12 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
}
if (self = [super init]) {
- _channelArgs = buildChannelArgs(channelArgs);
+ _channelArgs = BuildChannelArgs(channelArgs);
_host = [host copy];
- _unmanagedChannel = grpc_cronet_secure_channel_create(cronetEngine, _host.UTF8String, _channelArgs,
- NULL);
+ _unmanagedChannel = grpc_cronet_secure_channel_create(cronetEngine,
+ _host.UTF8String,
+ _channelArgs,
+ NULL);
}
return self;
@@ -138,7 +140,7 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
}
if (self = [super init]) {
- _channelArgs = buildChannelArgs(channelArgs);
+ _channelArgs = BuildChannelArgs(channelArgs);
_host = [host copy];
if (secure) {
_unmanagedChannel = grpc_secure_channel_create(credentials, _host.UTF8String, _channelArgs,
@@ -155,7 +157,7 @@ grpc_channel_args * buildChannelArgs(NSDictionary *dictionary) {
// TODO(jcanizales): Be sure to add a test with a server that closes the connection prematurely,
// as in the past that made this call to crash.
grpc_channel_destroy(_unmanagedChannel);
- freeChannelArgs(_channelArgs);
+ FreeChannelArgs(_channelArgs);
}
#ifdef GRPC_COMPILE_WITH_CRONET
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h
index 350c69bf8e..c8b5dd315b 100644
--- a/src/objective-c/GRPCClient/private/GRPCHost.h
+++ b/src/objective-c/GRPCClient/private/GRPCHost.h
@@ -42,6 +42,7 @@ struct grpc_channel_credentials;
@interface GRPCHost : NSObject
+ (void)flushChannelCache;
++ (void)resetAllHostSettings;
@property(nonatomic, readonly) NSString *address;
@property(nonatomic, copy, nullable) NSString *userAgentPrefix;
@@ -53,6 +54,10 @@ struct grpc_channel_credentials;
@property(nonatomic, copy, nullable) NSString *hostNameOverride;
+/** The default response size limit is 4MB. Set this to override that default. */
+@property(nonatomic, strong, nullable) NSNumber *responseSizeLimitOverride;
+
+
- (nullable instancetype)init NS_UNAVAILABLE;
/** Host objects initialized with the same address are the same. */
+ (nullable instancetype)hostWithAddress:(NSString *)address;
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m
index 08c699f99e..477ddf51d9 100644
--- a/src/objective-c/GRPCClient/private/GRPCHost.m
+++ b/src/objective-c/GRPCClient/private/GRPCHost.m
@@ -49,7 +49,7 @@ NS_ASSUME_NONNULL_BEGIN
// TODO(jcanizales): Generate the version in a standalone header, from templates. Like
// templates/src/core/surface/version.c.template .
-#define GRPC_OBJC_VERSION_STRING @"0.13.0"
+#define GRPC_OBJC_VERSION_STRING @"1.0.0-pre1"
static NSMutableDictionary *kHostCache;
@@ -113,6 +113,12 @@ static NSMutableDictionary *kHostCache;
}
}
++ (void)resetAllHostSettings {
+ @synchronized (kHostCache) {
+ kHostCache = [NSMutableDictionary dictionary];
+ }
+}
+
- (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path
completionQueue:(GRPCCompletionQueue *)queue {
GRPCChannel *channel;
@@ -209,6 +215,10 @@ static NSMutableDictionary *kHostCache;
if (_secure && _hostNameOverride) {
args[@GRPC_SSL_TARGET_NAME_OVERRIDE_ARG] = _hostNameOverride;
}
+
+ if (_responseSizeLimitOverride) {
+ args[@GRPC_ARG_MAX_MESSAGE_LENGTH] = _responseSizeLimitOverride;
+ }
return args;
}
diff --git a/src/objective-c/README.md b/src/objective-c/README.md
index ee20cc295d..7e031e1783 100644
--- a/src/objective-c/README.md
+++ b/src/objective-c/README.md
@@ -48,7 +48,7 @@ Pod::Spec.new do |s|
src = '.'
# We'll use protoc with the gRPC plugin.
- s.dependency '!ProtoCompiler-gRPCPlugin', '~> 0.14'
+ s.dependency '!ProtoCompiler-gRPCPlugin', '~> 1.0.0-pre1'
# Pods directory corresponding to this app's Podfile, relative to the location of this podspec.
pods_root = '<path to your Podfile>/Pods'
diff --git a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec
index c4578047b6..f2db1a5d5d 100644
--- a/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec
+++ b/src/objective-c/examples/RemoteTestClient/RemoteTest.podspec
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
- s.dependency "!ProtoCompiler-gRPCPlugin", "~> 0.14"
+ s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0.0-pre1"
repo_root = '../../../..'
bin_dir = "#{repo_root}/bins/$CONFIG"
diff --git a/src/objective-c/examples/RemoteTestClient/empty.proto b/src/objective-c/examples/RemoteTestClient/empty.proto
deleted file mode 100644
index a678048289..0000000000
--- a/src/objective-c/examples/RemoteTestClient/empty.proto
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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.
-
-syntax = "proto3";
-
-package grpc.testing;
-
-option objc_class_prefix = "RMT";
-
-// 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) { };
-// };
-//
-message Empty {}
diff --git a/src/objective-c/examples/RemoteTestClient/test.proto b/src/objective-c/examples/RemoteTestClient/test.proto
index 514c3b8095..5c359c5c12 100644
--- a/src/objective-c/examples/RemoteTestClient/test.proto
+++ b/src/objective-c/examples/RemoteTestClient/test.proto
@@ -31,7 +31,7 @@
// of unary/streaming requests/responses.
syntax = "proto3";
-import "empty.proto";
+import "google/protobuf/empty.proto";
import "messages.proto";
package grpc.testing;
@@ -42,7 +42,7 @@ option objc_class_prefix = "RMT";
// performance with various types of payload.
service TestService {
// One empty request followed by one empty response.
- rpc EmptyCall(grpc.testing.Empty) returns (grpc.testing.Empty);
+ rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty);
// One request followed by one response.
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
diff --git a/src/objective-c/examples/Sample/Podfile b/src/objective-c/examples/Sample/Podfile
index 8740b2f963..f6f0c00d5d 100644
--- a/src/objective-c/examples/Sample/Podfile
+++ b/src/objective-c/examples/Sample/Podfile
@@ -3,6 +3,8 @@ platform :ios, '8.0'
install! 'cocoapods', :deterministic_uuids => false
+use_frameworks! if ENV['FRAMEWORKS'] == 'YES'
+
# Location of gRPC's repo root relative to this file.
GRPC_LOCAL_SRC = '../../../..'
diff --git a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj
index 5c2a6d14f9..ab7159cda2 100644
--- a/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj
+++ b/src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj
@@ -7,7 +7,7 @@
objects = {
/* Begin PBXBuildFile section */
- 426A5020E0E158A101BCA1D9 /* libPods-Sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C20055928615A6F8434E26B4 /* libPods-Sample.a */; };
+ 3F035697392F601049D3DDE1 /* Pods_Sample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */; };
6369A2701A9322E20015FC5C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A26F1A9322E20015FC5C /* main.m */; };
6369A2731A9322E20015FC5C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2721A9322E20015FC5C /* AppDelegate.m */; };
6369A2761A9322E20015FC5C /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6369A2751A9322E20015FC5C /* ViewController.m */; };
@@ -26,7 +26,7 @@
6369A2751A9322E20015FC5C /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
6369A2781A9322E20015FC5C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
6369A27A1A9322E20015FC5C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
- C20055928615A6F8434E26B4 /* libPods-Sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Sample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
+ CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Sample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
E3C01DF315C4E7433BCEC6E6 /* Pods-Sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Sample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Sample/Pods-Sample.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -35,7 +35,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 426A5020E0E158A101BCA1D9 /* libPods-Sample.a in Frameworks */,
+ 3F035697392F601049D3DDE1 /* Pods_Sample.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -95,7 +95,7 @@
C4C2C5219053E079C9EFB930 /* Frameworks */ = {
isa = PBXGroup;
children = (
- C20055928615A6F8434E26B4 /* libPods-Sample.a */,
+ CC1B27EA0C428429B07BC34B /* Pods_Sample.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -129,7 +129,7 @@
6369A2621A9322E20015FC5C /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0610;
+ LastUpgradeCheck = 0730;
ORGANIZATIONNAME = gRPC;
TargetAttributes = {
6369A2691A9322E20015FC5C = {
@@ -260,6 +260,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -325,6 +326,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = Sample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
@@ -336,6 +338,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = Sample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
diff --git a/src/objective-c/examples/Sample/Sample/Info.plist b/src/objective-c/examples/Sample/Sample/Info.plist
index 4436635ab4..2cdf09dc2f 100644
--- a/src/objective-c/examples/Sample/Sample/Info.plist
+++ b/src/objective-c/examples/Sample/Sample/Info.plist
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
- <string>org.grpc.$(PRODUCT_NAME:rfc1034identifier)</string>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m
index 433a8a2ba3..70244ee62d 100644
--- a/src/objective-c/examples/Sample/Sample/ViewController.m
+++ b/src/objective-c/examples/Sample/Sample/ViewController.m
@@ -66,9 +66,9 @@
// Same example call using the generic gRPC client library:
- ProtoMethod *method = [[ProtoMethod alloc] initWithPackage:@"grpc.testing"
- service:@"TestService"
- method:@"UnaryCall"];
+ GRPCProtoMethod *method = [[GRPCProtoMethod alloc] initWithPackage:@"grpc.testing"
+ service:@"TestService"
+ method:@"UnaryCall"];
GRXWriter *requestsWriter = [GRXWriter writerWithValue:[request data]];
diff --git a/src/objective-c/examples/SwiftSample/Bridging-Header.h b/src/objective-c/examples/SwiftSample/Bridging-Header.h
deleted file mode 100644
index 65f768a760..0000000000
--- a/src/objective-c/examples/SwiftSample/Bridging-Header.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- *
- * 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 SwiftSample_Bridging_Header_h
-#define SwiftSample_Bridging_Header_h
-
-#import <RxLibrary/GRXWriteable.h>
-#import <RxLibrary/GRXWriter.h>
-#import <RxLibrary/GRXWriter+Immediate.h>
-#import <GRPCClient/GRPCCall.h>
-#import <ProtoRPC/ProtoMethod.h>
-#import <ProtoRPC/ProtoRPC.h>
-#import <RemoteTest/Test.pbrpc.h>
-
-#endif
diff --git a/src/objective-c/examples/SwiftSample/Info.plist b/src/objective-c/examples/SwiftSample/Info.plist
index 10f0450b34..2cdf09dc2f 100644
--- a/src/objective-c/examples/SwiftSample/Info.plist
+++ b/src/objective-c/examples/SwiftSample/Info.plist
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
- <string>io.grpc.$(PRODUCT_NAME:rfc1034identifier)</string>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
diff --git a/src/objective-c/examples/SwiftSample/Podfile b/src/objective-c/examples/SwiftSample/Podfile
index 2f783340f5..b08a346ae2 100644
--- a/src/objective-c/examples/SwiftSample/Podfile
+++ b/src/objective-c/examples/SwiftSample/Podfile
@@ -3,6 +3,8 @@ platform :ios, '8.0'
install! 'cocoapods', :deterministic_uuids => false
+use_frameworks!
+
# Location of gRPC's repo root relative to this file.
GRPC_LOCAL_SRC = '../../../..'
diff --git a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj
index 2a1b30f2cf..afc3da7116 100644
--- a/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj
+++ b/src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj
@@ -7,11 +7,11 @@
objects = {
/* Begin PBXBuildFile section */
+ 2C0B024CB798839E17F76126 /* Pods_SwiftSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */; };
633BFFC81B950B210007E424 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633BFFC71B950B210007E424 /* AppDelegate.swift */; };
633BFFCA1B950B210007E424 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 633BFFC91B950B210007E424 /* ViewController.swift */; };
633BFFCD1B950B210007E424 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 633BFFCB1B950B210007E424 /* Main.storyboard */; };
633BFFCF1B950B210007E424 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 633BFFCE1B950B210007E424 /* Images.xcassets */; };
- 92EDB1408A1E1E7DDAB25D9C /* libPods-SwiftSample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 69BB5C6CA3C1F97E007AC527 /* libPods-SwiftSample.a */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -21,9 +21,8 @@
633BFFC91B950B210007E424 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
633BFFCC1B950B210007E424 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
633BFFCE1B950B210007E424 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
- 6367AD231B951655007FD3A4 /* Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
- 69BB5C6CA3C1F97E007AC527 /* libPods-SwiftSample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SwiftSample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
A7E614A494D89D01BB395761 /* Pods-SwiftSample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample.debug.xcconfig"; sourceTree = "<group>"; };
+ B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftSample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C314E3E246AF23AC29B38FCF /* Pods-SwiftSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftSample.release.xcconfig"; path = "Pods/Target Support Files/Pods-SwiftSample/Pods-SwiftSample.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -32,7 +31,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 92EDB1408A1E1E7DDAB25D9C /* libPods-SwiftSample.a in Frameworks */,
+ 2C0B024CB798839E17F76126 /* Pods_SwiftSample.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -74,7 +73,6 @@
633BFFCB1B950B210007E424 /* Main.storyboard */,
633BFFCE1B950B210007E424 /* Images.xcassets */,
633BFFC51B950B210007E424 /* Supporting Files */,
- 6367AD231B951655007FD3A4 /* Bridging-Header.h */,
);
name = SwiftSample;
sourceTree = SOURCE_ROOT;
@@ -90,7 +88,7 @@
9D63A7F6423989BA306810CA /* Frameworks */ = {
isa = PBXGroup;
children = (
- 69BB5C6CA3C1F97E007AC527 /* libPods-SwiftSample.a */,
+ B394F343BDE186C5436DBDB9 /* Pods_SwiftSample.framework */,
);
name = Frameworks;
sourceTree = "<group>";
@@ -125,7 +123,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
- LastUpgradeCheck = 0640;
+ LastUpgradeCheck = 0730;
ORGANIZATIONNAME = gRPC;
TargetAttributes = {
633BFFC11B950B210007E424 = {
@@ -256,6 +254,7 @@
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@@ -325,8 +324,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h";
+ SWIFT_OBJC_BRIDGING_HEADER = "";
USER_HEADER_SEARCH_PATHS = "";
};
name = Debug;
@@ -338,8 +338,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
- SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h";
+ SWIFT_OBJC_BRIDGING_HEADER = "";
USER_HEADER_SEARCH_PATHS = "";
};
name = Release;
diff --git a/src/objective-c/examples/SwiftSample/ViewController.swift b/src/objective-c/examples/SwiftSample/ViewController.swift
index 2a95d2de51..e7bab13762 100644
--- a/src/objective-c/examples/SwiftSample/ViewController.swift
+++ b/src/objective-c/examples/SwiftSample/ViewController.swift
@@ -33,6 +33,8 @@
import UIKit
+import RemoteTest
+
class ViewController: UIViewController {
override func viewDidLoad() {
@@ -60,7 +62,7 @@ class ViewController: UIViewController {
// Same but manipulating headers:
- var RPC : ProtoRPC! // Needed to convince Swift to capture by reference (__block)
+ var RPC : GRPCProtoCall! // Needed to convince Swift to capture by reference (__block)
RPC = service.RPCToUnaryCallWithRequest(request) { response, error in
if let response = response {
NSLog("2. Finished successfully with response:\n\(response)")
@@ -79,7 +81,7 @@ class ViewController: UIViewController {
// Same example call using the generic gRPC client library:
- let method = ProtoMethod(package: "grpc.testing", service: "TestService", method: "UnaryCall")
+ let method = GRPCProtoMethod(package: "grpc.testing", service: "TestService", method: "UnaryCall")
let requestsWriter = GRXWriter(value: request.data())
diff --git a/src/objective-c/tests/GRPCClientTests.m b/src/objective-c/tests/GRPCClientTests.m
index 1167a715bb..916a335802 100644
--- a/src/objective-c/tests/GRPCClientTests.m
+++ b/src/objective-c/tests/GRPCClientTests.m
@@ -292,15 +292,6 @@ static GRPCProtoMethod *kUnaryCallMethod;
// TODO(makarandd): Move to a different file that contains only unit tests
- (void)testExceptions {
- // Try to set userAgentPrefix for host that is nil. This should cause
- // an exception.
- @try {
- [GRPCCall setUserAgentPrefix:@"Foo" forHost:nil];
- XCTFail(@"Did not receive an exception when host is nil");
- } @catch(NSException *theException) {
- NSLog(@"Received exception as expected: %@", theException.name);
- }
-
// Try to set parameters to nil for GRPCCall. This should cause an exception
@try {
(void)[[GRPCCall alloc] initWithHost:nil
diff --git a/src/objective-c/tests/InteropTests.h b/src/objective-c/tests/InteropTests.h
index 6d54343b13..ecab606a78 100644
--- a/src/objective-c/tests/InteropTests.h
+++ b/src/objective-c/tests/InteropTests.h
@@ -46,4 +46,11 @@
* Override in a subclass to perform these tests against a specific address.
*/
+ (NSString *)host;
+
+/**
+ * Bytes of overhead of test proto responses due to encoding. This is used to excercise the behavior
+ * when responses are just above or below the max response size. For some reason, the local and
+ * remote servers enconde responses with different overhead (?), so this is defined per-subclass.
+ */
+- (int32_t)encodingOverhead;
@end
diff --git a/src/objective-c/tests/InteropTests.m b/src/objective-c/tests/InteropTests.m
index 494743d604..f04a7e6441 100644
--- a/src/objective-c/tests/InteropTests.m
+++ b/src/objective-c/tests/InteropTests.m
@@ -80,10 +80,6 @@
#pragma mark Tests
-#ifdef GRPC_COMPILE_WITH_CRONET
-static cronet_engine *cronetEngine = NULL;
-#endif
-
@implementation InteropTests {
RMTTestService *_service;
}
@@ -92,15 +88,22 @@ static cronet_engine *cronetEngine = NULL;
return nil;
}
+- (int32_t)encodingOverhead {
+ return 0;
+}
+
- (void)setUp {
+ self.continueAfterFailure = NO;
+
+ [GRPCCall resetHostSettings];
+
_service = self.class.host ? [RMTTestService serviceWithHost:self.class.host] : nil;
#ifdef GRPC_COMPILE_WITH_CRONET
if (cronetEngine == NULL) {
// Cronet setup
[Cronet setHttp2Enabled:YES];
[Cronet start];
- cronetEngine = [Cronet getGlobalEngine];
- [GRPCCall useCronetWithEngine:cronetEngine];
+ [GRPCCall useCronetWithEngine:[Cronet getGlobalEngine]];
}
#endif
}
@@ -146,6 +149,64 @@ static cronet_engine *cronetEngine = NULL;
[self waitForExpectationsWithTimeout:16 handler:nil];
}
+- (void)test4MBResponsesAreAccepted {
+ XCTAssertNotNil(self.class.host);
+ __weak XCTestExpectation *expectation = [self expectationWithDescription:@"MaxResponseSize"];
+
+ RMTSimpleRequest *request = [RMTSimpleRequest message];
+ const int32_t kPayloadSize = 4 * 1024 * 1024 - self.encodingOverhead; // 4MB - encoding overhead
+ request.responseSize = kPayloadSize;
+
+ [_service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) {
+ XCTAssertNil(error, @"Finished with unexpected error: %@", error);
+ XCTAssertEqual(response.payload.body.length, kPayloadSize);
+ [expectation fulfill];
+ }];
+
+ [self waitForExpectationsWithTimeout:16 handler:nil];
+}
+
+- (void)testResponsesOverMaxSizeFailWithActionableMessage {
+ XCTAssertNotNil(self.class.host);
+ __weak XCTestExpectation *expectation = [self expectationWithDescription:@"ResponseOverMaxSize"];
+
+ RMTSimpleRequest *request = [RMTSimpleRequest message];
+ const int32_t kPayloadSize = 4 * 1024 * 1024 - self.encodingOverhead + 1; // 1B over max size
+ request.responseSize = kPayloadSize;
+
+ [_service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) {
+ // TODO(jcanizales): Catch the error and rethrow it with an actionable message:
+ // - Use +[GRPCCall setResponseSizeLimit:forHost:] to set a higher limit.
+ // - If you're developing the server, consider using response streaming, or let clients filter
+ // responses by setting a google.protobuf.FieldMask in the request:
+ // https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto
+ XCTAssertEqualObjects(error.localizedDescription, @"Max message size exceeded");
+ [expectation fulfill];
+ }];
+
+ [self waitForExpectationsWithTimeout:16 handler:nil];
+}
+
+- (void)testResponsesOver4MBAreAcceptedIfOptedIn {
+ XCTAssertNotNil(self.class.host);
+ __weak XCTestExpectation *expectation =
+ [self expectationWithDescription:@"HigherResponseSizeLimit"];
+
+ RMTSimpleRequest *request = [RMTSimpleRequest message];
+ const size_t kPayloadSize = 5 * 1024 * 1024; // 5MB
+ request.responseSize = kPayloadSize;
+
+ [GRPCCall setResponseSizeLimit:6 * 1024 * 1024 forHost:self.class.host];
+
+ [_service unaryCallWithRequest:request handler:^(RMTSimpleResponse *response, NSError *error) {
+ XCTAssertNil(error, @"Finished with unexpected error: %@", error);
+ XCTAssertEqual(response.payload.body.length, kPayloadSize);
+ [expectation fulfill];
+ }];
+
+ [self waitForExpectationsWithTimeout:16 handler:nil];
+}
+
- (void)testClientStreamingRPC {
XCTAssertNotNil(self.class.host);
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"ClientStreaming"];
diff --git a/src/objective-c/tests/InteropTestsLocalCleartext.m b/src/objective-c/tests/InteropTestsLocalCleartext.m
index 56927a8af6..b41210f50f 100644
--- a/src/objective-c/tests/InteropTestsLocalCleartext.m
+++ b/src/objective-c/tests/InteropTestsLocalCleartext.m
@@ -47,11 +47,15 @@ static NSString * const kLocalCleartextHost = @"localhost:5050";
return kLocalCleartextHost;
}
+- (int32_t)encodingOverhead {
+ return 10; // bytes
+}
+
- (void)setUp {
+ [super setUp];
+
// Register test server as non-SSL.
[GRPCCall useInsecureConnectionsForHost:kLocalCleartextHost];
-
- [super setUp];
}
@end
diff --git a/src/objective-c/tests/InteropTestsLocalSSL.m b/src/objective-c/tests/InteropTestsLocalSSL.m
index f0f4b1d71f..1479c5896c 100644
--- a/src/objective-c/tests/InteropTestsLocalSSL.m
+++ b/src/objective-c/tests/InteropTestsLocalSSL.m
@@ -47,14 +47,18 @@ static NSString * const kLocalSSLHost = @"localhost:5051";
return kLocalSSLHost;
}
+- (int32_t)encodingOverhead {
+ return 10; // bytes
+}
+
- (void)setUp {
+ [super setUp];
+
// Register test server certificates and name.
NSBundle *bundle = [NSBundle bundleForClass:self.class];
NSString *certsPath = [bundle pathForResource:@"TestCertificates.bundle/test-certificates"
ofType:@"pem"];
[GRPCCall useTestCertsPath:certsPath testName:@"foo.test.google.fr" forHost:kLocalSSLHost];
-
- [super setUp];
}
- (void)testExceptions {
diff --git a/src/objective-c/tests/InteropTestsRemote.m b/src/objective-c/tests/InteropTestsRemote.m
index 758cc9346a..70f84753bb 100644
--- a/src/objective-c/tests/InteropTestsRemote.m
+++ b/src/objective-c/tests/InteropTestsRemote.m
@@ -47,4 +47,8 @@ static NSString * const kRemoteSSLHost = @"grpc-test.sandbox.googleapis.com";
return kRemoteSSLHost;
}
+- (int32_t)encodingOverhead {
+ return 12; // bytes
+}
+
@end
diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec
index d47b3044ad..b00f3c6e09 100644
--- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec
+++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
s.osx.deployment_target = '10.9'
# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
- s.dependency "!ProtoCompiler-gRPCPlugin", "~> 0.14"
+ s.dependency "!ProtoCompiler-gRPCPlugin", "~> 1.0.0-pre1"
repo_root = '../../../..'
bin_dir = "#{repo_root}/bins/$CONFIG"
diff --git a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme
index e6a052a8ce..d1d616c4cf 100644
--- a/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme
+++ b/src/objective-c/tests/Tests.xcodeproj/xcshareddata/xcschemes/AllTests.xcscheme
@@ -39,12 +39,6 @@
</BuildableReference>
<SkippedTests>
<Test
- Identifier = "GRPCClientTests/testConnectionToRemoteServer">
- </Test>
- <Test
- Identifier = "GRPCClientTests/testMetadata">
- </Test>
- <Test
Identifier = "InteropTests">
</Test>
<Test
diff --git a/src/objective-c/tests/build_example_test.sh b/src/objective-c/tests/build_example_test.sh
index 5c3766b4c0..ae75941ec6 100755
--- a/src/objective-c/tests/build_example_test.sh
+++ b/src/objective-c/tests/build_example_test.sh
@@ -31,44 +31,33 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
-set -eo pipefail
+set -evo pipefail
cd `dirname $0`
-BINDIR=`pwd`/../../../bins/$CONFIG
-TMP_PATH=$PATH
-
-# If `protoc` is not found, add bins/$CONFIG/protobuf/protoc to the search path
-hash protoc 2>/dev/null || TMP_PATH=$BINDIR/protobuf:$TMP_PATH
-
-# If `protoc-gen-objcgrpc` is not found, make a symlink from
-# bins/$CONGIF/grpc_objective_c_plugin and add it to the search path
-PATH=$TMP_PATH hash protoc-gen-objcgrpc 2>/dev/null || {
- ln -sf $BINDIR/grpc_objective_c_plugin $BINDIR/protoc-gen-objcgrpc
- TMP_PATH=$BINDIR:$TMP_PATH
-}
-
SCHEME=HelloWorld \
EXAMPLE_PATH=examples/objective-c/helloworld \
- PATH=$TMP_PATH \
./build_one_example.sh
SCHEME=RouteGuideClient \
EXAMPLE_PATH=examples/objective-c/route_guide \
- PATH=$TMP_PATH \
./build_one_example.sh
SCHEME=AuthSample \
EXAMPLE_PATH=examples/objective-c/auth_sample \
- PATH=$TMP_PATH \
+ ./build_one_example.sh
+
+rm -f ../examples/RemoteTestClient/*.{h,m}
+
+SCHEME=Sample \
+ EXAMPLE_PATH=src/objective-c/examples/Sample \
./build_one_example.sh
SCHEME=Sample \
EXAMPLE_PATH=src/objective-c/examples/Sample \
- PATH=$TMP_PATH \
+ FRAMEWORKS=YES \
./build_one_example.sh
SCHEME=SwiftSample \
EXAMPLE_PATH=src/objective-c/examples/SwiftSample \
- PATH=$TMP_PATH \
./build_one_example.sh
diff --git a/src/objective-c/tests/build_one_example.sh b/src/objective-c/tests/build_one_example.sh
index 24fb8b7bab..9fef6582a3 100755
--- a/src/objective-c/tests/build_one_example.sh
+++ b/src/objective-c/tests/build_one_example.sh
@@ -31,7 +31,7 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
-set -e
+set -ev
# Params:
# EXAMPLE_PATH - directory of the example
@@ -54,7 +54,7 @@ pod install
set -o pipefail
XCODEBUILD_FILTER='(^===|^\*\*|\bfatal\b|\berror\b|\bwarning\b|\bfail)'
xcodebuild \
- clean build \
+ build \
-workspace *.xcworkspace \
-scheme $SCHEME \
-destination name="iPhone 6" \
diff --git a/src/objective-c/tests/build_tests.sh b/src/objective-c/tests/build_tests.sh
index 8547bfd3a8..bc5bc04494 100755
--- a/src/objective-c/tests/build_tests.sh
+++ b/src/objective-c/tests/build_tests.sh
@@ -44,26 +44,10 @@ hash xcodebuild 2>/dev/null || {
exit 1
}
-BINDIR=../../../bins/$CONFIG
-
-if [ ! -f $BINDIR/protobuf/protoc ]; then
- hash protoc 2>/dev/null || {
- echo >&2 "Can't find protoc. Make sure run_tests.py is making" \
- "grpc_objective_c_plugin before calling this script."
- exit 1
- }
- # When protoc is already installed, make doesn't compile one. Put a link
- # there so the podspecs can do codegen using that path.
- mkdir -p $BINDIR/protobuf
- ln -s `which protoc` $BINDIR/protobuf/protoc
-fi
-
-[ -f $BINDIR/interop_server ] || {
- echo >&2 "Can't find the test server. Make sure run_tests.py is making" \
- "interop_server before calling this script. It needs to be done" \
- "before because pod install of gRPC renames some C gRPC files" \
- "and not the server's code references to them."
- exit 1
-}
+# clean the directory
+rm -rf Pods
+rm -rf Tests.xcworkspace
+rm -f Podfile.lock
+rm -f RemoteTestClient/*.{h,m}
pod install
diff --git a/src/objective-c/tests/run_tests.sh b/src/objective-c/tests/run_tests.sh
index c4fc5644f2..a265149f48 100755
--- a/src/objective-c/tests/run_tests.sh
+++ b/src/objective-c/tests/run_tests.sh
@@ -31,13 +31,21 @@
# Don't run this script standalone. Instead, run from the repository root:
# ./tools/run_tests/run_tests.py -l objc
-set -e
+set -ev
cd $(dirname $0)
# Run the tests server.
-../../../bins/$CONFIG/interop_server --port=5050 &
-../../../bins/$CONFIG/interop_server --port=5051 --use_tls &
+
+BINDIR=../../../bins/$CONFIG
+
+[ -f $BINDIR/interop_server ] || {
+ echo >&2 "Can't find the test server. Make sure run_tests.py is making" \
+ "interop_server before calling this script."
+ exit 1
+}
+$BINDIR/interop_server --port=5050 &
+$BINDIR/interop_server --port=5051 --use_tls &
# Kill them when this script exits.
trap 'kill -9 `jobs -p`' EXIT