Unverified Commit 781d5047 authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #7688 from dnkoutso/fix_resource_framework_paths

Do not include test dependencies input and output paths
parents 071e84d9 ad599ad3
...@@ -23,6 +23,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -23,6 +23,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Do not include test dependencies input and output paths
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7688](https://github.com/CocoaPods/CocoaPods/pull/7688)
* Remove [system] declaration attribute from generated module maps * Remove [system] declaration attribute from generated module maps
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7589](https://github.com/CocoaPods/CocoaPods/issues/7589) [#7589](https://github.com/CocoaPods/CocoaPods/issues/7589)
......
...@@ -52,7 +52,10 @@ module Pod ...@@ -52,7 +52,10 @@ module Pod
def add_copy_resources_script_phase(native_target) def add_copy_resources_script_phase(native_target)
test_type = target.test_type_for_product_type(native_target.symbol_type) test_type = target.test_type_for_product_type(native_target.symbol_type)
script_path = "${PODS_ROOT}/#{target.copy_resources_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}" script_path = "${PODS_ROOT}/#{target.copy_resources_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
resource_paths = target.all_dependent_targets.flat_map(&:resource_paths) resource_paths = target.all_dependent_targets.flat_map do |dependent_target|
include_test_spec_paths = dependent_target == target
dependent_target.resource_paths(include_test_spec_paths)
end
input_paths = [] input_paths = []
output_paths = [] output_paths = []
unless resource_paths.empty? unless resource_paths.empty?
...@@ -71,7 +74,11 @@ module Pod ...@@ -71,7 +74,11 @@ module Pod
def add_embed_frameworks_script_phase(native_target) def add_embed_frameworks_script_phase(native_target)
test_type = target.test_type_for_product_type(native_target.symbol_type) test_type = target.test_type_for_product_type(native_target.symbol_type)
script_path = "${PODS_ROOT}/#{target.embed_frameworks_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}" script_path = "${PODS_ROOT}/#{target.embed_frameworks_script_path_for_test_type(test_type).relative_path_from(target.sandbox.root)}"
framework_paths = target.all_dependent_targets.flat_map(&:framework_paths) all_dependent_targets = target.all_dependent_targets
framework_paths = all_dependent_targets.flat_map do |dependent_target|
include_test_spec_paths = dependent_target == target
dependent_target.framework_paths(include_test_spec_paths)
end
input_paths = [] input_paths = []
output_paths = [] output_paths = []
unless framework_paths.empty? unless framework_paths.empty?
......
...@@ -10,11 +10,19 @@ module Pod ...@@ -10,11 +10,19 @@ module Pod
@project = Pod::Project.new(config.sandbox.project_path) @project = Pod::Project.new(config.sandbox.project_path)
@project.save @project.save
@target_definition = fixture_target_definition @target_definition = fixture_target_definition
@banana_spec = fixture_spec('banana-lib/BananaLib.podspec')
@banana_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@banana_spec],
[@target_definition])
@coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec') @coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec')
@coconut_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios, [@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition]) @coconut_pod_target = PodTarget.new(config.sandbox, false, {}, [], Platform.ios,
@native_target = stub('NativeTarget', :shell_script_build_phases => [], :build_phases => [], :project => @project) [@coconut_spec, *@coconut_spec.recursive_subspecs],
@test_native_target = stub('TestNativeTarget', :symbol_type => :unit_test_bundle, :build_phases => [], :shell_script_build_phases => [], :project => @project) [@target_definition])
@target_installation_result = TargetInstallationResult.new(@coconut_pod_target, @native_target, [], [@test_native_target]) @native_target = stub('NativeTarget', :shell_script_build_phases => [], :build_phases => [],
:project => @project)
@test_native_target = stub('TestNativeTarget', :symbol_type => :unit_test_bundle, :build_phases => [],
:shell_script_build_phases => [], :project => @project)
@target_installation_result = TargetInstallationResult.new(@coconut_pod_target, @native_target, [],
[@test_native_target])
end end
describe '#integrate!' do describe '#integrate!' do
...@@ -30,7 +38,8 @@ module Pod ...@@ -30,7 +38,8 @@ module Pod
end end
it 'clears input and output paths from script phase if it exceeds limit' do it 'clears input and output paths from script phase if it exceeds limit' do
# The paths represented here will be 501 for input paths and 501 for output paths which will exceed the limit. # The paths represented here will be 501 for input paths and 501 for output paths
# which will exceed the limit.
resource_paths = (0..500).map do |i| resource_paths = (0..500).map do |i|
"${PODS_CONFIGURATION_BUILD_DIR}/DebugLib/DebugLibPng#{i}.png" "${PODS_CONFIGURATION_BUILD_DIR}/DebugLib/DebugLibPng#{i}.png"
end end
...@@ -45,7 +54,9 @@ module Pod ...@@ -45,7 +54,9 @@ module Pod
end end
it 'integrates test native targets with frameworks and resources script phase input and output paths' do it 'integrates test native targets with frameworks and resources script phase input and output paths' do
framework_paths = { :name => 'Vendored.framework', :input_path => '${PODS_ROOT}/Vendored/Vendored.framework', :output_path => '${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Vendored.framework' } framework_paths = { :name => 'Vendored.framework',
:input_path => '${PODS_ROOT}/Vendored/Vendored.framework',
:output_path => '${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Vendored.framework' }
resource_paths = ['${PODS_CONFIGURATION_BUILD_DIR}/TestResourceBundle.bundle'] resource_paths = ['${PODS_CONFIGURATION_BUILD_DIR}/TestResourceBundle.bundle']
@coconut_pod_target.stubs(:framework_paths).returns(framework_paths) @coconut_pod_target.stubs(:framework_paths).returns(framework_paths)
@coconut_pod_target.stubs(:resource_paths).returns(resource_paths) @coconut_pod_target.stubs(:resource_paths).returns(resource_paths)
...@@ -71,8 +82,31 @@ module Pod ...@@ -71,8 +82,31 @@ module Pod
] ]
end end
it 'excludes test framework and resource paths from dependent targets' do
framework_paths = { :name => 'TestVendored.framework',
:input_path => '${PODS_ROOT}/Vendored/TestVendored.framework',
:output_path => '${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TestVendored.framework' }
resource_paths = ['${PODS_CONFIGURATION_BUILD_DIR}/TestResourceBundle.bundle']
@banana_pod_target.stubs(:resource_paths).with(true).returns(resource_paths)
@banana_pod_target.stubs(:framework_paths).with(true).returns(framework_paths)
@banana_pod_target.expects(:resource_paths).with(false).returns([])
@banana_pod_target.expects(:framework_paths).with(false).returns([])
@coconut_pod_target.stubs(:dependent_targets).returns([@banana_pod_target])
PodTargetIntegrator.new(@target_installation_result).integrate!
@test_native_target.build_phases.count.should == 2
@test_native_target.build_phases.map(&:display_name).should == [
'[CP] Embed Pods Frameworks',
'[CP] Copy Pods Resources',
]
@test_native_target.build_phases[0].input_paths.should.be.empty
@test_native_target.build_phases[0].output_paths.should.be.empty
@test_native_target.build_phases[1].input_paths.should.be.empty
@test_native_target.build_phases[1].output_paths.should.should.be.empty
end
it 'integrates test native target with shell script phases' do it 'integrates test native target with shell script phases' do
@coconut_spec.test_specs.first.script_phase = { :name => 'Hello World', :script => 'echo "Hello World"' } @coconut_spec.test_specs.first.script_phase = { :name => 'Hello World',
:script => 'echo "Hello World"' }
PodTargetIntegrator.new(@target_installation_result).integrate! PodTargetIntegrator.new(@target_installation_result).integrate!
@test_native_target.build_phases.count.should == 3 @test_native_target.build_phases.count.should == 3
@test_native_target.build_phases[2].display_name.should == '[CP-User] Hello World' @test_native_target.build_phases[2].display_name.should == '[CP-User] Hello World'
......
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