Trust xcrun now that we error out early for bad xcode-select paths
Since ae177adb2bd55ee5ad6367e7639c4cf0c774b63a, we can safely assume that xcrun works, and a functioning xcrun will search dev_tools_path and xctoolchain_path, so we can stop doing extra work here. On CLT-only 10.7 and 10.8, xcrun will not work, but all the tools will be in /usr/bin, which we check before invoking xcrun. Further, in this case, dev_tools_path will be /usr/bin, and xctoolchain_path will not exist, so the fallbacks here are unnecessary.
This commit is contained in:
parent
89ed0c544b
commit
564b5df261
@ -27,25 +27,11 @@ module OS
|
|||||||
@locate[key] = if File.executable?(path = "/usr/bin/#{tool}")
|
@locate[key] = if File.executable?(path = "/usr/bin/#{tool}")
|
||||||
Pathname.new path
|
Pathname.new path
|
||||||
# Homebrew GCCs most frequently; much faster to check this before xcrun
|
# Homebrew GCCs most frequently; much faster to check this before xcrun
|
||||||
# This also needs to be queried if xcrun won't work, e.g. CLT-only
|
|
||||||
elsif File.executable?(path = "#{HOMEBREW_PREFIX}/bin/#{tool}")
|
elsif File.executable?(path = "#{HOMEBREW_PREFIX}/bin/#{tool}")
|
||||||
Pathname.new path
|
Pathname.new path
|
||||||
else
|
else
|
||||||
# If the tool isn't in /usr/bin or from Homebrew,
|
path = `/usr/bin/xcrun -no-cache -find #{tool} 2>/dev/null`.chomp
|
||||||
# then we first try to use xcrun to find it.
|
Pathname.new(path) if File.executable?(path)
|
||||||
# If it's not there, or xcode-select is misconfigured, we have to
|
|
||||||
# look in dev_tools_path, and finally in xctoolchain_path, because the
|
|
||||||
# tools were split over two locations beginning with Xcode 4.3+.
|
|
||||||
xcrun_path = begin
|
|
||||||
path = `/usr/bin/xcrun -find #{tool} 2>/dev/null`.chomp
|
|
||||||
# If xcrun finds a superenv tool then discard the result.
|
|
||||||
path unless path.include?("Library/ENV")
|
|
||||||
end
|
|
||||||
|
|
||||||
paths = %W[#{xcrun_path}
|
|
||||||
#{dev_tools_path}/#{tool}
|
|
||||||
#{xctoolchain_path}/usr/bin/#{tool}]
|
|
||||||
paths.map { |p| Pathname.new(p) }.find { |p| p.executable? }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user