MacOS: update sdk_path_if_needed logic

This commit is contained in:
Misty De Meo 2018-08-07 17:56:42 -07:00
parent b66f2b207e
commit eea18a5cb1
No known key found for this signature in database
GPG Key ID: 76CF846A2F674B2C

View File

@ -101,7 +101,19 @@ module OS
end
def sdk_path_if_needed(v = nil)
return if !MacOS::Xcode.installed? && MacOS::CLT.separate_header_package?
# Prefer Xcode SDK when both Xcode and the CLT are installed.
# Expected results:
# 1. On Xcode-only systems, return the Xcode SDK.
# 2. On Xcode-and-CLT systems where headers are provided by the system, return nil.
# 3. On CLT-only systems with no CLT SDK, return nil.
# 4. On CLT-only systems with a CLT SDK, where headers are provided by the system, return nil.
# 5. On CLT-only systems with a CLT SDK, where headers are not provided by the system, return the CLT SDK.
# If there's no CLT SDK, return early
return if MacOS::CLT.installed? && !MacOS::CLT.provides_sdk?
# If the CLT is installed and provides headers, return early
return if MacOS::CLT.installed? && !MacOS::CLT.separate_header_package?
sdk_path(v)
end