Skip to content

Conversation

@ahoppen
Copy link
Member

@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 swiftlang#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
Member Author

ahoppen commented Jul 7, 2023

@swift-ci Please test

@ahoppen ahoppen merged commit 6b85bd2 into swiftlang:main Jul 7, 2023
@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