Skip to content

Commit

Permalink
Cache target definition label value
Browse files Browse the repository at this point in the history
  • Loading branch information
dnkoutso committed Jun 20, 2017
1 parent f085263 commit f5b34bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@

##### Bug Fixes

* Cache target definition label value
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#387](https://github.com/CocoaPods/Core/pull/387)

* Cache version result for each pod and segments
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#385](https://github.com/CocoaPods/Core/pull/385)
Expand Down
16 changes: 9 additions & 7 deletions lib/cocoapods-core/podfile/target_definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def initialize(name, parent, internal_hash = nil)
@internal_hash = internal_hash || {}
@parent = parent
@children = []
@label = nil
self.name ||= name
if parent.is_a?(TargetDefinition)
parent.children << self
Expand Down Expand Up @@ -106,13 +107,13 @@ def empty?
# name.
#
def label
if root? && name == 'Pods'
'Pods'
elsif exclusive? || parent.nil?
"Pods-#{name}"
else
"#{parent.label}-#{name}"
end
@label ||= if root? && name == 'Pods'
'Pods'
elsif exclusive? || parent.nil?
"Pods-#{name}"
else
"#{parent.label}-#{name}"
end
end

alias_method :to_s, :label
Expand Down Expand Up @@ -145,6 +146,7 @@ def name
# @return [void]
#
def name=(name)
@label = nil
set_hash_value('name', name)
end

Expand Down

0 comments on commit f5b34bc

Please sign in to comment.