Jorge Canizales | f3530ac | 2015-05-26 14:34:46 -0700 | [diff] [blame] | 1 | source 'https://github.com/CocoaPods/Specs.git' |
| 2 | platform :ios, '8.0' |
| 3 | |
Jorge Canizales | 8d1e8d0 | 2016-05-05 10:55:25 -0700 | [diff] [blame] | 4 | install! 'cocoapods', :deterministic_uuids => false |
| 5 | |
Jorge Canizales | 12e03fe | 2016-06-08 12:53:04 -0700 | [diff] [blame] | 6 | # Location of gRPC's repo root relative to this file. |
| 7 | GRPC_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 Canizales | c93d6a6 | 2016-06-30 15:37:11 -0700 | [diff] [blame] | 19 | 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 Canizales | 12e03fe | 2016-06-08 12:53:04 -0700 | [diff] [blame] | 22 | 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 Querna | 88e0bb1 | 2016-03-03 23:42:17 -0800 | [diff] [blame] | 28 | end |
Jorge Canizales | f3530ac | 2015-05-26 14:34:46 -0700 | [diff] [blame] | 29 | |
Jorge Canizales | 2f46326 | 2016-06-08 14:51:41 -0700 | [diff] [blame] | 30 | # 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. |
| 43 | pre_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 Canizales | 2f46326 | 2016-06-08 14:51:41 -0700 | [diff] [blame] | 48 | src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}" |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 49 | grpc_core_spec.pod_target_xcconfig = { |
Jorge Canizales | 2f46326 | 2016-06-08 14:51:41 -0700 | [diff] [blame] | 50 | 'GRPC_SRC_ROOT' => src_root, |
| 51 | 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"', |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 52 | '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 Canizales | 2f46326 | 2016-06-08 14:51:41 -0700 | [diff] [blame] | 56 | 'USE_HEADERMAP' => 'NO', |
| 57 | 'ALWAYS_SEARCH_USER_PATHS' => 'NO', |
Jorge Canizales | cc074d9 | 2016-06-28 09:52:43 -0700 | [diff] [blame] | 58 | } |
Jorge Canizales | 91db5ac | 2015-10-28 14:53:38 -0700 | [diff] [blame] | 59 | end |
Yuchen Zeng | 36a58a7 | 2016-06-20 14:01:07 -0700 | [diff] [blame] | 60 | |
| 61 | post_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 Canizales | bb16025 | 2016-07-01 10:09:16 -0700 | [diff] [blame^] | 66 | if target.name == 'gRPC-Core' |
Yuchen Zeng | 36a58a7 | 2016-06-20 14:01:07 -0700 | [diff] [blame] | 67 | target.build_configurations.each do |config| |
Yuchen Zeng | d5fd7dd | 2016-06-21 11:13:23 -0700 | [diff] [blame] | 68 | # TODO(zyc) Remove this setting after the issue is resolved |
Yuchen Zeng | 36a58a7 | 2016-06-20 14:01:07 -0700 | [diff] [blame] | 69 | # 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 |
| 75 | end |