Commit 7c4a1c58 authored by Boris Bügling's avatar Boris Bügling Committed by Marius Rackwitz

Remove "Embed Pods Frameworks" build phase if no longer needed.

parent 201c13f8
...@@ -31,6 +31,7 @@ module Pod ...@@ -31,6 +31,7 @@ module Pod
project_is_dirty = [ project_is_dirty = [
XCConfigIntegrator.integrate(target, native_targets), XCConfigIntegrator.integrate(target, native_targets),
update_to_cocoapods_0_34, update_to_cocoapods_0_34,
remove_embed_frameworks_script_phases,
unless native_targets_to_integrate.empty? unless native_targets_to_integrate.empty?
add_pods_library add_pods_library
add_embed_frameworks_script_phase if target.requires_frameworks? add_embed_frameworks_script_phase if target.requires_frameworks?
...@@ -145,6 +146,26 @@ module Pod ...@@ -145,6 +146,26 @@ module Pod
end end
end end
# Delete 'Embed Pods Frameworks' Build Phases if they exist
#
# @return [void]
#
def remove_embed_frameworks_script_phases
return false if target.requires_frameworks?
phase_name = 'Embed Pods Frameworks'
result = false
native_targets.each do |native_target|
embed_build_phase = native_target.shell_script_build_phases.find { |bp| bp.name == phase_name }
next unless embed_build_phase.present?
native_target.build_phases.delete(embed_build_phase)
result = true
end
result
end
# Adds a shell script build phase responsible to copy the resources # Adds a shell script build phase responsible to copy the resources
# generated by the TargetDefinition to the bundle of the product of the # generated by the TargetDefinition to the bundle of the product of the
# targets. # targets.
......
...@@ -100,6 +100,31 @@ module Pod ...@@ -100,6 +100,31 @@ module Pod
@target_integrator.send(:user_project).expects(:save).never @target_integrator.send(:user_project).expects(:save).never
@target_integrator.integrate! @target_integrator.integrate!
end end
it 'adds an embed frameworks build phase if frameworks are used' do
@pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' }
phase.nil?.should == false
end
it 'does not add an embed frameworks build phase by default' do
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' }
phase.nil?.should == true
end
it 'removes existing embed frameworks build phases if frameworks are not used anymore' do
@pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate!
@pod_bundle.stubs(:requires_frameworks? => false)
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' }
phase.nil?.should == true
end
end end
describe 'Private helpers' do describe 'Private helpers' do
......
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