Commit 4ee54d23 authored by Samuel E. Giddins's avatar Samuel E. Giddins

Merge pull request #4137 from CocoaPods/mr-static-link-aggregate-target

[Installer] Always Link the AggregateTarget as static
parents bf62a31f 34db8c3f
......@@ -92,6 +92,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
## 0.39.0.beta.4 (2015-09-02)
##### Enhancements
* Always link the aggregate target as static to the user project.
[Marius Rackwitz](https://github.com/mrackwitz)
[#4137](https://github.com/CocoaPods/CocoaPods/pull/4137)
##### Bug Fixes
* Using vendored frameworks without a `Headers` directory will no longer cause a
......
......@@ -47,6 +47,7 @@ module Pod
'OTHER_LIBTOOLFLAGS' => '',
'PODS_ROOT' => '$(SRCROOT)',
'SKIP_INSTALL' => 'YES',
'MACH_O_TYPE' => 'staticlib',
}
super.merge(settings)
end
......
......@@ -132,8 +132,26 @@ module Pod
end
if requires_update
add_embed_frameworks_script_phase
true
end
frameworks = user_project.frameworks_group
native_targets.each 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
requires_update = true
end
end
end
requires_update
end
# Adds spec product reference to the frameworks build phase of the
......@@ -161,15 +179,8 @@ module Pod
target_basename = target.product_basename
new_product_ref = frameworks.files.find { |f| f.path == target.product_name } ||
frameworks.new_product_ref_for_target(target_basename, target.product_type)
build_file = build_phase.build_file(new_product_ref) ||
build_phase.build_file(new_product_ref) ||
build_phase.add_file_reference(new_product_ref, true)
if target.requires_frameworks?
# Weak link the aggregate target's product, because as it contains
# no symbols, it isn't copied into the app bundle. dyld will so
# never try to find the missing executable at runtime.
build_file.settings ||= {}
build_file.settings['ATTRIBUTES'] = ['Weak']
end
end
end
......
Subproject commit 2bc57fad4912e84ed1a82e3ba0b3153c4577b1b4
Subproject commit 5d5cc41dd34abe88f20c797bd10a7a05bc76f33a
......@@ -101,6 +101,13 @@ module Pod
end
end
it 'will be built as static library' do
@installer.install!
@installer.target.native_target.build_configurations.each do |config|
config.build_settings['MACH_O_TYPE'].should == 'staticlib'
end
end
it 'will be skipped when installing' do
@installer.install!
@installer.target.native_target.build_configurations.each do |config|
......
......@@ -47,17 +47,43 @@ 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.nil?
@target_integrator.send(:user_project)['Frameworks/libPods.a'].should.not.be.nil
end
it 'adds the libPods static library to the "Link binary with libraries" build phase of each target' do
@target_integrator.integrate!
target = @target_integrator.send(:native_targets).first
phase = target.frameworks_build_phase
ref = phase.files.find { |f| f.file_ref.path == 'libPods.a' }
ref.should.not.be.nil
build_file = phase.files.find { |f| f.file_ref.path == 'libPods.a' }
build_file.should.not.be.nil
end
it 'adds references to the Pods static framework to the Frameworks group' do
@pod_bundle.stubs(:requires_frameworks? => true)
@target_integrator.integrate!
@target_integrator.send(:user_project)['Frameworks/Pods.framework'].should.not.be.nil
end
it 'adds the Pods static framework to the "Link binary with libraries" build phase of each target' 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.should.not.be.nil
end
it 'adds a Copy Pods Resources build phase to each target' 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