Skip to content
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

Support specifying explicit SDK version #28696

Conversation

@ojhunt ojhunt requested a review from JonWBedard as a code owner May 17, 2024 06:08
@@ -917,6 +917,8 @@ sub availableXcodeSDKs

sub isValidXcodeSDKPlatformName($) {
my $name = shift;
# strip sdk version and variant qualifiers prior to validating platform
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment says what the code does, but not why. I do not immediately understand why - make always works with the active Xcode anyway, so it seems like there would be no need to specify SDK version, as there's only one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aproskuryakov if you have multiple sdk versions installed you cannot currently use the sdk argument to specify which sdk to use, e.g. build-webkit --sdk macosx14.1 will fail because "macosx14.1" is not in the list of valid platforms.

Copy link
Contributor

@emw-apple emw-apple left a comment

Choose a reason for hiding this comment

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

I agree with @aproskuryakov, I'm not entirely sure what you're trying to accomplish. Do you have a special Xcode configuration where you have multiple SDKs for the same platform, differing only in version?

@@ -917,6 +917,8 @@ sub availableXcodeSDKs

sub isValidXcodeSDKPlatformName($) {
my $name = shift;
# strip sdk version and variant qualifiers prior to validating platform
$name =~ s/(\d+\.[\d\.]+)?(\.internal)?$//;
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think stripping the version in the validation function makes sense, because then we'd have to make sure that the rest of webkitdirs can handle when $xcodeSDKPlatformName contains a version number. What I would recommend instead is a modification to determineXcodeSDKPlatformName:

     if (checkForArgumentAndRemoveFromARGVGettingValue("--sdk", \$sdk)) {
         $xcodeSDK = lc $sdk;
         $xcodeSDKPlatformName ||= $sdk;
-        $xcodeSDKPlatformName =~ s/\.internal$//;
+        $xcodeSDKPlatformName =~ s/(\d+\.[\d\.]+)?(\.internal)?$//;
         die "Couldn't determine platform name from Xcode SDK" unless  isValidXcodeSDKPlatformName($xcodeSDKPlatformName);
         return;
     }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that seems more correct to me assuming that's what gets passed to the validation code, I will try to verify in a bit

@ojhunt ojhunt force-pushed the eng/Support-specifying-explicit-SDK-version branch from d98521d to a2b2dad Compare May 18, 2024 21:41
@ojhunt
Copy link
Contributor Author

ojhunt commented May 18, 2024

Updated to the much more sensible suggestion of "just set the platform name correctly" approach, have verified correct behavior, but I'm wondering if this change should also include logic to verify the requested SDK actually exists, or if that should be a follow on change?

@ojhunt ojhunt force-pushed the eng/Support-specifying-explicit-SDK-version branch from a2b2dad to 4814eae Compare May 18, 2024 22:26
@ojhunt
Copy link
Contributor Author

ojhunt commented May 18, 2024

Actually checking "does the requested sdk exist" is actually trivial so just including it

Copy link
Contributor

@emw-apple emw-apple left a comment

Choose a reason for hiding this comment

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

r=me

Comment on lines 970 to 971
`xcrun --sdk $xcodeSDK --show-sdk-path 2>&1`;
die "Unable to find requested sdk '" . $xcodeSDK . "' requested" if exitStatus($?);
Copy link
Contributor

Choose a reason for hiding this comment

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

Talked privately but: I've tried to avoid making calls to xcrun when executing XcodeOptions(), since xcrun can be a little slow (~2 sec) when uncached. So, I'd suggest to not unconditionally run this, especially since most people pass an unversioned SDK name.

@ojhunt ojhunt force-pushed the eng/Support-specifying-explicit-SDK-version branch from 4814eae to 6163619 Compare May 20, 2024 19:00
@emw-apple emw-apple added the merge-queue Applied to send a pull request to merge-queue label May 20, 2024
https://bugs.webkit.org/show_bug.cgi?id=274298

Reviewed by Elliott Williams.

Strip the version number from the specified SDK as well when setting
the platform name

* Tools/Scripts/webkitdirs.pm:
(determineXcodeSDKPlatformName):

Canonical link: https://commits.webkit.org/279009@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Support-specifying-explicit-SDK-version branch from 6163619 to 9140fbd Compare May 20, 2024 20:39
@webkit-commit-queue
Copy link
Collaborator

Committed 279009@main (9140fbd): https://commits.webkit.org/279009@main

Reviewed commits have been landed. Closing PR #28696 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 9140fbd into WebKit:main May 20, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants