Skip to content
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

Resolving dependencies fails on fresh build #7951

Open
Akaike opened this issue Sep 7, 2024 · 5 comments
Open

Resolving dependencies fails on fresh build #7951

Akaike opened this issue Sep 7, 2024 · 5 comments

Comments

@Akaike
Copy link

Akaike commented Sep 7, 2024

Swift version

swiftlang-5.10.0.13

Platform

macOS 14.6.1

Editor

Visual Studio Code

Does the issue reproduce with Swift 6?

I didn’t try

Description

Loading a Vapor server-side project without an build causes a failure in resolving dependencies.
Whenever I load a project that doesn't have an existing build folder, it gets automatically recreated (executes build all), but even after successful build, the dependencies cannot be resolved. After restarting VSCode, magically everything works again.

I also encountered the issue that the build doesn't work at all after creating a fresh Vapor project, but maybe this is not important to this issue. I have to manually delete the build folder and execute swift build, restart VSCode to make it work again.

I hope the logs help. Let me know if I can support you with anything else. It seems like I can reproduce the issue on my end very easily.

Steps to Reproduce

  • Open a Vapor project, delete build folder if exists (vapor new hello -n)
  • Open VSCode, let it rebuild the project etc.
  • Dependencies resolving fails
  • Restart VSCode again
  • Dependencies resolving works

Logging

Fresh vapor project:
Fresh project just loaded:
extension-logs-fresh-vapor-project-initial-load.txt

After manual build execution and restart:
extension-fresh-vapor-after-manual-build-and-restart-logs.txt

Older vapor project:
Before restart
extension-logs-vapor-project-before-restart.txt

After restart, dependencies being resolved without an issue.
extension-logs-vapor-project-after-restart.txt

@Akaike Akaike added the bug label Sep 7, 2024
@Akaike
Copy link
Author

Akaike commented Sep 7, 2024

I'm not sure if it helps, but here is also a video of the behaviour. It shows that I can't open any definition even though the build with needed files exists.

Screen.Recording.2024-09-07.at.19.38.27.mov

Sorry for the quality, had to keep it low cause of size.

@ahoppen
Copy link
Member

ahoppen commented Sep 7, 2024

Synced to Apple’s issue tracker as rdar://135478754

@ahoppen
Copy link
Member

ahoppen commented Sep 9, 2024

It seems like SwiftPM is having issues accessing the package manifests from your dependencies, which also explains why jump-to-definition isn’t working.

From the logs you attached

19:45:49: hello: Listing tests: Command failed: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift test list --skip-build -Xswiftc -diagnostic-style=llvm
error: 'swift-crypto': the package manifest at '/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-crypto/Package.swift' cannot be accessed (/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-crypto/Package.swift doesn't exist in file system)
error: 'swift-collections': the package manifest at '/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-collections/Package.swift' cannot be accessed (/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-collections/Package.swift doesn't exist in file system)
error: 'swift-collections': the package manifest at '/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-collections/Package.swift' cannot be accessed (/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-collections/Package.swift doesn't exist in file system)
error: 'swift-crypto': the package manifest at '/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-crypto/Package.swift' cannot be accessed (/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-crypto/Package.swift doesn't exist in file system)
error: 'swift-collections': the package manifest at '/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-collections/Package.swift' cannot be accessed (/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-collections/Package.swift doesn't exist in file system)
error: 'swift-collections': the package manifest at '/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-collections/Package.swift' cannot be accessed (/Users/alex/Dev/swift-core/hello/.build/checkouts/swift-collections/Package.swift doesn't exist in file system)
error: no tests found; create a target in the 'Tests' directory

Sending this over to SwiftPM to take a look

@ahoppen ahoppen transferred this issue from swiftlang/sourcekit-lsp Sep 9, 2024
@plemarquand
Copy link
Contributor

Hi @Akaike, I took a shot at reproducing this w/ the Swift version and OS you specified but I couldn't reproduce it; dependencies were pulled as expected and the build all ran correctly.

Could you delete your .build and try to reproduce again, and once the build has completed run > Swift: Capture VS Code Swift Diagnostic Bundle from the VS Code command palette. Then select Minimal Diagnostics and attach the files to this issue. I'm curious if there is an extension setting I'm missing.

@Akaike
Copy link
Author

Akaike commented Sep 17, 2024

Hi @plemarquand :),
Hm, that’s unfortunate, or maybe fortunate… Maybe it’s just an issue on my end. I deleted a bunch of extensions and thought maybe it would help, but it didn’t.

This is what I did to reproduce the issue:

  • Delete .build
  • Restart VSCode
  • Wait build to be finished

extension-logs.txt

Am I doing something wrong? Or is this how it is expected to work?

Here a full video of the same issue, reproduced with a fresh Vapor template project.
https://github.com/user-attachments/assets/cb1d4dc4-3e7b-4a3a-b2ca-0cd6aa253663

I also uploaded it on YouTube, just in case: https://youtu.be/BDJI1VfQ23w

Here are the extensions I have installed:

  • CodeLLDB
  • ESLint
  • Copilot & Chat
  • GitLens
  • Playwright Test for VSCode
  • Prettier
  • Prisma
  • Swift

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants