Skip to content

Attempt to diagnose arguments to -sdk that point to unsupported SDKs #606

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

Merged
merged 1 commit into from
Apr 19, 2021

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Apr 19, 2021

Resolves rdar://70215624

@artemcm artemcm requested a review from nkcsgexi April 19, 2021 19:14
@artemcm
Copy link
Contributor Author

artemcm commented Apr 19, 2021

@swift-ci please test

Comment on lines 2008 to 2009
} else if targetTriple != nil,
isSDKTooOld(sdkPath: path, target: targetTriple!) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if targetTriple != nil,
isSDKTooOld(sdkPath: path, target: targetTriple!) {
} else if let targetTriple = targetTriple,
isSDKTooOld(sdkPath: path, target: targetTriple) {

Don't have to force unwrap here if you use if let

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code looks a bit different now, but thank you for taking a look.

@nkcsgexi
Copy link
Contributor

Can we use the DarwinSDKInfo for checks like this? We may use an SDK path that's without the version number in it (a symlink to the actual SDK dir).

@artemcm
Copy link
Contributor Author

artemcm commented Apr 19, 2021

Can we use the DarwinSDKInfo for checks like this? We may use an SDK path that's without the version number in it (a symlink to the actual SDK dir).

Oh, I hadn't realized we already had this implemented. Great, I'll look into that.

@artemcm artemcm force-pushed the SDKTooOld branch 2 times, most recently from 3465185 to 9d94fb2 Compare April 19, 2021 21:46
@artemcm
Copy link
Contributor Author

artemcm commented Apr 19, 2021

Can we use the DarwinSDKInfo for checks like this? We may use an SDK path that's without the version number in it (a symlink to the actual SDK dir).

@nkcsgexi, I changed the approach to use the DarwinSDKInfo.

@artemcm
Copy link
Contributor Author

artemcm commented Apr 19, 2021

@swift-ci please test

"VersionMap": {
"macOS_iOSMac": {},
"iOSMac_macOS": {}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think we shouldn't need VersionMap in non-macosx SDKs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks. 👍🏼

@artemcm
Copy link
Contributor Author

artemcm commented Apr 19, 2021

@swift-ci please test

Copy link
Contributor

@nkcsgexi nkcsgexi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@artemcm artemcm merged commit 678f654 into swiftlang:main Apr 19, 2021
} else if sdkInfo.canonicalName.hasPrefix("iphoneos") ||
sdkInfo.canonicalName.hasPrefix("appletvos") {
return sdkVersion < Version(13, 0, 0)
} else if sdkInfo.canonicalName.hasPrefix("watchos") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about missing this. Do we need to handle simulator SDKs here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, that's a good catch.
I thought this would work as is because it is a prefix, but it turns out that it won't. The os part of the prefix is not present for the simulator platforms so we need to pattern match prefixes: appletv, watch, iphone, without the os to also catch this for the simulator. I'll create another PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Using a more concise prefix will just work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants