Link `swiftSwiftOnoneSupport` for test xcconfigs

parent 80069e35
...@@ -38,6 +38,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -38,6 +38,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6767](https://github.com/CocoaPods/CocoaPods/pull/6767) [#6767](https://github.com/CocoaPods/CocoaPods/pull/6767)
* Link `swiftSwiftOnoneSupport` for test xcconfigs
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6769](https://github.com/CocoaPods/CocoaPods/pull/6769)
* Ensure product name for tests is not overridden by custom build settings * Ensure product name for tests is not overridden by custom build settings
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6766](https://github.com/CocoaPods/CocoaPods/pull/6766) [#6766](https://github.com/CocoaPods/CocoaPods/pull/6766)
......
...@@ -31,7 +31,7 @@ GIT ...@@ -31,7 +31,7 @@ GIT
GIT GIT
remote: https://github.com/CocoaPods/Xcodeproj.git remote: https://github.com/CocoaPods/Xcodeproj.git
revision: 7355a4eac5d3634725e0925cfbfa46fbcd88b933 revision: 76932aa3dce97408361b0cd485deff9a77e3bcb4
branch: master branch: master
specs: specs:
xcodeproj (1.4.4) xcodeproj (1.4.4)
...@@ -291,4 +291,4 @@ DEPENDENCIES ...@@ -291,4 +291,4 @@ DEPENDENCIES
xcodeproj! xcodeproj!
BUNDLED WITH BUNDLED WITH
1.14.6 1.15.0
...@@ -303,12 +303,25 @@ module Pod ...@@ -303,12 +303,25 @@ module Pod
target.test_native_targets.each do |test_target| target.test_native_targets.each do |test_target|
test_target.build_configurations.each do |test_target_bc| test_target.build_configurations.each do |test_target_bc|
test_target_swift_debug_hack(test_target_bc)
test_target_bc.base_configuration_reference = xcconfig_file_ref test_target_bc.base_configuration_reference = xcconfig_file_ref
end end
end end
end end
end end
# Manually add `libswiftSwiftOnoneSupport.dylib` as it seems there is an issue with tests that do not include it for Debug configurations.
# Possibly related to Swift module optimization.
#
# @return [void]
#
def test_target_swift_debug_hack(test_target_bc)
return unless test_target_bc.debug?
return unless [target, *target.recursive_dependent_targets].any?(&:uses_swift?)
ldflags = test_target_bc.build_settings['OTHER_LDFLAGS'] ||= '$(inherited)'
ldflags << ' -lswiftSwiftOnoneSupport'
end
# Creates a build phase which links the versioned header folders # Creates a build phase which links the versioned header folders
# of the OS X into the framework bundle's root root directory. # of the OS X into the framework bundle's root root directory.
# This is only necessary because the way how headers are copied # This is only necessary because the way how headers are copied
......
...@@ -148,11 +148,24 @@ module Pod ...@@ -148,11 +148,24 @@ module Pod
@coconut_pod_target.stubs(:file_accessors).returns(file_accessors) @coconut_pod_target.stubs(:file_accessors).returns(file_accessors)
end end
it 'includes correct other ld flags' do
generator = PodXCConfig.new(@coconut_pod_target, true)
xcconfig = generator.generate
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-ObjC -l"CoconutLib"'
end
it 'includes correct other ld flags when requires frameworks' do
@coconut_pod_target.stubs(:requires_frameworks?).returns(true)
generator = PodXCConfig.new(@coconut_pod_target, true)
xcconfig = generator.generate
xcconfig.to_hash['OTHER_LDFLAGS'].should == '-ObjC -framework "CoconutLib"'
end
it 'includes other ld flags for test dependent targets' do it 'includes other ld flags for test dependent targets' do
@coconut_pod_target.test_dependent_targets = [@monkey_pod_target] @coconut_pod_target.test_dependent_targets = [@monkey_pod_target]
generator = PodXCConfig.new(@coconut_pod_target, true) generator = PodXCConfig.new(@coconut_pod_target, true)
xcconfig = generator.generate xcconfig = generator.generate
xcconfig.to_hash['OTHER_LDFLAGS'].should.include '-l"monkey" -framework "dynamic-monkey"' xcconfig.to_hash['OTHER_LDFLAGS'].should == '-ObjC -l"CoconutLib" -l"monkey" -framework "dynamic-monkey"'
end end
it 'adds settings for test dependent targets' do it 'adds settings for test dependent targets' do
......
...@@ -195,6 +195,19 @@ module Pod ...@@ -195,6 +195,19 @@ module Pod
@coconut_pod_target.test_native_targets.count.should == 1 @coconut_pod_target.test_native_targets.count.should == 1
end end
it 'adds swiftSwiftOnoneSupport ld flag to the debug configuration' do
@coconut_pod_target.stubs(:uses_swift?).returns(true)
@installer.install!
native_test_target = @project.targets[1]
debug_configuration = native_test_target.build_configurations.find(&:debug?)
debug_configuration.build_settings['OTHER_LDFLAGS'].sort.should == [
'$(inherited)',
'-lswiftSwiftOnoneSupport',
]
release_configuration = native_test_target.build_configurations.find { |bc| bc.type == :release }
release_configuration.build_settings['OTHER_LDFLAGS'].should.be.nil
end
it 'adds files to build phases correctly depending on the native target' do it 'adds files to build phases correctly depending on the native target' do
@installer.install! @installer.install!
@project.targets.count.should == 2 @project.targets.count.should == 2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment