From 5f4a8bd977f5291946ccc5ae6aa9cdb737bfb547 Mon Sep 17 00:00:00 2001 From: Case Taintor Date: Sat, 5 Oct 2024 10:08:13 +0200 Subject: [PATCH 1/2] Provides a config option to ignore warnings about Xcode being outdated --- Library/Homebrew/cmd/doctor.rb | 4 ++++ Library/Homebrew/env_config.rb | 4 ++++ Library/Homebrew/extend/os/mac/diagnostic.rb | 2 ++ 3 files changed, 10 insertions(+) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index a273921d8e34a..d843f0eaf3eb7 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -30,6 +30,10 @@ class Doctor < AbstractCommand def run Homebrew.inject_dump_stats!(Diagnostic::Checks, /^check_*/) if args.audit_debug? + # While it is probably OK to run an outdated Xcode for normal operations, + # it's good to know if we have an outdated Xcode when running `brew doctor`. + ENV.delete("HOMEBREW_NO_WARN_OUTDATED_XCODE") + checks = Diagnostic::Checks.new(verbose: args.verbose?) if args.list_checks? diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index bb185001b30a5..d0411830b744a 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -397,6 +397,10 @@ module EnvConfig "from homebrew-core.", boolean: true, }, + HOMEBREW_NO_WARN_OUTDATED_XCODE: { + description: "If set, Homebrew will not warn about using outdated (but still compatible) Xcode versions.", + boolean: true, + }, HOMEBREW_PIP_INDEX_URL: { description: "If set, `brew install` will use this URL to download PyPI package resources.", default_text: "`https://pypi.org/simple`.", diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index fa714f68ec56e..a162711f0b93e 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -139,6 +139,8 @@ def check_xcode_up_to_date # Homebrew/brew is currently using. return if GitHub::Actions.env_set? + return if ENV["HOMEBREW_NO_WARN_OUTDATED_XCODE"] + # With fake El Capitan for Portable Ruby, we are intentionally not using Xcode 8. # This is because we are not using the CLT and Xcode 8 has the 10.12 SDK. return if ENV["HOMEBREW_FAKE_MACOS"] From 0347687969feee2f2d11a5d749b68b31238855fb Mon Sep 17 00:00:00 2001 From: Case Taintor Date: Sat, 5 Oct 2024 16:22:43 +0200 Subject: [PATCH 2/2] uses the Homebrew environment accessor Co-authored-by: Carlo Cabrera --- Library/Homebrew/extend/os/mac/diagnostic.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb index a162711f0b93e..232596f36f5ca 100644 --- a/Library/Homebrew/extend/os/mac/diagnostic.rb +++ b/Library/Homebrew/extend/os/mac/diagnostic.rb @@ -139,7 +139,7 @@ def check_xcode_up_to_date # Homebrew/brew is currently using. return if GitHub::Actions.env_set? - return if ENV["HOMEBREW_NO_WARN_OUTDATED_XCODE"] + return if Homebrew::EnvConfig.no_warn_outdated_xcode? # With fake El Capitan for Portable Ruby, we are intentionally not using Xcode 8. # This is because we are not using the CLT and Xcode 8 has the 10.12 SDK.