SourceKitten icon indicating copy to clipboard operation
SourceKitten copied to clipboard

How to specify external SPM dependencies?

Open 97mik opened this issue 1 year ago • 1 comments

When I try to run a request and the file contains imports of a 3rd party Swift package:

key.request: source.request.indexsource
key.sourcefile: "ViewController.swift"
key.compilerargs:
- "-sdk"
- "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS16.4.sdk"
- "-target"
- "arm64-apple-ios16.4"
- "ViewController.swift"

Then I get an error: no such module 'MyPackage' And I don't get the index of those lines that use the structure from the package.

How can I specify links to used packages?

97mik avatar Jul 14 '23 11:07 97mik

You'll need to determine what compiler arguments Xcode passes to SourceKit and mirror those here.

You can do that by launching Xcode from the command line and looking at the logs:

$ SOURCEKIT_LOGGING=3 /Applications/Xcode.app/Contents/MacOS/Xcode

jpsim avatar Sep 13 '23 10:09 jpsim