Unverified Commit ae76d127 authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #7368 from dnkoutso/always_update_paths

Always update input/output paths even if they are empty
parents c0e41fa2 847d7a47
...@@ -22,6 +22,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -22,6 +22,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes ##### Bug Fixes
* Always update input/output paths even if they are empty
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#7368](https://github.com/CocoaPods/CocoaPods/pull/7368)
* Unique all available pre-release versions when displaying * Unique all available pre-release versions when displaying
[Samuel Giddins](https://github.com/segiddins) [Samuel Giddins](https://github.com/segiddins)
[#7353](https://github.com/CocoaPods/CocoaPods/pull/7353) [#7353](https://github.com/CocoaPods/CocoaPods/pull/7353)
......
...@@ -71,15 +71,11 @@ module Pod ...@@ -71,15 +71,11 @@ module Pod
# #
# @return [void] # @return [void]
# #
def add_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths = [], output_paths = []) def create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths = [], output_paths = [])
phase = TargetIntegrator.create_or_update_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME) phase = TargetIntegrator.create_or_update_build_phase(native_target, BUILD_PHASE_PREFIX + EMBED_FRAMEWORK_PHASE_NAME)
phase.shell_script = %("#{script_path}"\n) phase.shell_script = %("#{script_path}"\n)
unless input_paths.empty? phase.input_paths = input_paths
phase.input_paths = input_paths phase.output_paths = output_paths
end
unless output_paths.empty?
phase.output_paths = output_paths
end
end end
# Delete a 'Embed Pods Frameworks' Copy Files Build Phase if present # Delete a 'Embed Pods Frameworks' Copy Files Build Phase if present
...@@ -111,16 +107,12 @@ module Pod ...@@ -111,16 +107,12 @@ module Pod
# #
# @return [void] # @return [void]
# #
def add_copy_resources_script_phase_to_target(native_target, script_path, input_paths = [], output_paths = []) def create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths = [], output_paths = [])
phase_name = COPY_PODS_RESOURCES_PHASE_NAME phase_name = COPY_PODS_RESOURCES_PHASE_NAME
phase = TargetIntegrator.create_or_update_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name) phase = TargetIntegrator.create_or_update_build_phase(native_target, BUILD_PHASE_PREFIX + phase_name)
phase.shell_script = %("#{script_path}"\n) phase.shell_script = %("#{script_path}"\n)
unless input_paths.empty? phase.input_paths = input_paths
phase.input_paths = input_paths phase.output_paths = output_paths
end
unless output_paths.empty?
phase.output_paths = output_paths
end
end end
# Creates or update a shell script build phase for the given target. # Creates or update a shell script build phase for the given target.
...@@ -289,7 +281,7 @@ module Pod ...@@ -289,7 +281,7 @@ module Pod
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.uniq end.uniq
end end
TargetIntegrator.add_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths) TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
end end
end end
...@@ -322,7 +314,7 @@ module Pod ...@@ -322,7 +314,7 @@ module Pod
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.uniq 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.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
end end
end end
......
...@@ -64,7 +64,7 @@ module Pod ...@@ -64,7 +64,7 @@ module Pod
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
end end
UserProjectIntegrator::TargetIntegrator.add_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths) UserProjectIntegrator::TargetIntegrator.create_or_update_copy_resources_script_phase_to_target(native_target, script_path, input_paths, output_paths)
end end
# Find or create a 'Embed Pods Frameworks' Copy Files Build Phase # Find or create a 'Embed Pods Frameworks' Copy Files Build Phase
...@@ -81,7 +81,7 @@ module Pod ...@@ -81,7 +81,7 @@ module Pod
input_paths = [script_path, *framework_paths.map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.flatten.compact] input_paths = [script_path, *framework_paths.map { |fw| [fw[:input_path], fw[:dsym_input_path]] }.flatten.compact]
output_paths = framework_paths.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact output_paths = framework_paths.map { |fw| [fw[:output_path], fw[:dsym_output_path]] }.flatten.compact
end end
UserProjectIntegrator::TargetIntegrator.add_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths) UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(native_target, script_path, input_paths, output_paths)
end end
# @return [String] the message that should be displayed for the target # @return [String] the message that should be displayed for the target
......
...@@ -370,6 +370,29 @@ module Pod ...@@ -370,6 +370,29 @@ module Pod
phase.output_paths.should.be.empty phase.output_paths.should.be.empty
end end
it 'updates embed frameworks phase if it becomes empty' do
debug_non_vendored_framework = { :name => 'DebugCompiledFramework.framework',
:input_path => '${BUILT_PRODUCTS_DIR}/DebugCompiledFramework/DebugCompiledFramework.framework',
:output_path => '${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/DebugCompiledFramework.framework' }
framework_paths_by_config = {
'Debug' => [debug_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/DebugCompiledFramework.framework
${SRCROOT}/../Pods/Target\ Support\ Files/Pods/Pods-frameworks.sh
)
# Now pretend the same target has no more framework paths, it should update the targets input/output paths
@pod_bundle.stubs(: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.be.empty
end
it 'adds embed frameworks build phase input and output paths for vendored and non vendored frameworks' do it 'adds embed frameworks build phase input and output paths for vendored and non vendored frameworks' do
debug_vendored_framework = { :name => 'DebugVendoredFramework.framework', debug_vendored_framework = { :name => 'DebugVendoredFramework.framework',
:input_path => '${PODS_ROOT}/DebugVendoredFramework/ios/DebugVendoredFramework.framework', :input_path => '${PODS_ROOT}/DebugVendoredFramework/ios/DebugVendoredFramework.framework',
......
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