Commit cd82a3a8 authored by Kyle Fuller's avatar Kyle Fuller

Merge pull request #3160 from CocoaPods/seg-transitive-static-libs

[Installer] Reject installation if a static library is used as a transit...
parents c3821aa3 532c6e94
...@@ -35,6 +35,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -35,6 +35,11 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Boris Bügling](https://github.com/neonichu) [Boris Bügling](https://github.com/neonichu)
[#2963](https://github.com/CocoaPods/CocoaPods/issues/2963) [#2963](https://github.com/CocoaPods/CocoaPods/issues/2963)
* Reject installation if a static library is used as a transitive dependency
while integrating Pods as frameworks.
[Samuel Giddins](https://github.com/segiddins)
[#2926](https://github.com/CocoaPods/CocoaPods/issues/2926)
##### Bug Fixes ##### Bug Fixes
* Added support for .tpp C++ header files in specs (previously were getting * Added support for .tpp C++ header files in specs (previously were getting
......
...@@ -91,6 +91,7 @@ module Pod ...@@ -91,6 +91,7 @@ module Pod
download_dependencies download_dependencies
determine_dependency_product_types determine_dependency_product_types
verify_no_duplicate_framework_names verify_no_duplicate_framework_names
verify_no_static_framework_transitive_dependencies
generate_pods_project generate_pods_project
integrate_user_project if config.integrate_targets? integrate_user_project if config.integrate_targets?
perform_post_install_actions perform_post_install_actions
...@@ -345,6 +346,29 @@ module Pod ...@@ -345,6 +346,29 @@ module Pod
end end
end end
def verify_no_static_framework_transitive_dependencies
aggregate_targets.each do |aggregate_target|
next unless aggregate_target.requires_frameworks?
aggregate_target.user_build_configurations.keys.each do |config|
pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
dependencies = pod_targets.flat_map(&:dependencies)
dependended_upon_targets = pod_targets.select { |t| dependencies.include?(t.pod_name) }
static_libs = dependended_upon_targets.flat_map(&:file_accessors).flat_map do |fa|
static_frameworks = fa.vendored_frameworks.reject { |fw| `file #{fw + fw.basename('.framework')} 2>&1` =~ /dynamically linked/ }
fa.vendored_libraries + static_frameworks
end
unless static_libs.empty?
raise Informative, "The '#{aggregate_target.label}' target has " \
"transitive dependencies that include static binaries: (#{static_libs.to_sentence})"
end
end
end
end
# Performs any post-installation actions # Performs any post-installation actions
# #
# @return [void] # @return [void]
......
...@@ -50,6 +50,7 @@ module Pod ...@@ -50,6 +50,7 @@ module Pod
@installer.stubs(:download_dependencies) @installer.stubs(:download_dependencies)
@installer.stubs(:determine_dependency_product_types) @installer.stubs(:determine_dependency_product_types)
@installer.stubs(:verify_no_duplicate_framework_names) @installer.stubs(:verify_no_duplicate_framework_names)
@installer.stubs(:verify_no_static_framework_transitive_dependencies)
@installer.stubs(:generate_pods_project) @installer.stubs(:generate_pods_project)
@installer.stubs(:integrate_user_project) @installer.stubs(:integrate_user_project)
@installer.stubs(:run_plugins_post_install_hooks) @installer.stubs(:run_plugins_post_install_hooks)
...@@ -118,6 +119,7 @@ module Pod ...@@ -118,6 +119,7 @@ module Pod
describe '#determine_dependency_product_type' do describe '#determine_dependency_product_type' do
it 'does propagate that frameworks are required to all pod targets' do it 'does propagate that frameworks are required to all pod targets' do
Sandbox::FileAccessor.any_instance.stubs(:vendored_libraries).returns([])
fixture_path = ROOT + 'spec/fixtures' fixture_path = ROOT + 'spec/fixtures'
config.repos_dir = fixture_path + 'spec-repos' config.repos_dir = fixture_path + 'spec-repos'
podfile = Pod::Podfile.new do podfile = Pod::Podfile.new do
...@@ -167,6 +169,28 @@ module Pod ...@@ -167,6 +169,28 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe '#verify_no_static_framework_transitive_dependencies' do
it 'detects transitive static dependencies' do
Sandbox::FileAccessor.any_instance.stubs(:vendored_libraries).returns([Pathname('libThing.a')])
fixture_path = ROOT + 'spec/fixtures'
config.repos_dir = fixture_path + 'spec-repos'
podfile = Pod::Podfile.new do
platform :ios, '8.0'
xcodeproj 'SampleProject/SampleProject'
pod 'BananaLib', :path => (fixture_path + 'banana-lib').to_s
pod 'OrangeFramework', :path => (fixture_path + 'orange-framework').to_s
pod 'monkey', :path => (fixture_path + 'monkey').to_s
end
lockfile = generate_lockfile
config.integrate_targets = false
@installer = Installer.new(config.sandbox, podfile, lockfile)
should.raise(Informative) { @installer.install! }.message.should.match /transitive.*libThing/
end
end
#-------------------------------------------------------------------------#
describe 'Dependencies Resolution' do describe 'Dependencies Resolution' do
describe '#analyze' do describe '#analyze' do
it 'prints a warning if the version of the Lockfile is higher than the one of the executable' do it 'prints a warning if the version of the Lockfile is higher than the one of the executable' 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