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

Don’t update Package.resolved from sourcekit-lsp #762

Merged
merged 1 commit into from Jul 7, 2023

Conversation

ahoppen
Copy link
Collaborator

@ahoppen ahoppen commented Jul 7, 2023

SwiftPMWorkspace.reloadPackage called loadPackageGraph, which causes package resolution and could thus update Package.resolved. This caused race conditions when swift package update was run from terminal while sourcekit-lsp is running since sourcekit-lsp was notified about the file changes and thus reloaded the pacakge to get build settings for the modified files.

Set forceResolvedVersions to only resolve packages based on the versions in Package.resolved, eliminating this problem.

Fixes #707 rdar://105173375

`SwiftPMWorkspace.reloadPackage` called `loadPackageGraph`, which causes package resolution and could thus update `Package.resolved`. This caused race conditions when `swift package update` was run from terminal while sourcekit-lsp is running since sourcekit-lsp was notified about the file changes and thus reloaded the pacakge to get build settings for the modified files.

Set `forceResolvedVersions` to only resolve packages based on the versions in `Package.resolved`, eliminating this problem.

Fixes apple#707
rdar://105173375
@ahoppen ahoppen requested a review from bnbarham July 7, 2023 13:32
@ahoppen ahoppen requested a review from benlangmuir as a code owner July 7, 2023 13:32
@ahoppen
Copy link
Collaborator Author

ahoppen commented Jul 7, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit 6b85bd2 into apple:main Jul 7, 2023
3 checks passed
@ahoppen ahoppen deleted the ahoppen/force-resolved-versions branch July 7, 2023 20:58
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.

SourceKit-LSP overwriting results of swift package update
2 participants