-
Notifications
You must be signed in to change notification settings - Fork 303
SourceKit-LSP appears to interfere with SwiftPM build plugins #676
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
Comments
rdar://111918777 |
Forgot to say I saw this using Swift 5.7.1 on macOS, but have also seen it using latest trunk build on Linux |
@adam-fowler Are you still able to reproduce this? I tried reproducing it with Also, in case you remember: Did you always see the issue or only if you performed certain actions in VSCode or at a certain point during package opening in VSCode, i.e. did the issue only appear right after opening it and resolved itself after a while? |
This appears to work ok with the version of swift that comes with the Xcode beta so I'll close for now. It was a little temperamental so I may re-open later on. |
Just managed to re-produce this with |
OK, here’s what I found: After opening the package, the VSCode plugin seems to be building all plugins. When manually invoking a build during that time, you get the error about the database. To reproduce this:
If I wait for the initial plugin build from the VSCode extension to finish and only perform the package build afterwards, I haven’t seen any issues. So I’m thinking that this might be an issue of the VSCode extension and not a sourcekit-lsp issue after all. AFAICT And it appears like the plugins are being built when executing |
@adam-fowler To make sure there isn’t another issue lurking somewhere: Do you think it would be possible for you to try if you still see the issue if you disable the |
I removed the |
I’m now able to reproduce the issue reliably as well. Mostly for my own memory, here’s what I found out. Steps to reproduceThese steps reliably reproduced the issue for me. There might be a smaller reproducer but it’s been sufficient for me. Preparation
diff --git a/src/TestExplorer/TestExplorer.ts b/src/TestExplorer/TestExplorer.ts
index b7efc0a..bc710ab 100644
--- a/src/TestExplorer/TestExplorer.ts
+++ b/src/TestExplorer/TestExplorer.ts
@@ -121,6 +121,7 @@ export class TestExplorer {
* Uses `swift test --list-tests` to get the list of tests
*/
async discoverTestsInWorkspace() {
+ return;
try {
const toolchain = this.folderContext.workspaceContext.toolchain;
// get build options before build is run so we can be sure they aren't changed
To reproduce the issue
Finding 1: Only reproduces with sourcekit-lsp from the toolchainIf I build sourcekit-lsp locally (both in debug and release, and both when building using Xcode and Finding 2:
|
OK, I think I believe I have a guess what the issue is, now. Opening the project in sourcekit-lsp causes |
Hooray, the issue that I also am not able to reproduce the issue anymore using the above instructions using |
It appears that SourceKit-LSP is interfering in the build process when building a project that includes a build plugin. While running VS Code on a package that include a build plugin the linker fails to find the generated code. Sometimes subsequent builds are successful but not always. The same project compiles fine if the sourcekit-lsp process is killed.
I used VSCode with Swift extension installed to reproduce this issue. I have a sample project which you can use to reproduce.
Steps to reproduce:
git clone https://github.com/adam-fowler/soto-codegenerator-plugin-test
cd soto-codegenerator-plugin-test
code .
swift build
(either in VS Code or from the command line)This will produce the following link errors
The text was updated successfully, but these errors were encountered: