Skip to content

Fixing up SDK behavior #293

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 7 commits into from
May 4, 2022
Merged

Fixing up SDK behavior #293

merged 7 commits into from
May 4, 2022

Conversation

stevapple
Copy link
Contributor

@stevapple stevapple commented May 2, 2022

  • swift-package usually doesn't require SDK flag;
  • XCTest path should be derived from destination's SDK;
  • Remove SDK flags on non-SwiftPM calls.

@stevapple
Copy link
Contributor Author

cc @adam-fowler

case "package":
switch (args[1]) {
case "dump-symbol-graph":
case "diagnose-api-breaking-changes": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any harm in including the --sdk command line parameter even when it isn't needed. What's to say another package command requires the sdk.

Copy link
Contributor Author

@stevapple stevapple May 2, 2022

Choose a reason for hiding this comment

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

I would suggest to add them explicitly (since they're part of SwiftPM release). Adding unnecessary SDK flags has no effect I guess, but it will make the command line long and confusing (especially when the destination flags accumulate).

@stevapple
Copy link
Contributor Author

@adam-fowler Ping again for this and #294

Copy link
Contributor

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

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

A couple comments, otherwise it looks fine

One thing I don't get, you seem to be prepping the code to debug with a custom SDK (ie looking for xctest.dll in custom SDK), but consider running a swift script with the same custom SDK as something undesirable.

Secondly has this been tested with a custom SDK, plus does the test explorer still work (with/without a custom SDK) after these changes, similar changes broke the test explorer before.

@stevapple
Copy link
Contributor Author

stevapple commented May 2, 2022

One thing I don't get, you seem to be prepping the code to debug with a custom SDK (ie looking for xctest.dll in custom SDK), but consider running a swift script with the same custom SDK as something undesirable.

In most cases, cross-compiled binaries cannot run on the host. swift test and swift run will assume by user's intent that the binary can run under the environment, so we're just following its rule here.

(BTW, XCTest is not actually in the Windows SDK. We're just regarding SDKROOT as an anchor (starting point) for the searching. All these are following the current SwiftPM implementation.)

If something is known to be run on the host (Swift package manifest, SwiftPM plugin, Swift scripts...), it should stick to use host SDK, and overriding should take SDKROOT instead of the flag. #294 clarifies the destination configuration set to be package-only.

@stevapple
Copy link
Contributor Author

Secondly has this been tested with a custom SDK, plus does the test explorer still work (with/without a custom SDK) after these changes, similar changes broke the test explorer before.

At least everything works perfectly on macOS. On Windows I haven't got a real secondary SDK yet, and custom SDKROOT should be more useful there.

@adam-fowler
Copy link
Contributor

adam-fowler commented May 4, 2022

Currently we have two points where the decision on sdk flags being added. The setSDKFlags parameter in execSwift and in withSwiftSDKFlags. Do we need both?

EDIT: Ignore this I see you have removed the setSDKFlags parameter

Copy link
Contributor

@adam-fowler adam-fowler left a comment

Choose a reason for hiding this comment

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

We're good

@adam-fowler adam-fowler merged commit ad64b49 into swiftlang:main May 4, 2022
@stevapple stevapple deleted the sdk-fix branch August 1, 2022 20:23
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.

2 participants