Skip to content

Make deriveTargetSwiftSDK public #7925

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
Aug 29, 2024

Conversation

kabiroberai
Copy link
Contributor

@kabiroberai kabiroberai commented Aug 28, 2024

Used by swiftlang/sourcekit-lsp#1643

Motivation:

Allows us to achieve parity between sourcekit-lsp's configuration options and SwiftPM's --triple/--swift-sdk.

Modifications:

Make SwiftSDK.deriveTargetSwiftSDK public

Result:

See swiftlang/sourcekit-lsp#1643

@MaxDesiatov
Copy link
Contributor

@swift-ci test

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

In the context of the LSP change this makes sense. Thanks!

@kabiroberai kabiroberai changed the title [WIP] Make deriveTargetSwiftSDK public Make deriveTargetSwiftSDK public Aug 28, 2024
@kabiroberai kabiroberai marked this pull request as ready for review August 28, 2024 22:52
@kabiroberai
Copy link
Contributor Author

@MaxDesiatov think we're ready to merge this!

@MaxDesiatov MaxDesiatov merged commit d31cf05 into swiftlang:main Aug 29, 2024
5 checks passed
MaxDesiatov pushed a commit to swiftlang/sourcekit-lsp that referenced this pull request Aug 29, 2024
Using `SwiftSDK.deriveTargetSwiftSDK`, which is the same method that SwiftPM's own CLI tools use to determine the SDK from passed-in info (target `--triple`, `--swift-sdk`, and host sdk). This allows us to better uphold the contract in the [Configuration File](https://github.com/swiftlang/sourcekit-lsp/blob/d11c101ce210ad23f917cf06fb13a7d9e243872b/Documentation/Configuration%20File.md#structure) docs, namely that the `swiftSDK` param is "Equivalent to SwiftPM's `--swift-sdk` option" and similarly for `triple`.

As concrete examples of where (AFAICT) the current implementation diverges:
- Passing a `--triple` of `wasm32-unknown-wasi` to `swift-build` will use the toolchain-integrated Wasm SDK if one exists. Passing the same value to sourcekit-lsp does not do this.
- Perhaps more relevant: after landing swiftlang/swift-package-manager#6828, this change will make it so that building for iOS is as simple as setting `"triple": "arm64-apple-ios"` in the config! Currently, it's necessary to set C/Swift flags and hardcode the sysroot. Should close #1587.

This PR depends on:

- swiftlang/swift-package-manager#7925
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