Commit 0d44a527 authored by Samuel E. Giddins's avatar Samuel E. Giddins

[TargetIntegrator] Ensure the embed frameworks script is added when migrating…

[TargetIntegrator] Ensure the embed frameworks script is added when migrating and integrating via static libs
parent 64fe7412
......@@ -43,7 +43,7 @@ module Pod
XCConfigIntegrator.integrate(target, native_targets),
update_to_cocoapods_0_34,
update_to_cocoapods_0_37_1,
remove_embed_frameworks_script_phases,
update_to_cocoapods_0_39,
unless native_targets_to_integrate.empty?
add_pods_library
add_embed_frameworks_script_phase
......@@ -117,6 +117,25 @@ module Pod
end
end
# Adds the embed frameworks script when integrating as a static library.
#
# @return [Bool] whether any changes to the project were made.
#
# @todo This can be removed for CocoaPods 1.0
#
def update_to_cocoapods_0_39
targets_to_embed_in = native_targets_to_integrate.select do |target|
EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type)
end
requires_update = targets_to_embed_in.any? do |target|
!target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' }
end
if requires_update
add_embed_frameworks_script_phase
true
end
end
# Adds spec product reference to the frameworks build phase of the
# {TargetDefinition} integration libraries. Adds a file reference to
# the frameworks group of the project and adds it to the frameworks
......@@ -166,19 +185,6 @@ module Pod
end
end
# Delete 'Embed Pods Frameworks' Build Phases, if they exist
# and are not needed anymore due to not integrating the
# dependencies by frameworks.
#
# @return [Bool] whether any changes to the project were made.
#
def remove_embed_frameworks_script_phases
return false if target.requires_frameworks?
native_targets.any? do |native_target|
remove_embed_frameworks_script_phase(native_target)
end
end
# Delete a 'Embed Pods Frameworks' Copy Files Build Phase if present
#
# @param [PBXNativeTarget] native_target
......
......@@ -151,15 +151,14 @@ module Pod
phase.nil?.should == false
end
it 'removes existing embed frameworks build phases from integrated framework targets' do
it 'does not remove existing embed frameworks build phases from integrated framework targets' do
@pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate!
@pod_bundle.stubs(:requires_frameworks? => false)
target = @target_integrator.send(:native_targets).first
target.stubs(:symbol_type).returns(:framework)
@target_integrator.integrate!
phase = target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' }
phase.nil?.should == true
phase.should.not.be.nil
end
it 'does not remove existing embed frameworks build phases if frameworks are not used anymore' 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