Unverified Commit 7980d84d authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #7262 from amorde/duplicate_output_paths

Fix duplicate framework/resource output paths caused by the same output file name
parents 8525e9fd 0149ec97
...@@ -26,6 +26,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -26,6 +26,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Deduplicate output path file names for resources and frameworks
[Eric Amorde](https://github.com/amorde)
[#7259](https://github.com/CocoaPods/CocoaPods/issues/7259)
* Allow installation of a pod with its own Swift version on multiple targets * Allow installation of a pod with its own Swift version on multiple targets
[Dimitris Koutsogiorgas](https://github.com/dnkoutso) [Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7261](https://github.com/CocoaPods/CocoaPods/pull/7261) [#7261](https://github.com/CocoaPods/CocoaPods/pull/7261)
......
...@@ -287,7 +287,7 @@ module Pod ...@@ -287,7 +287,7 @@ module Pod
base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}' base_path = '${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}'
output_extension = TargetIntegrator.output_extension_for_resource(File.extname(input_path)) output_extension = TargetIntegrator.output_extension_for_resource(File.extname(input_path))
File.join(base_path, File.basename(input_path, File.extname(input_path)) + output_extension) File.join(base_path, File.basename(input_path, File.extname(input_path)) + output_extension)
end end.uniq
end end
TargetIntegrator.add_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths) TargetIntegrator.add_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
end end
...@@ -320,7 +320,7 @@ module Pod ...@@ -320,7 +320,7 @@ module Pod
output_paths = [] output_paths = []
unless framework_paths_by_config.all?(&:empty?) unless framework_paths_by_config.all?(&:empty?)
input_paths = [target.embed_frameworks_script_relative_path, *framework_paths_by_config.map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.flatten.compact] input_paths = [target.embed_frameworks_script_relative_path, *framework_paths_by_config.map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.flatten.compact]
output_paths = framework_paths_by_config.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact output_paths = framework_paths_by_config.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact.uniq
end end
TargetIntegrator.add_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths) TargetIntegrator.add_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
end end
......
...@@ -338,6 +338,29 @@ module Pod ...@@ -338,6 +338,29 @@ module Pod
) )
end end
it 'adds copy pods resources input and output paths without duplicates' do
resource_paths_by_config = {
'Debug' => [
'${PODS_CONFIGURATION_BUILD_DIR}/DebugLib/SomeBundle.bundle',
],
'Release' => [
'${PODS_CONFIGURATION_BUILD_DIR}/ReleaseLib/SomeBundle.bundle',
],
}
@pod_bundle.stubs(:resource_paths_by_config => resource_paths_by_config)
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == @copy_pods_resources_phase_name }
phase.input_paths.sort.should == %w(
${PODS_CONFIGURATION_BUILD_DIR}/DebugLib/SomeBundle.bundle
${PODS_CONFIGURATION_BUILD_DIR}/ReleaseLib/SomeBundle.bundle
${SRCROOT}/../Pods/Target\ Support\ Files/Pods/Pods-resources.sh
)
phase.output_paths.sort.should == %w(
${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SomeBundle.bundle
)
end
it 'does not add embed frameworks build phase input output paths with no frameworks' do it 'does not add embed frameworks build phase input output paths with no frameworks' do
@pod_bundle.stubs(:framework_paths_by_config => { 'Debug' => {}, 'Release' => {} }) @pod_bundle.stubs(:framework_paths_by_config => { 'Debug' => {}, 'Release' => {} })
@target_integrator.integrate! @target_integrator.integrate!
...@@ -391,6 +414,53 @@ module Pod ...@@ -391,6 +414,53 @@ module Pod
) )
end end
it 'adds embed frameworks build phase input and output paths for vendored and non vendored frameworks without duplicate' do
debug_vendored_framework = { :name => 'SomeFramework.framework',
:input_path => '${PODS_ROOT}/DebugVendoredFramework/ios/SomeFramework.framework',
:output_path => '${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SomeFramework.framework',
:dsym_name => 'SomeFramework.framework.dSYM',
:dsym_input_path => '${PODS_ROOT}/DebugVendoredFramework/ios/SomeFramework.framework.dSYM',
:dsym_output_path => '${DWARF_DSYM_FOLDER_PATH}/SomeFramework.framework.dSYM' }
debug_non_vendored_framework = { :name => 'CompiledFramework.framework',
:input_path => '${BUILT_PRODUCTS_DIR}/DebugCompiledFramework/CompiledFramework.framework',
:output_path => '${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CompiledFramework.framework' }
release_vendored_framework = { :name => 'ReleaseVendoredFramework.framework',
:input_path => '${PODS_ROOT}/ReleaseVendoredFramework/ios/SomeFramework.framework',
:output_path => '${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SomeFramework.framework',
:dsym_name => 'SomeFramework.framework.dSYM',
:dsym_input_path => '${PODS_ROOT}/ReleaseVendoredFramework/ios/SomeFramework.framework.dSYM',
:dsym_output_path => '${DWARF_DSYM_FOLDER_PATH}/SomeFramework.framework.dSYM' }
release_non_vendored_framework = { :name => 'CompiledFramework.framework',
:input_path => '${BUILT_PRODUCTS_DIR}/ReleaseCompiledFramework/CompiledFramework.framework',
:output_path => '${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CompiledFramework.framework' }
framework_paths_by_config = {
'Debug' => [debug_vendored_framework, debug_non_vendored_framework],
'Release' => [release_vendored_framework, release_non_vendored_framework],
}
@pod_bundle.stubs(:framework_paths_by_config => framework_paths_by_config)
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == @embed_framework_phase_name }
phase.input_paths.sort.should == %w(
${BUILT_PRODUCTS_DIR}/DebugCompiledFramework/CompiledFramework.framework
${BUILT_PRODUCTS_DIR}/ReleaseCompiledFramework/CompiledFramework.framework
${PODS_ROOT}/DebugVendoredFramework/ios/SomeFramework.framework
${PODS_ROOT}/DebugVendoredFramework/ios/SomeFramework.framework.dSYM
${PODS_ROOT}/ReleaseVendoredFramework/ios/SomeFramework.framework
${PODS_ROOT}/ReleaseVendoredFramework/ios/SomeFramework.framework.dSYM
${SRCROOT}/../Pods/Target\ Support\ Files/Pods/Pods-frameworks.sh
)
phase.output_paths.sort.should == %w(
${DWARF_DSYM_FOLDER_PATH}/SomeFramework.framework.dSYM
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CompiledFramework.framework
${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SomeFramework.framework
)
end
it 'adds a custom shell script phase' do it 'adds a custom shell script phase' do
@pod_bundle.target_definition.stubs(:script_phases).returns([:name => 'Custom Script', :script => 'echo "Hello World"']) @pod_bundle.target_definition.stubs(:script_phases).returns([:name => 'Custom Script', :script => 'echo "Hello World"'])
@target_integrator.integrate! @target_integrator.integrate!
......
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