Commit 70441839 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4264 from CocoaPods/seg-migrate-embed-frameworks-script

[TargetIntegrator] Ensure the embed frameworks script is added to exi…
parents 4ee54d23 90e0fe7e
...@@ -127,11 +127,16 @@ module Pod ...@@ -127,11 +127,16 @@ module Pod
# @todo This can be removed for CocoaPods 1.0 # @todo This can be removed for CocoaPods 1.0
# #
def update_to_cocoapods_0_39 def update_to_cocoapods_0_39
requires_update = native_targets_to_embed_in.any? do |target| targets_to_embed = native_targets.select do |target|
!target.shell_script_build_phases.find { |bp| bp.name == 'Embed Pods Frameworks' } EMBED_FRAMEWORK_TARGET_TYPES.include?(target.symbol_type)
end
requires_update = targets_to_embed.any? do |target|
!target.shell_script_build_phases.find { |bp| bp.name == EMBED_FRAMEWORK_PHASE_NAME }
end end
if requires_update if requires_update
add_embed_frameworks_script_phase targets_to_embed.each do |native_target|
add_embed_frameworks_script_phase_to_target(native_target)
end
end end
frameworks = user_project.frameworks_group frameworks = user_project.frameworks_group
...@@ -190,12 +195,16 @@ module Pod ...@@ -190,12 +195,16 @@ module Pod
# #
def add_embed_frameworks_script_phase def add_embed_frameworks_script_phase
native_targets_to_embed_in.each do |native_target| native_targets_to_embed_in.each do |native_target|
phase = create_or_update_build_phase(native_target, EMBED_FRAMEWORK_PHASE_NAME) add_embed_frameworks_script_phase_to_target(native_target)
script_path = target.embed_frameworks_script_relative_path
phase.shell_script = %("#{script_path}"\n)
end end
end end
def add_embed_frameworks_script_phase_to_target(native_target)
phase = create_or_update_build_phase(native_target, EMBED_FRAMEWORK_PHASE_NAME)
script_path = target.embed_frameworks_script_relative_path
phase.shell_script = %("#{script_path}"\n)
end
# Delete a 'Embed Pods Frameworks' Copy Files Build Phase if present # Delete a 'Embed Pods Frameworks' Copy Files Build Phase if present
# #
# @param [PBXNativeTarget] native_target # @param [PBXNativeTarget] native_target
......
Subproject commit 5d5cc41dd34abe88f20c797bd10a7a05bc76f33a Subproject commit e0b4cf0d8982adabdb5001536bfcb1b88a1e5534
...@@ -24,6 +24,9 @@ module Pod ...@@ -24,6 +24,9 @@ module Pod
@pod_bundle.xcconfigs['Debug'] = configuration @pod_bundle.xcconfigs['Debug'] = configuration
@pod_bundle.xcconfigs['Release'] = configuration @pod_bundle.xcconfigs['Release'] = configuration
@target_integrator = TargetIntegrator.new(@pod_bundle) @target_integrator = TargetIntegrator.new(@pod_bundle)
@target_integrator.private_methods.grep(/^update_to_cocoapods_/).each do |method|
@target_integrator.stubs(method)
end
end end
describe '#integrate!' do describe '#integrate!' do
...@@ -48,6 +51,7 @@ module Pod ...@@ -48,6 +51,7 @@ module Pod
end end
it 'fixes the "Link binary with libraries" build phase of legacy installations' do it 'fixes the "Link binary with libraries" build phase of legacy installations' do
@target_integrator.unstub(:update_to_cocoapods_0_39)
@pod_bundle.stubs(:requires_frameworks? => true) @pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate! @target_integrator.integrate!
target = @target_integrator.send(:native_targets).first target = @target_integrator.send(:native_targets).first
......
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