Commit 8062c2ba authored by Marius Rackwitz's avatar Marius Rackwitz

[Config] Allow to opt-out of target deduplication

parent fcdc97c7
......@@ -19,6 +19,7 @@ module Pod
:clean => true,
:integrate_targets => true,
:deduplicate_targets => true,
:lock_pod_source => true,
:new_version_message => ENV['COCOAPODS_SKIP_UPDATE_MESSAGE'].nil?,
......@@ -89,6 +90,11 @@ module Pod
attr_accessor :integrate_targets
alias_method :integrate_targets?, :integrate_targets
# @return [Bool] Whether CocoaPods should deduplicate pod targets.
#
attr_accessor :deduplicate_targets
alias_method :deduplicate_targets?, :deduplicate_targets
# @return [Bool] Whether the installer should skip the repos update.
#
attr_accessor :skip_repo_update
......
......@@ -284,20 +284,24 @@ module Pod
def generate_pod_targets(target, specs, pod_targets)
grouped_specs = specs.group_by(&:root).values.uniq
grouped_specs.map do |pod_specs|
# If there are no or already multiple pod targets with a common root,
# or the one which exists differs in the activated subspec set, then
# we need to generate another pod target
root_spec = pod_specs.first.root
common_root_pod_targets = pod_targets.select { |t| t.root_spec == root_spec }
if common_root_pod_targets.count != 1 || common_root_pod_targets.first.specs != pod_specs
pod_target = generate_pod_target(target, pod_specs)
unless common_root_pod_targets.empty?
common_root_pod_targets.each { |t| t.scoped = true }
pod_target.scoped = true
if config.deduplicate_targets?
# If there are no or already multiple pod targets with a common root,
# or the one which exists differs in the activated subspec set, then
# we need to generate another pod target
root_spec = pod_specs.first.root
common_root_pod_targets = pod_targets.select { |t| t.root_spec == root_spec }
if common_root_pod_targets.count != 1 || common_root_pod_targets.first.specs != pod_specs
pod_target = generate_pod_target(target, pod_specs)
unless common_root_pod_targets.empty?
common_root_pod_targets.each { |t| t.scoped = true }
pod_target.scoped = true
end
pod_target
else
common_root_pod_targets.first
end
pod_target
else
common_root_pod_targets.first
generate_pod_target(target, pod_specs).scoped
end
end
end
......
......@@ -184,6 +184,14 @@ module Pod
@config.should.lock_pod_source
end
it 'integrates a user target' do
@config.should.integrate_targets
end
it 'de-duplicates targets' do
@config.should.deduplicate_targets
end
it 'returns the cache root' do
@config.cache_root.should == Pathname.new(File.join(ENV['HOME'], 'Library/Caches/CocoaPods'))
end
......
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