Commit a8eca8bb authored by Marius Rackwitz's avatar Marius Rackwitz Committed by Samuel Giddins

[TargetIntegrator] Migrate weak-linked integrations

parent 271f9e7b
......@@ -137,6 +137,30 @@ module Pod
end
end
# Reset the linking of the product reference to strong.
#
# @return [Bool] whether any changes to the project were made.
#
# @todo This can be removed for CocoaPods 1.0
#
def update_to_cocoapods_0_40
frameworks = user_project.frameworks_group
native_targets_to_embed_in.any? do |native_target|
build_phase = native_target.frameworks_build_phase
product_ref = frameworks.files.find { |f| f.path == target.product_name }
if product_ref
build_file = build_phase.build_file(product_ref)
if build_file \
&& build_file.settings.is_a?(Hash) \
&& build_file.settings['ATTRIBUTES'].is_a?(Array) \
&& build_file.settings['ATTRIBUTES'].include?('Weak')
build_file.settings = nil
end
end
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
......
......@@ -47,6 +47,17 @@ module Pod
phase.shell_script.strip.should == "\"${SRCROOT}/../Pods/Target Support Files/Pods/Pods-resources.sh\""
end
it 'fixes the "Link binary with libraries" build phase of legacy installations' do
@pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.frameworks_build_phase
build_file = phase.files.find { |f| f.file_ref.path == 'Pods.framework' }
build_file.settings = { 'ATTRIBUTES' => %w(Weak) }
@target_integrator.integrate!
build_file.settings.should.be.nil
end
it 'adds references to the Pods static libraries to the Frameworks group' do
@target_integrator.integrate!
@target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.be.nil
......
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