development_tools: make gcc_version public api

This commit is contained in:
Michael Cho 2025-09-03 20:35:20 -04:00
parent 1c959c22ce
commit 08181692f3
No known key found for this signature in database
GPG Key ID: 55E85E28A7CD1E85

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?