aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/objective-c/tests')
-rw-r--r--src/objective-c/tests/Podfile75
-rw-r--r--src/objective-c/tests/RemoteTestClient/RemoteTest.podspec8
2 files changed, 55 insertions, 28 deletions
diff --git a/src/objective-c/tests/Podfile b/src/objective-c/tests/Podfile
index 6d5f94cbda..64b0009eb1 100644
--- a/src/objective-c/tests/Podfile
+++ b/src/objective-c/tests/Podfile
@@ -3,36 +3,59 @@ platform :ios, '8.0'
install! 'cocoapods', :deterministic_uuids => false
-def shared_pods
- pod 'Protobuf', :path => "../../../third_party/protobuf", :inhibit_warnings => true
- pod 'BoringSSL', :podspec => "..", :inhibit_warnings => true
- pod 'CronetFramework', :podspec => ".."
- pod 'gRPC', :path => "../../.."
- pod 'RemoteTest', :path => "RemoteTestClient"
-end
-
-target 'Tests' do
- shared_pods
-end
-
-target 'AllTests' do
- shared_pods
-end
+# Location of gRPC's repo root relative to this file.
+GRPC_LOCAL_SRC = '../../..'
-target 'RxLibraryUnitTests' do
- shared_pods
-end
-
-target 'InteropTestsRemote' do
- shared_pods
+# Install the dependencies in the main target plus all test targets.
+%w(
+ Tests
+ AllTests
+ RxLibraryUnitTests
+ InteropTestsRemote
+ InteropTestsLocalSSL
+ InteropTestsLocalCleartext
+).each do |target_name|
+ target target_name do
+ pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true
+ pod 'BoringSSL', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true
+ pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
+ pod 'gRPC', :path => GRPC_LOCAL_SRC
+ pod 'gRPC-Core', :path => GRPC_LOCAL_SRC
+ pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC
+ pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC
+ pod 'RemoteTest', :path => "RemoteTestClient"
+ end
end
-target 'InteropTestsLocalSSL' do
- shared_pods
-end
+# gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's
+# pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded
+# and before they are installed in the user project.
+#
+# This podspec searches for the gRPC core library headers under "$(PODS_ROOT)/gRPC-Core", where
+# Cocoapods normally places the downloaded sources. When doing local development of the libraries,
+# though, Cocoapods just takes the sources from whatever directory was specified using `:path`, and
+# doesn't copy them under $(PODS_ROOT). When using static libraries, one can sometimes rely on the
+# symbolic links to the pods headers that Cocoapods creates under "$(PODS_ROOT)/Headers". But those
+# aren't created when using dynamic frameworks. So our solution is to modify the podspec on the fly
+# to point at the local directory where the sources are.
+#
+# TODO(jcanizales): Send a PR to Cocoapods to get rid of this need.
+pre_install do |installer|
+ # This is the gRPC-Core podspec object, as initialized by its podspec file.
+ grpc_core_spec = installer.pod_targets.find{|t| t.name == 'gRPC-Core'}.root_spec
-target 'InteropTestsLocalCleartext' do
- shared_pods
+ # Copied from gRPC-Core.podspec, except for the adjusted src_root:
+ src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}"
+ grpc_core_spec.pod_target_xcconfig = {
+ 'GRPC_SRC_ROOT' => src_root,
+ 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"',
+ 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"',
+ # If we don't set these two settings, `include/grpc/support/time.h` and
+ # `src/core/lib/support/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the
+ # build.
+ 'USE_HEADERMAP' => 'NO',
+ 'ALWAYS_SEARCH_USER_PATHS' => 'NO',
+ }
end
post_install do |installer|
diff --git a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec
index e1fd991038..887380eb55 100644
--- a/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec
+++ b/src/objective-c/tests/RemoteTestClient/RemoteTest.podspec
@@ -22,14 +22,18 @@ Pod::Spec.new do |s|
ms.source_files = "*.pbobjc.{h,m}"
ms.header_mappings_dir = "."
ms.requires_arc = false
- ms.dependency "Protobuf", "~> 3.0.0-alpha-4"
+ ms.dependency "Protobuf", "~> 3.0.0-beta-3.1"
+ # This is needed by all pods that depend on Protobuf:
+ ms.pod_target_xcconfig = {
+ 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1',
+ }
end
s.subspec "Services" do |ss|
ss.source_files = "*.pbrpc.{h,m}"
ss.header_mappings_dir = "."
ss.requires_arc = true
- ss.dependency "gRPC", "~> 0.12"
+ ss.dependency "gRPC-ProtoRPC", "~> 0.14"
ss.dependency "#{s.name}/Messages"
end
end