From 08e518eb2fa400273c85b3319201268bca312086 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sun, 29 Sep 2024 09:19:00 +0800 Subject: [PATCH] test_formulae: relax cache invalidation criteria We don't need to throw out our cached bottle if the only dependencies that have changed are build- or test-only. --- lib/test_formulae.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/test_formulae.rb b/lib/test_formulae.rb index cacc3b32..a41f00f9 100644 --- a/lib/test_formulae.rb +++ b/lib/test_formulae.rb @@ -209,7 +209,15 @@ def artifact_cache_valid?(formula, formulae_dependents: false) return false if sha.blank? return false unless no_diff?(formula, sha) - formula.recursive_dependencies.all? do |dep| + recursive_dependencies = if formulae_dependents + formula.recursive_dependencies + else + formula.recursive_dependencies do |_, dep| + Dependency.prune if dep.build? || dep.test? + end + end + + recursive_dependencies.all? do |dep| no_diff?(dep.to_formula, sha) end end