Commit 91379dd0 authored by Dimitris Koutsogiorgas's avatar Dimitris Koutsogiorgas Committed by GitHub

Merge pull request #6787 from dnkoutso/analyzer_cache

Use a cache when figuring out if a pod target is test only
parents 18bcb87a d6138f8b
......@@ -45,6 +45,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Bug Fixes
* Use a cache when figuring out if a pod target is test only
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6787](https://github.com/CocoaPods/CocoaPods/pull/6787)
* Do not double add search paths to test xcconfig from parent
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#6767](https://github.com/CocoaPods/CocoaPods/pull/6767)
......
......@@ -46,6 +46,8 @@ module Pod
@update = false
@allow_pre_downloads = true
@has_dependencies = true
@test_pod_target_analyzer_cache = {}
@test_pod_target_key = Struct.new(:name, :pod_targets)
end
# Performs the analysis.
......@@ -430,8 +432,9 @@ module Pod
target.pod_targets = pod_targets.select do |pod_target|
target_definition_included = pod_target.target_definitions.include?(target_definition)
explicitly_defined_in_target_definition = target_definition.non_inherited_dependencies.map(&:name).include?(pod_target.name)
test_pod_target_only = pod_target_test_only?(pod_target, pod_targets)
target_definition_included && (explicitly_defined_in_target_definition || !test_pod_target_only)
next false unless target_definition_included
next true if explicitly_defined_in_target_definition
!pod_target_test_only?(pod_target, pod_targets)
end
target
......@@ -449,9 +452,14 @@ module Pod
# @return [Boolean] if the pod target is only referenced from test dependencies.
#
def pod_target_test_only?(pod_target, pod_targets)
source = pod_targets.any? { |pt| pt.dependent_targets.map(&:name).include?(pod_target.name) }
test = pod_targets.any? { |pt| pt.test_dependent_targets.map(&:name).include?(pod_target.name) }
!source && test
name = pod_target.name
key = @test_pod_target_key.new(name, pod_targets)
if @test_pod_target_analyzer_cache.key?(key)
return @test_pod_target_analyzer_cache[key]
end
source = pod_targets.any? { |pt| pt.dependent_targets.map(&:name).include?(name) }
test = pod_targets.any? { |pt| pt.test_dependent_targets.map(&:name).include?(name) }
@test_pod_target_analyzer_cache[key] = !source && test
end
# Setup the pod targets for an aggregate target. Deduplicates resulting
......
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