Unverified Commit b224cfec authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by Samuel Giddins

Merge pull request #7688 from dnkoutso/fix_resource_framework_paths

Do not include test dependencies input and output paths

(cherry picked from commit 781d5047)

# Conflicts:
#	spec/unit/installer/xcode/pods_project_generator/pod_target_integrator_spec.rb
parent 3acc7034
......@@ -13,6 +13,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### 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
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7589](https://github.com/CocoaPods/CocoaPods/issues/7589)
......
......@@ -52,7 +52,10 @@ module Pod
def add_copy_resources_script_phase(native_target)
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)}"
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 = []
output_paths = []
unless resource_paths.empty?
......@@ -71,7 +74,11 @@ module Pod
def add_embed_frameworks_script_phase(native_target)
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)}"
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 = []
output_paths = []
unless framework_paths.empty?
......
......@@ -10,6 +10,8 @@ module Pod
@project = Pod::Project.new(config.sandbox.project_path)
@project.save
@target_definition = fixture_target_definition
@banana_spec = fixture_spec('banana-lib/BananaLib.podspec')
@banana_pod_target = PodTarget.new([@banana_spec], [@target_definition], config.sandbox)
@coconut_spec = fixture_spec('coconut-lib/CoconutLib.podspec')
@coconut_pod_target = PodTarget.new([@coconut_spec, *@coconut_spec.recursive_subspecs], [@target_definition], config.sandbox)
@native_target = stub('NativeTarget', :shell_script_build_phases => [], :build_phases => [], :project => @project)
......@@ -31,7 +33,8 @@ module Pod
end
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|
"${PODS_CONFIGURATION_BUILD_DIR}/DebugLib/DebugLibPng#{i}.png"
end
......@@ -46,7 +49,9 @@ module Pod
end
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']
@coconut_pod_target.stubs(:framework_paths).returns(framework_paths)
@coconut_pod_target.stubs(:resource_paths).returns(resource_paths)
......@@ -72,8 +77,31 @@ module Pod
]
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(@coconut_pod_target).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
@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(@coconut_pod_target).integrate!
@test_native_target.build_phases.count.should == 3
@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