Commit b1918cb6 authored by Orta's avatar Orta Committed by GitHub

Merge pull request #7037 from dnkoutso/no_test_pod_target_xcconfig_merge

Do not merge `pod_target_xcconfig` from test specs into non test xcconfigs
parents 0586bd15 cd2ee62f
......@@ -38,6 +38,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7036](https://github.com/CocoaPods/CocoaPods/pull/7036)
* Do not merge `pod_target_xcconfig` from test specs into non test xcconfigs
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7037](https://github.com/CocoaPods/CocoaPods/pull/7037)
* Fix common paths sometimes calculating incorrectly
[amorde](https://github.com/amorde)
[#7028](https://github.com/CocoaPods/CocoaPods/pull/7028)
......
......@@ -66,7 +66,7 @@ module Pod
XCConfigHelper.add_settings_for_file_accessors_of_target(nil, target, @xcconfig)
target.file_accessors.each do |file_accessor|
@xcconfig.merge!(file_accessor.spec_consumer.pod_target_xcconfig)
@xcconfig.merge!(file_accessor.spec_consumer.pod_target_xcconfig) if @test_xcconfig == file_accessor.spec.test_specification?
end
XCConfigHelper.add_target_specific_settings(target, @xcconfig)
recursive_dependent_targets = target.recursive_dependent_targets
......
......@@ -127,13 +127,19 @@ end
def fixture_pod_target(spec_or_name, target_definitions = [])
spec = spec_or_name.is_a?(Pod::Specification) ? spec_or_name : fixture_spec(spec_or_name)
fixture_pod_target_with_specs([spec], target_definitions)
end
def fixture_pod_target_with_specs(specs, target_definitions = [])
target_definitions << fixture_target_definition if target_definitions.empty?
target_definitions.each { |td| td.store_pod(spec.name) }
Pod::PodTarget.new([spec], target_definitions, config.sandbox).tap do |pod_target|
target_definitions.each { |td| specs.each { |spec| td.store_pod(spec.name) } }
Pod::PodTarget.new(specs, target_definitions, config.sandbox).tap do |pod_target|
specs.each do |spec|
pod_target.file_accessors << fixture_file_accessor(spec, pod_target.platform)
consumer = spec.consumer(pod_target.platform)
pod_target.spec_consumers << consumer
end
end
end
def fixture_aggregate_target(pod_targets = [], target_definition = nil)
......
......@@ -142,16 +142,34 @@ module Pod
@banana_pod_target = fixture_pod_target(@banana_spec)
@coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec')
@coconut_pod_target = fixture_pod_target(@coconut_spec)
@coconut_test_spec = @coconut_spec.test_specs.first
@coconut_pod_target = fixture_pod_target_with_specs([@coconut_spec, @coconut_test_spec])
@consumer = @coconut_pod_target.spec_consumers.first
@test_consumer = @coconut_pod_target.spec_consumers[1]
@podfile = @coconut_pod_target.podfile
file_accessors = [Sandbox::FileAccessor.new(fixture('coconut-lib'), @consumer)]
file_accessors = [Sandbox::FileAccessor.new(fixture('coconut-lib'), @consumer), Sandbox::FileAccessor.new(fixture('coconut-lib'), @test_consumer)]
@coconut_pod_target.stubs(:file_accessors).returns(file_accessors)
end
it 'does not merge pod target xcconfig of test specifications for a non test xcconfig' do
@coconut_spec.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'NON_TEST_FLAG=1' }
@coconut_test_spec.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'TEST_ONLY=1' }
generator = PodXCConfig.new(@coconut_pod_target, false)
xcconfig = generator.generate
xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should == '$(inherited) COCOAPODS=1 NON_TEST_FLAG=1'
end
it 'merges the pod target xcconfig of non test specifications for test xcconfigs' do
@coconut_spec.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'NON_TEST_FLAG=1' }
@coconut_test_spec.pod_target_xcconfig = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'TEST_ONLY=1' }
generator = PodXCConfig.new(@coconut_pod_target, true)
xcconfig = generator.generate
xcconfig.to_hash['GCC_PREPROCESSOR_DEFINITIONS'].should == '$(inherited) COCOAPODS=1 NON_TEST_FLAG=1 TEST_ONLY=1'
end
it 'includes correct other ld flags' do
generator = PodXCConfig.new(@coconut_pod_target, true)
xcconfig = generator.generate
......
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