From be2834ace8b760ff6ff73775d15c8d6d6a85b653 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Fri, 15 Sep 2023 03:08:22 +0100 Subject: [PATCH] formula: add global caching for `declared_runtime_dependencies` --- Library/Homebrew/formula.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index b764cfb5d9018..329623be703be 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -2579,7 +2579,8 @@ def setup_home(home) # Returns a list of Dependency objects that are declared in the formula. # @private def declared_runtime_dependencies - recursive_dependencies do |_, dependency| + cache_key = "Formula#declared_runtime_dependencies" unless build.any_args_or_options? + Dependency.expand(self, cache_key: cache_key) do |_, dependency| Dependency.prune if dependency.build? next if dependency.required?