blob: 30a34260d407cb787f8bebd370515d5a042c90a5 [file] [log] [blame]
Jorge Canizalesf3530ac2015-05-26 14:34:46 -07001source 'https://github.com/CocoaPods/Specs.git'
2platform :ios, '8.0'
3
Jorge Canizales8d1e8d02016-05-05 10:55:25 -07004install! 'cocoapods', :deterministic_uuids => false
5
Jorge Canizales12e03fe2016-06-08 12:53:04 -07006# Location of gRPC's repo root relative to this file.
7GRPC_LOCAL_SRC = '../../..'
8
9# Install the dependencies in the main target plus all test targets.
10%w(
11 Tests
12 AllTests
13 RxLibraryUnitTests
14 InteropTestsRemote
15 InteropTestsLocalSSL
16 InteropTestsLocalCleartext
17).each do |target_name|
18 target target_name do
Jorge Canizalesc93d6a62016-06-30 15:37:11 -070019 pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true
20 pod 'BoringSSL', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true
21 pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
Jorge Canizales12e03fe2016-06-08 12:53:04 -070022 pod 'gRPC', :path => GRPC_LOCAL_SRC
23 pod 'gRPC-Core', :path => GRPC_LOCAL_SRC
24 pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC
25 pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC
26 pod 'RemoteTest', :path => "RemoteTestClient"
27 end
Paul Querna88e0bb12016-03-03 23:42:17 -080028end
Jorge Canizalesf3530ac2015-05-26 14:34:46 -070029
Jorge Canizales2f463262016-06-08 14:51:41 -070030# gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's
31# pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded
32# and before they are installed in the user project.
33#
34# This podspec searches for the gRPC core library headers under "$(PODS_ROOT)/gRPC-Core", where
35# Cocoapods normally places the downloaded sources. When doing local development of the libraries,
36# though, Cocoapods just takes the sources from whatever directory was specified using `:path`, and
37# doesn't copy them under $(PODS_ROOT). When using static libraries, one can sometimes rely on the
38# symbolic links to the pods headers that Cocoapods creates under "$(PODS_ROOT)/Headers". But those
39# aren't created when using dynamic frameworks. So our solution is to modify the podspec on the fly
40# to point at the local directory where the sources are.
41#
42# TODO(jcanizales): Send a PR to Cocoapods to get rid of this need.
43pre_install do |installer|
44 # This is the gRPC-Core podspec object, as initialized by its podspec file.
45 grpc_core_spec = installer.pod_targets.find{|t| t.name == 'gRPC-Core'}.root_spec
46
47 # Copied from gRPC-Core.podspec, except for the adjusted src_root:
Jorge Canizales2f463262016-06-08 14:51:41 -070048 src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}"
Jorge Canizalescc074d92016-06-28 09:52:43 -070049 grpc_core_spec.pod_target_xcconfig = {
Jorge Canizales2f463262016-06-08 14:51:41 -070050 'GRPC_SRC_ROOT' => src_root,
51 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"',
Jorge Canizalescc074d92016-06-28 09:52:43 -070052 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"',
53 # If we don't set these two settings, `include/grpc/support/time.h` and
54 # `src/core/lib/support/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the
55 # build.
Jorge Canizales2f463262016-06-08 14:51:41 -070056 'USE_HEADERMAP' => 'NO',
57 'ALWAYS_SEARCH_USER_PATHS' => 'NO',
Jorge Canizalescc074d92016-06-28 09:52:43 -070058 }
Jorge Canizales91db5ac2015-10-28 14:53:38 -070059end
Yuchen Zeng36a58a72016-06-20 14:01:07 -070060
61post_install do |installer|
62 installer.pods_project.targets.each do |target|
63 target.build_configurations.each do |config|
64 config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
65 end
Jorge Canizalesbb160252016-07-01 10:09:16 -070066 if target.name == 'gRPC-Core'
Yuchen Zeng36a58a72016-06-20 14:01:07 -070067 target.build_configurations.each do |config|
Yuchen Zengd5fd7dd2016-06-21 11:13:23 -070068 # TODO(zyc) Remove this setting after the issue is resolved
Yuchen Zeng36a58a72016-06-20 14:01:07 -070069 # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void
70 # function" warning
71 config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO'
72 end
73 end
74 end
75end