Commit ac9250e4 authored by Samuel Giddins's avatar Samuel Giddins Committed by GitHub

Merge pull request #5837 from dnkoutso/master

Cache result of uses_swift and should_build
parents 7bef87f9 49f6b100
......@@ -8,7 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
##### Enhancements
* None.
* Cache result of uses_swift and should_build to speed up pod install.
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#5837](https://github.com/CocoaPods/CocoaPods/pull/5837)
##### Bug Fixes
......
......@@ -141,9 +141,12 @@ module Pod
# A target should not be build if it has no source files.
#
def should_build?
source_files = file_accessors.flat_map(&:source_files)
source_files -= file_accessors.flat_map(&:headers)
!source_files.empty?
return @should_build if defined? @should_build
@should_build = begin
source_files = file_accessors.flat_map(&:source_files)
source_files -= file_accessors.flat_map(&:headers)
!source_files.empty?
end
end
# @return [Array<Specification::Consumer>] the specification consumers for
......@@ -156,8 +159,11 @@ module Pod
# @return [Boolean] Whether the target uses Swift code
#
def uses_swift?
file_accessors.any? do |file_accessor|
file_accessor.source_files.any? { |sf| sf.extname == '.swift' }
return @uses_swift if defined? @uses_swift
@uses_swift = begin
file_accessors.any? do |file_accessor|
file_accessor.source_files.any? { |sf| sf.extname == '.swift' }
end
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