-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
os/mac/sdk: parse version from SDKSettings.json #10112
Conversation
Review period will end on 2020-12-24 at 13:35:46 UTC. |
@Bo98 Not sure if the last fallback to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work so far! Any thoughts on removing the existing :big_sur
logic you mentioned given this too? Interested in @Bo98's thoughts on that too if they have a chance.
Library/Homebrew/os/mac/sdk.rb
Outdated
sdk_settings_plist = File.join(sdk_path, "SDKSettings.plist") | ||
|
||
if File.exist?(sdk_settings_json) | ||
version = JSON.parse(File.read(sdk_settings_json))["Version"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version = JSON.parse(File.read(sdk_settings_json))["Version"] | |
version = JSON.parse(File.read(sdk_settings_json))["Version"].presence |
and then I'd suggest using version ||=
on the other cases below so it gets set to something even if this version is missing in the JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can skip this too once it's only the JSON stuff.
Probably not. I'd much rather reject a SDK if SDKSettings is missing (which should never really happen). |
Thanks, @Bo98. Did you have thoughts regarding this brew/Library/Homebrew/os/mac/sdk.rb Lines 57 to 64 in d6692d2
in light of the last PR? |
I believe that will still be necessary if the user has, for example, macOS 11.1 installed but hasn't updated Xcode and so still has the 11.0 SDK. |
Thanks @Bo98 👍🏻 |
This implements feedback from #10072.
Just to copy over the point from the other PR:
Is this something we want to handle or just assume it won't happen again with the Big Sur versioning system? I reckon it won't happen again so I'm fine with this pull request as-is. |
Review period ended. |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Language::Java::java_home
brew man
locally and committed any changes?This implements feedback from #10072.
We try to use a more sensible version check for the SDK, by querying, in order of priority:
sdk_prefix/MacOSX.sdk/SDKSettings.json
sdk_prefix/MacOSX.sdk/SDKSettings.plist
OS::Mac.sdk_version