xref: /aosp_15_r20/external/grpc-grpc/src/objective-c/tests/Podfile (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1source 'https://github.com/CocoaPods/Specs.git'
2
3install! 'cocoapods', :deterministic_uuids => false
4
5# Location of gRPC's repo root relative to this file.
6GRPC_LOCAL_SRC = '../../..'
7
8def grpc_deps
9  pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true
10
11  pod '!ProtoCompiler',            :path => "#{GRPC_LOCAL_SRC}/src/objective-c"
12  pod '!ProtoCompiler-gRPCPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c"
13
14  pod 'BoringSSL-GRPC',       :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true
15
16  pod 'gRPC/InternalTesting',           :path => GRPC_LOCAL_SRC
17  pod 'gRPC-Core',                      :path => GRPC_LOCAL_SRC, :inhibit_warnings => true
18  pod 'gRPC-RxLibrary',                 :path => GRPC_LOCAL_SRC
19  pod 'gRPC-ProtoRPC',                  :path => GRPC_LOCAL_SRC, :inhibit_warnings => true
20  pod 'RemoteTest', :path => "RemoteTestClient", :inhibit_warnings => true
21  pod 'Common', :path => "Common"
22end
23
24target 'TvTests' do
25  platform :tvos, '10.0'
26  grpc_deps
27end
28
29target 'MacTests' do
30  platform :osx, '10.12'
31  grpc_deps
32end
33
34%w(
35  UnitTests
36  InteropTests
37).each do |target_name|
38  target target_name do
39    platform :ios, '10.0'
40    grpc_deps
41  end
42end
43
44target 'CronetTests' do
45  platform :ios, '10.0'
46  grpc_deps
47
48  pod 'gRPC/GRPCCoreCronet',           :path => GRPC_LOCAL_SRC
49  pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
50end
51
52target 'PerfTests' do
53  platform :ios, '10.0'
54  grpc_deps
55
56  pod 'gRPC/GRPCCoreCronet',           :path => GRPC_LOCAL_SRC
57  pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
58end
59
60post_install do |installer|
61  installer.pods_project.targets.each do |target|
62    target.build_configurations.each do |config|
63      config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
64      if config.name == 'Test'
65        config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '0'
66        config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
67      end
68    end
69
70    # CocoaPods creates duplicated library targets of gRPC-Core when the test targets include
71    # non-default subspecs of gRPC-Core. All of these library targets start with prefix 'gRPC-Core'
72    # and require the same error suppresion.
73    if target.name.start_with?('gRPC-Core')
74      target.build_configurations.each do |config|
75        # TODO(zyc): Remove this setting after the issue is resolved
76        # GPR_UNREACHABLE_CODE causes "Control may reach end of non-void
77        # function" warning
78        config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO'
79        # Abseil isn't free from the following warning
80        config.build_settings['GCC_WARN_64_TO_32_BIT_CONVERSION'] = 'NO'
81        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_CRONET_WITH_PACKET_COALESCING=1 GRPC_CFSTREAM=1'
82      end
83    end
84
85    # Activate Cronet for the dedicated build configuration 'Cronet', which will be used solely by
86    # the test target 'InteropTestsRemoteWithCronet'
87    # Activate GRPCCall+InternalTests functions for the dedicated build configuration 'Test', which will
88    # be used by all test targets using it.
89    if /gRPC(-macOS|-iOS|-tvOS|\.|-[0-9a-f])/.match(target.name)
90      target.build_configurations.each do |config|
91        if config.name == 'Cronet'
92          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1 GRPC_TEST_OBJC=1'
93        elsif config.name == 'Test'
94          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_TEST_OBJC=1'
95        end
96      end
97    end
98
99    # Enable NSAssert on gRPC
100    if /(gRPC|ProtoRPC|RxLibrary)/.match(target.name)
101      target.build_configurations.each do |config|
102        if config.name != 'Release'
103          config.build_settings['ENABLE_NS_ASSERTIONS'] = 'YES'
104        end
105      end
106    end
107  end
108end
109