Commit 245b8dd9 authored by Samuel Giddins's avatar Samuel Giddins

[PodTarget] Slightly speed up #should_build?

parent 6c8b9cb3
...@@ -162,17 +162,18 @@ module Pod ...@@ -162,17 +162,18 @@ module Pod
# to this target. # to this target.
attr_reader :test_resource_bundle_targets attr_reader :test_resource_bundle_targets
# @return [Bool] Whether or not this target should be build. # @return [Bool] Whether or not this target should be built.
# #
# A target should not be build if it has no source files. # A target should not be built if it has no source files.
# #
def should_build? def should_build?
return @should_build if defined? @should_build return @should_build if defined? @should_build
@should_build = begin
return @should_build = true if contains_script_phases?
source_files = file_accessors.flat_map(&:source_files) source_files = file_accessors.flat_map(&:source_files)
source_files -= file_accessors.flat_map(&:headers) source_files -= file_accessors.flat_map(&:headers)
!source_files.empty? || contains_script_phases? @should_build = !source_files.empty?
end
end end
# @return [Array<Specification::Consumer>] the specification consumers for # @return [Array<Specification::Consumer>] the specification consumers for
...@@ -196,7 +197,7 @@ module Pod ...@@ -196,7 +197,7 @@ module Pod
# @return [Array<Hash{Symbol=>String}>] An array of hashes where each hash represents a single script phase. # @return [Array<Hash{Symbol=>String}>] An array of hashes where each hash represents a single script phase.
# #
def script_phases def script_phases
spec_consumers.map(&:script_phases).flatten spec_consumers.flat_map(&:script_phases)
end end
# @return [Boolean] Whether the target contains any script phases. # @return [Boolean] Whether the target contains any script phases.
......
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