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

[AggregateTarget] Cache relevant pod target arrays

parent 22344e39
......@@ -140,8 +140,7 @@ module Pod
#
def self.links_dependency?(aggregate_target, pod_target)
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)
targets.include?(pod_target)
aggregate_target.pod_targets_to_link.include?(pod_target)
end
# Adds build settings for dynamic vendored frameworks and libraries.
......
......@@ -140,7 +140,7 @@ module Pod
# @return [Array<AggregateTarget>] The aggregate targets whose pods this
# 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
# the pod targets should be returned.
......@@ -149,11 +149,16 @@ module Pod
# 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)
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.
#
def specs
......@@ -191,9 +196,7 @@ module Pod
@framework_paths_by_config ||= begin
framework_paths_by_config = {}
user_build_configurations.keys.each do |config|
relevant_pod_targets = pod_targets.select do |pod_target|
pod_target.include_in_build_config?(target_definition, config)
end
relevant_pod_targets = pod_targets_for_build_configuration(config)
framework_paths_by_config[config] = relevant_pod_targets.flat_map { |pt| pt.framework_paths(false) }
end
framework_paths_by_config
......@@ -208,8 +211,7 @@ module Pod
pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework?
end
user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
resources_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
next [] unless pod_target.include_in_build_config?(target_definition, config)
resources_by_config[config] = (relevant_pod_targets & pod_targets_for_build_configuration(config)).flat_map do |pod_target|
(pod_target.resource_paths(false) + [bridge_support_file].compact).uniq
end
end
......
......@@ -497,7 +497,7 @@ module Pod
it 'should include inherited search paths' do
# It's the responsibility of the analyzer to
# 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.to_hash['FRAMEWORK_SEARCH_PATHS'].should.not.be.nil
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