SDK: allow SDK mismatches if major version matches

This commit is contained in:
Misty De Meo 2020-11-27 16:23:10 -08:00 committed by Mike McQuaid
parent f5bd2ee0c3
commit fec6fc4b4f
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -52,7 +52,17 @@ module OS
rescue NoSDKError
latest_sdk
end
# Only return an SDK older than the OS version if it was specifically requested
# Accept an SDK for another OS version if it shares a major version
# with the current OS - for example, the 11.0 SDK on 11.1,
# or vice versa.
# Note that this only applies on macOS 11
# or greater, given the way the versioning has changed.
# This shortcuts the below check, since we *do* accept an older version
# on macOS 11 or greater if the major version matches.
return sdk if sdk.present? && OS::Mac.version >= :big_sur && sdk.version.major == OS::Mac.version.major
# On OSs lower than 11, or where the major versions don't match,
# only return an SDK older than the OS version if it was specifically requested
return unless v || (sdk.present? && sdk.version >= OS::Mac.sdk_version)
sdk