Commit 6dad677f authored by Samuel Giddins's avatar Samuel Giddins

[AggregateTarget] Cache relevant pod target arrays

parent 22344e39
...@@ -140,8 +140,7 @@ module Pod ...@@ -140,8 +140,7 @@ module Pod
# #
def self.links_dependency?(aggregate_target, pod_target) def self.links_dependency?(aggregate_target, pod_target)
return true if aggregate_target.nil? || aggregate_target.target_definition.inheritance == 'complete' return true if aggregate_target.nil? || aggregate_target.target_definition.inheritance == 'complete'
targets = aggregate_target.pod_targets - aggregate_target.search_paths_aggregate_targets.flat_map(&:pod_targets) aggregate_target.pod_targets_to_link.include?(pod_target)
targets.include?(pod_target)
end end
# Adds build settings for dynamic vendored frameworks and libraries. # Adds build settings for dynamic vendored frameworks and libraries.
......
...@@ -140,7 +140,7 @@ module Pod ...@@ -140,7 +140,7 @@ module Pod
# @return [Array<AggregateTarget>] The aggregate targets whose pods this # @return [Array<AggregateTarget>] The aggregate targets whose pods this
# target must be able to import, but will not directly link against. # target must be able to import, but will not directly link against.
# #
attr_accessor :search_paths_aggregate_targets attr_reader :search_paths_aggregate_targets
# @param [String] build_configuration The build configuration for which the # @param [String] build_configuration The build configuration for which the
# the pod targets should be returned. # the pod targets should be returned.
...@@ -149,11 +149,16 @@ module Pod ...@@ -149,11 +149,16 @@ module Pod
# configuration. # configuration.
# #
def pod_targets_for_build_configuration(build_configuration) def pod_targets_for_build_configuration(build_configuration)
pod_targets.select do |pod_target| @pod_targets_for_build_configuration ||= {}
@pod_targets_for_build_configuration[build_configuration] ||= pod_targets.select do |pod_target|
pod_target.include_in_build_config?(target_definition, build_configuration) pod_target.include_in_build_config?(target_definition, build_configuration)
end end
end end
def pod_targets_to_link
@pod_targets_to_link ||= pod_targets.to_set - search_paths_aggregate_targets.flat_map(&:pod_targets)
end
# @return [Array<Specification>] The specifications used by this aggregate target. # @return [Array<Specification>] The specifications used by this aggregate target.
# #
def specs def specs
...@@ -191,9 +196,7 @@ module Pod ...@@ -191,9 +196,7 @@ module Pod
@framework_paths_by_config ||= begin @framework_paths_by_config ||= begin
framework_paths_by_config = {} framework_paths_by_config = {}
user_build_configurations.keys.each do |config| user_build_configurations.keys.each do |config|
relevant_pod_targets = pod_targets.select do |pod_target| relevant_pod_targets = pod_targets_for_build_configuration(config)
pod_target.include_in_build_config?(target_definition, config)
end
framework_paths_by_config[config] = relevant_pod_targets.flat_map { |pt| pt.framework_paths(false) } framework_paths_by_config[config] = relevant_pod_targets.flat_map { |pt| pt.framework_paths(false) }
end end
framework_paths_by_config framework_paths_by_config
...@@ -208,8 +211,7 @@ module Pod ...@@ -208,8 +211,7 @@ module Pod
pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework? pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework?
end end
user_build_configurations.keys.each_with_object({}) do |config, resources_by_config| user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
resources_by_config[config] = relevant_pod_targets.flat_map do |pod_target| resources_by_config[config] = (relevant_pod_targets & pod_targets_for_build_configuration(config)).flat_map do |pod_target|
next [] unless pod_target.include_in_build_config?(target_definition, config)
(pod_target.resource_paths(false) + [bridge_support_file].compact).uniq (pod_target.resource_paths(false) + [bridge_support_file].compact).uniq
end end
end end
......
...@@ -497,7 +497,7 @@ module Pod ...@@ -497,7 +497,7 @@ module Pod
it 'should include inherited search paths' do it 'should include inherited search paths' do
# It's the responsibility of the analyzer to # It's the responsibility of the analyzer to
# populate this when the file is loaded. # populate this when the file is loaded.
@blank_target.search_paths_aggregate_targets = [@target] @blank_target.search_paths_aggregate_targets.replace [@target]
@xcconfig = @generator.generate @xcconfig = @generator.generate
@xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.be.nil @xcconfig.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.be.nil
end 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