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