Skip to content

Commit

Permalink
Merge pull request grpc#7554 from muxi/fix-cronet-interop-test
Browse files Browse the repository at this point in the history
Fix Objective-C test pods for Cronet tests
  • Loading branch information
muxi authored Aug 2, 2016
2 parents 5e1fbd2 + 6f74893 commit d924b01
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 34 deletions.
12 changes: 8 additions & 4 deletions gRPC-Core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -779,12 +779,16 @@ Pod::Spec.new do |s|
ss.source_files = 'include/grpc/grpc_cronet.h'
end

s.subspec 'Cronet-Tests' do |ss|
s.subspec 'Cronet-Implementation' do |ss|
ss.header_mappings_dir = '.'

ss.source_files = 'src/core/ext/transport/cronet/client/secure/cronet_channel_create.c',
'src/core/ext/transport/cronet/transport/cronet_transport.c',
'test/core/end2end/cq_verifier.{c,h}',
'src/core/ext/transport/cronet/transport/cronet_transport.c'
end

s.subspec 'Tests' do |ss|
ss.header_mappings_dir = '.'

ss.source_files = 'test/core/end2end/cq_verifier.{c,h}',
'test/core/end2end/end2end_tests.{c,h}',
'test/core/end2end/tests/*.{c,h}',
'test/core/end2end/data/*.{c,h}',
Expand Down
4 changes: 2 additions & 2 deletions src/objective-c/GRPCClient/private/GRPCChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ struct grpc_channel_credentials;
* Creates a secure channel to the specified @c host using Cronet as a transport mechanism.
*/
#ifdef GRPC_COMPILE_WITH_CRONET
+ (nullable GRPCChannel *)secureCronetChannelWithHost:(NSString *)host
channelArgs:(NSDictionary *)channelArgs;
+ (nullable GRPCChannel *)secureCronetChannelWithHost:(nonnull NSString *)host
channelArgs:(nonnull NSDictionary *)channelArgs;
#endif
/**
* Creates a secure channel to the specified @c host using the specified @c credentials and
Expand Down
41 changes: 23 additions & 18 deletions src/objective-c/tests/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ GRPC_LOCAL_SRC = '../../..'
InteropTestsRemote
InteropTestsLocalSSL
InteropTestsLocalCleartext
InteropTestsRemoteWithCronet
).each do |target_name|
target target_name do
pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true
Expand All @@ -28,6 +29,11 @@ GRPC_LOCAL_SRC = '../../..'
pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC
pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC
pod 'RemoteTest', :path => "RemoteTestClient"

if target_name == 'InteropTestsRemoteWithCronet'
pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC
pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
end
end
end

Expand All @@ -36,23 +42,8 @@ target 'CoreCronetEnd2EndTests' do
pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"
pod 'gRPC-Core', :path => GRPC_LOCAL_SRC
pod 'gRPC-Core/Cronet-Interface', :path => GRPC_LOCAL_SRC
pod 'gRPC-Core/Cronet-Tests', :path => GRPC_LOCAL_SRC
end

target 'InteropTestsRemoteWithCronet' do
pod 'Protobuf', :path => "#{GRPC_LOCAL_SRC}/third_party/protobuf", :inhibit_warnings => true

pod '!ProtoCompiler', :path => "#{GRPC_LOCAL_SRC}/src/objective-c"
pod '!ProtoCompiler-gRPCPlugin', :path => "#{GRPC_LOCAL_SRC}/src/objective-c"

pod 'BoringSSL', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c", :inhibit_warnings => true
pod 'CronetFramework', :podspec => "#{GRPC_LOCAL_SRC}/src/objective-c"

pod 'gRPC', :path => GRPC_LOCAL_SRC
pod 'gRPC-Core', :path => GRPC_LOCAL_SRC
pod 'gRPC-RxLibrary', :path => GRPC_LOCAL_SRC
pod 'gRPC-ProtoRPC', :path => GRPC_LOCAL_SRC
pod 'RemoteTest', :path => "RemoteTestClient"
pod 'gRPC-Core/Cronet-Implementation', :path => GRPC_LOCAL_SRC
pod 'gRPC-Core/Tests', :path => GRPC_LOCAL_SRC
end

# gRPC-Core.podspec needs to be modified to be successfully used for local development. A Podfile's
Expand Down Expand Up @@ -91,13 +82,27 @@ post_install do |installer|
target.build_configurations.each do |config|
config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
end
if target.name == 'gRPC-Core' or target.name == 'gRPC-Core.default-Cronet-Interface-Cronet-Tests'

# CocoaPods creates duplicated library targets of gRPC-Core when the test targets include
# non-default subspecs of gRPC-Core. All of these library targets start with prefix 'gRPC-Core.'
# and require the same error suppresion.
if target.name == 'gRPC-Core' or target.name.start_with?('gRPC-Core.')
target.build_configurations.each do |config|
# TODO(zyc): Remove this setting after the issue is resolved
# GPR_UNREACHABLE_CODE causes "Control may reach end of non-void
# function" warning
config.build_settings['GCC_WARN_ABOUT_RETURN_TYPE'] = 'NO'
end
end

# Activate Cronet for the dedicated build configuration 'Cronet', which will be used solely by
# the test target 'InteropTestsRemoteWithCronet'
if target.name == 'gRPC'
target.build_configurations.each do |config|
if config.name == 'Cronet'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited) COCOAPODS=1 GRPC_COMPILE_WITH_CRONET=1'
end
end
end
end
end
Loading

0 comments on commit d924b01

Please sign in to comment.