Merge pull request #11454 from Rylan12/fix-uses-caching
dependency: don't merge formula and cask cache in `::expand`
This commit is contained in:
commit
f7b1ccfcf6
@ -96,7 +96,7 @@ class Dependency
|
|||||||
|
|
||||||
if cache_key.present?
|
if cache_key.present?
|
||||||
cache[cache_key] ||= {}
|
cache[cache_key] ||= {}
|
||||||
return cache[cache_key][dependent.full_name].dup if cache[cache_key][dependent.full_name]
|
return cache[cache_key][cache_id dependent].dup if cache[cache_key][cache_id dependent]
|
||||||
end
|
end
|
||||||
|
|
||||||
expanded_deps = []
|
expanded_deps = []
|
||||||
@ -122,7 +122,7 @@ class Dependency
|
|||||||
end
|
end
|
||||||
|
|
||||||
expanded_deps = merge_repeats(expanded_deps)
|
expanded_deps = merge_repeats(expanded_deps)
|
||||||
cache[cache_key][dependent.full_name] = expanded_deps.dup if cache_key.present?
|
cache[cache_key][cache_id dependent] = expanded_deps.dup if cache_key.present?
|
||||||
expanded_deps
|
expanded_deps
|
||||||
ensure
|
ensure
|
||||||
@expand_stack.pop
|
@expand_stack.pop
|
||||||
@ -170,6 +170,10 @@ class Dependency
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def cache_id(dependent)
|
||||||
|
"#{dependent.full_name}_#{dependent.class}"
|
||||||
|
end
|
||||||
|
|
||||||
def merge_tags(deps)
|
def merge_tags(deps)
|
||||||
other_tags = deps.flat_map(&:option_tags).uniq
|
other_tags = deps.flat_map(&:option_tags).uniq
|
||||||
other_tags << :test if deps.flat_map(&:tags).include?(:test)
|
other_tags << :test if deps.flat_map(&:tags).include?(:test)
|
||||||
|
|||||||
@ -223,7 +223,7 @@ class Requirement
|
|||||||
def expand(dependent, cache_key: nil, &block)
|
def expand(dependent, cache_key: nil, &block)
|
||||||
if cache_key.present?
|
if cache_key.present?
|
||||||
cache[cache_key] ||= {}
|
cache[cache_key] ||= {}
|
||||||
return cache[cache_key][dependent.full_name].dup if cache[cache_key][dependent.full_name]
|
return cache[cache_key][cache_id dependent].dup if cache[cache_key][cache_id dependent]
|
||||||
end
|
end
|
||||||
|
|
||||||
reqs = Requirements.new
|
reqs = Requirements.new
|
||||||
@ -239,7 +239,7 @@ class Requirement
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
cache[cache_key][dependent.full_name] = reqs.dup if cache_key.present?
|
cache[cache_key][cache_id dependent] = reqs.dup if cache_key.present?
|
||||||
reqs
|
reqs
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -258,5 +258,11 @@ class Requirement
|
|||||||
def prune
|
def prune
|
||||||
throw(:prune, true)
|
throw(:prune, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def cache_id(dependent)
|
||||||
|
"#{dependent.full_name}_#{dependent.class}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user