1source 'https://github.com/CocoaPods/Specs.git'
2platform :ios, '8.0'
3
4install! 'cocoapods', :deterministic_uuids => false
5
6# 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.
10target 'CFStreamTests' do
11  pod 'gRPC-Core/CFStream-Implementation', :path => GRPC_LOCAL_SRC
12  pod 'BoringSSL-GRPC', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true
13end
14
15pre_install do |installer|
16  # This is the gRPC-Core podspec object, as initialized by its podspec file.
17  grpc_core_spec = installer.pod_targets.find{|t| t.name == 'gRPC-Core'}.root_spec
18
19  # Copied from gRPC-Core.podspec, except for the adjusted src_root:
20  src_root = "$(PODS_ROOT)/../#{GRPC_LOCAL_SRC}"
21  grpc_core_spec.pod_target_xcconfig = {
22    'GRPC_SRC_ROOT' => src_root,
23    'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"',
24    'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"',
25    # If we don't set these two settings, `include/grpc/support/time.h` and
26    # `src/core/lib/gpr/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the
27    # build.
28    'USE_HEADERMAP' => 'NO',
29    'ALWAYS_SEARCH_USER_PATHS' => 'NO',
30  }
31end
32
33post_install do |installer|
34  installer.pods_project.targets.each do |target|
35    target.build_configurations.each do |config|
36      config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
37    end
38
39    # CocoaPods creates duplicated library targets of gRPC-Core when the test targets include
40    # non-default subspecs of gRPC-Core. All of these library targets start with prefix 'gRPC-Core'
41    # and require the same error suppresion.
42    if target.name.start_with?('gRPC-Core')
43      target.build_configurations.each do |config|
44        # TODO(zyc): Remove this setting after the issue is resolved
45        # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void
46        # function" warning
47        config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO'
48      end
49    end
50  end
51end
52