Actually cache Xcode.version
The short-circuit returns would cause the caching ||= syntax to be skipped. For me on my CLT-less install, this was noticeably slowing down brew for some operations due to the frequent calls to xcodebuild.
This commit is contained in:
parent
a8a9388062
commit
97acbe8f66
@ -56,7 +56,13 @@ module MacOS::Xcode extend self
|
||||
# may return a version string
|
||||
# that is guessed based on the compiler, so do not
|
||||
# use it in order to check if Xcode is installed.
|
||||
@version ||= begin
|
||||
@version ||= uncached_version
|
||||
end
|
||||
|
||||
def uncached_version
|
||||
# This is a separate function as you can't cache the value out of a block
|
||||
# if return is used in the middle, which we do many times in here.
|
||||
|
||||
return "0" unless MACOS
|
||||
|
||||
# this shortcut makes version work for people who don't realise you
|
||||
@ -64,7 +70,7 @@ module MacOS::Xcode extend self
|
||||
xcode43build = V4_BUNDLE_PATH/'Contents/Developer/usr/bin/xcodebuild'
|
||||
if xcode43build.file?
|
||||
`#{xcode43build} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/
|
||||
return $1 if $1
|
||||
$1 if $1
|
||||
end
|
||||
|
||||
# Xcode 4.3 xc* tools hang indefinately if xcode-select path is set thus
|
||||
@ -117,7 +123,6 @@ module MacOS::Xcode extend self
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def provides_autotools?
|
||||
version.to_f < 4.3
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user