os/mac: prefer CLT SDK over Xcode

This commit is contained in:
Bo Anderson 2020-03-08 20:09:06 +00:00
parent 20d9f436ca
commit 1f29f70929

View File

@ -85,10 +85,10 @@ module OS
# if available. Otherwise, the latest SDK is returned. # if available. Otherwise, the latest SDK is returned.
def sdk(v = nil) def sdk(v = nil)
@locator ||= if Xcode.installed? @locator ||= if CLT.installed? && CLT.provides_sdk?
XcodeSDKLocator.new
else
CLTSDKLocator.new CLTSDKLocator.new
else
XcodeSDKLocator.new
end end
@locator.sdk_if_applicable(v) @locator.sdk_if_applicable(v)
@ -101,7 +101,7 @@ module OS
end end
def sdk_path_if_needed(v = nil) def sdk_path_if_needed(v = nil)
# Prefer Xcode SDK when both Xcode and the CLT are installed. # Prefer CLT SDK when both Xcode and the CLT are installed.
# Expected results: # Expected results:
# 1. On Xcode-only systems, return the Xcode SDK. # 1. On Xcode-only systems, return the Xcode SDK.
# 2. On Xcode-and-CLT systems where headers are provided by the system, return nil. # 2. On Xcode-and-CLT systems where headers are provided by the system, return nil.