SourceKitten
SourceKitten copied to clipboard
How to specify external SPM dependencies?
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?
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