Merge pull request #20632 from Homebrew/gcc_version

development_tools: make gcc_version public api
This commit is contained in:
Mike McQuaid 2025-09-04 07:47:18 +00:00 committed by GitHub
commit 6e9da0ba4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -114,9 +114,9 @@ class DevelopmentTools
# Get the GCC version.
#
# @api internal
# @api public
sig { params(cc: String).returns(Version) }
def gcc_version(cc)
def gcc_version(cc = host_gcc_path.to_s)
(@gcc_version ||= T.let({}, T.nilable(T::Hash[String, Version]))).fetch(cc) do
path = HOMEBREW_PREFIX/"opt/#{CompilerSelector.preferred_gcc}/bin"/cc
path = locate(cc) unless path.exist?