Commit c3545057 authored by Ben Asher's avatar Ben Asher

Added spec for removing embed phases on upgrade

- More app extension -> embedded target
parent f2118095
...@@ -57,7 +57,7 @@ module Pod ...@@ -57,7 +57,7 @@ module Pod
add_pods_library add_pods_library
add_embed_frameworks_script_phase add_embed_frameworks_script_phase
remove_embed_frameworks_script_phase_from_app_extensions remove_embed_frameworks_script_phase_from_embedded_targets
add_copy_resources_script_phase add_copy_resources_script_phase
add_check_manifest_lock_script_phase add_check_manifest_lock_script_phase
end end
...@@ -114,13 +114,13 @@ module Pod ...@@ -114,13 +114,13 @@ module Pod
end end
end end
# Removes the embed frameworks build phase from app extension targets # Removes the embed frameworks build phase from embedded targets
# #
# @note Older versions of CocoaPods would add this build phase to embedded # @note Older versions of CocoaPods would add this build phase to embedded
# targets. They should be removed on upgrade because embedded targets # targets. They should be removed on upgrade because embedded targets
# will have their frameworks embedded in their host targets. # will have their frameworks embedded in their host targets.
# #
def remove_embed_frameworks_script_phase_from_app_extensions def remove_embed_frameworks_script_phase_from_embedded_targets
native_targets.each do |native_target| native_targets.each do |native_target|
if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type if AggregateTarget::EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES.include? native_target.symbol_type
remove_embed_frameworks_script_phase(native_target) remove_embed_frameworks_script_phase(native_target)
......
...@@ -202,6 +202,42 @@ module Pod ...@@ -202,6 +202,42 @@ module Pod
phase = target.shell_script_build_phases.find { |bp| bp.name == @embed_framework_phase_name } phase = target.shell_script_build_phases.find { |bp| bp.name == @embed_framework_phase_name }
phase.nil?.should == false phase.nil?.should == false
end end
it 'removes embed frameworks build phases from app extension targets' 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_framework_phase_name }
phase.nil?.should == false
target.stubs(:symbol_type).returns(:app_extension)
@target_integrator.integrate!
phase = target.shell_script_build_phases.find { |bp| bp.name == @embed_framework_phase_name }
phase.nil?.should == true
end
it 'removes embed frameworks build phases from watch extension targets' 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_framework_phase_name }
phase.nil?.should == false
target.stubs(:symbol_type).returns(:watch_extension)
@target_integrator.integrate!
phase = target.shell_script_build_phases.find { |bp| bp.name == @embed_framework_phase_name }
phase.nil?.should == true
end
it 'removes embed frameworks build phases from framework targets' 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_framework_phase_name }
phase.nil?.should == false
target.stubs(:symbol_type).returns(:framework)
@target_integrator.integrate!
phase = target.shell_script_build_phases.find { |bp| bp.name == @embed_framework_phase_name }
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