1 source 'https://github.com/CocoaPods/Specs.git'
3 install! 'cocoapods', :deterministic_uuids => false
5 # Location of gRPC's repo root relative to this file.
6 GRPC_LOCAL_SRC = '../../..'
9 target 'CronetTests' do
11 pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true
13 pod '!ProtoCompiler', :path => "#{GRPC_LOCAL_SRC}/src/objective-c"
14 pod '!ProtoCompiler-gRPCCppPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c"
15 pod 'Protobuf-C++', :podspec => "#{GRPC_LOCAL_SRC}/src/cpp", :inhibit_warnings => true
17 pod 'BoringSSL-GRPC', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true
19 pod 'gRPC-Core', :path => GRPC_LOCAL_SRC
20 pod 'gRPC-C++/Cronet-Implementation', :path => GRPC_LOCAL_SRC
21 pod 'gRPC-C++/Protobuf', :path => GRPC_LOCAL_SRC
22 pod 'RemoteTestCpp', :path => "RemoteTestClientCpp", :inhibit_warnings => true
24 pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC
25 pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
26 pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC, :inhibit_warnings => true
29 # gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's
30 # pre_install hook lets us do that. The block passed to it runs after the podspecs are downloaded
31 # and before they are installed in the user project.
33 # This podspec searches for the gRPC core library headers under "$(PODS_ROOT)/gRPC-Core", where
34 # Cocoapods normally places the downloaded sources. When doing local development of the libraries,
35 # though, Cocoapods just takes the sources from whatever directory was specified using `:path`, and
36 # doesn't copy them under $(PODS_ROOT). When using static libraries, one can sometimes rely on the
37 # symbolic links to the pods headers that Cocoapods creates under "$(PODS_ROOT)/Headers". But those
38 # aren't created when using dynamic frameworks. So our solution is to modify the podspec on the fly
39 # to point at the local directory where the sources are.
41 # TODO(jcanizales): Send a PR to Cocoapods to get rid of this need.
42 pre_install do |installer|
43 # This is the gRPC-Core podspec object, as initialized by its podspec file.
44 grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec
46 # Copied from gRPC-Core.podspec, except for the adjusted src_root:
47 src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}"
48 grpc_core_spec.pod_target_xcconfig = {
49 'GRPC_SRC_ROOT' => src_root,
50 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"',
51 'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"',
52 # If we don't set these two settings, `include/grpc/support/time.h` and
53 # `src/core/lib/gpr/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the
55 'USE_HEADERMAP' => 'NO',
56 'ALWAYS_SEARCH_USER_PATHS' => 'NO',
59 # This is the RemoteTestCpp podspec object.
60 remote_test_cpp_spec = installer.pod_targets.find{|t| t.name.start_with?('RemoteTestCpp')}.root_spec
62 # ios-cpp-test-cronet failes by chance because the RemoteTestCpp target cannot find Protobuf-C++.
63 remote_test_cpp_spec.pod_target_xcconfig = {
64 'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(PODS_ROOT)/header/Public/Protobuf-C++"',
68 post_install do |installer|
69 installer.pods_project.targets.each do |target|
70 target.build_configurations.each do |config|
71 config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
74 # CocoaPods creates duplicated library targets of gRPC-Core when the test targets include
75 # non-default subspecs of gRPC-Core. All of these library targets start with prefix 'gRPC-Core'
76 # and require the same error suppresion.
77 if target.name.start_with?('gRPC-Core')
78 target.build_configurations.each do |config|
79 # TODO(zyc): Remove this setting after the issue is resolved
80 # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void
82 config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO'
83 config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1'
87 # Activate Cronet for the dedicated build configuration 'Cronet', which will be used solely by
88 # the test target 'InteropTestsRemoteWithCronet'
89 # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will
90 # be used by all test targets using it.
91 if /gRPC-(mac|i)OS/.match(target.name)
92 target.build_configurations.each do |config|
93 if config.name == 'Cronet'
94 config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1'
95 elsif config.name == 'Test'
96 config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_TEST_OBJC=1'
101 # Enable NSAssert on gRPC
102 if /(gRPC|ProtoRPC|RxLibrary)-(mac|i)OS/.match(target.name)
103 target.build_configurations.each do |config|
104 if config.name != 'Release'
105 config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES'