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

[Installer] Automatically detect conflicts between framework names.

parent a6b6ea04
...@@ -19,6 +19,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre` ...@@ -19,6 +19,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[Kyle Fuller](https://github.com/kylef) [Kyle Fuller](https://github.com/kylef)
[#2996](https://github.com/CocoaPods/CocoaPods/issues/2996) [#2996](https://github.com/CocoaPods/CocoaPods/issues/2996)
* Automatically detect conflicts between framework names.
[Samuel Giddins](https://github.com/segiddins)
[#2943](https://github.com/CocoaPods/CocoaPods/issues/2943)
##### Bug Fixes ##### Bug Fixes
* Fixed installation for app-extension targets which had no dependencies * Fixed installation for app-extension targets which had no dependencies
......
...@@ -90,6 +90,7 @@ module Pod ...@@ -90,6 +90,7 @@ module Pod
resolve_dependencies resolve_dependencies
download_dependencies download_dependencies
determine_dependency_product_types determine_dependency_product_types
verify_no_duplicate_framework_names
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
...@@ -327,6 +328,20 @@ module Pod ...@@ -327,6 +328,20 @@ module Pod
end end
end end
def verify_no_duplicate_framework_names
aggregate_targets.each do |aggregate_target|
aggregate_target.user_build_configurations.keys.each do |config|
pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
vendored_frameworks = pod_targets.flat_map(&:file_accessors).flat_map(&:vendored_frameworks)
frameworks = vendored_frameworks.map { |fw| fw.basename('.framework') }
frameworks += pod_targets.select { |pt| pt.should_build? && pt.requires_frameworks? }.map(&:product_module_name)
duplicates = frameworks.group_by { |f| f }.select { |_, v| v.size > 1 }.keys
raise "The '#{aggregate_target.label}' target has frameworks with conflicting names: #{duplicates.to_sentence}." unless duplicates.empty?
end
end
end
# Performs any post-installation actions # Performs any post-installation actions
# #
# @return [void] # @return [void]
......
...@@ -49,6 +49,7 @@ module Pod ...@@ -49,6 +49,7 @@ module Pod
@installer.stubs(:resolve_dependencies) @installer.stubs(:resolve_dependencies)
@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(: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)
...@@ -144,6 +145,28 @@ module Pod ...@@ -144,6 +145,28 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe '#verify_no_duplicate_framework_names' do
it 'detects duplicate framework names' do
Sandbox::FileAccessor.any_instance.stubs(:vendored_frameworks).returns([Pathname('monkey.framework')])
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 { @installer.install! }.message.should.match /conflict.*monkey/
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