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

[5.9] Don’t update Package.resolved from sourcekit-lsp #763

Merged

Conversation

ahoppen
Copy link
Collaborator

@ahoppen ahoppen commented Jul 7, 2023

  • Explanation: There was a race condition when running swift package update while sourcekit-lsp was running that could cause Package.resolved to not get updated. Fix the issue by not writing an updated Package.resolved from sourcekit-lsp
  • Risk: Low
  • Testing: Verified locally that Package.resolved does not get updated with this change
  • Issue: rdar://105173375 / SourceKit-LSP overwriting results of swift package update #707
  • Reviewer: @bnbarham

`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:36
@ahoppen ahoppen requested a review from benlangmuir as a code owner July 7, 2023 13:36
@ahoppen
Copy link
Collaborator Author

ahoppen commented Jul 7, 2023

@swift-ci Please test

@ahoppen ahoppen changed the title Don’t update Package.resolved from sourcekit-lsp [5.9] Don’t update Package.resolved from sourcekit-lsp Jul 7, 2023
@ahoppen ahoppen merged commit 651aced into apple:release/5.9 Jul 7, 2023
3 checks passed
@ahoppen ahoppen deleted the ahoppen/5.9/force-resolved-versions branch July 7, 2023 18:21
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.

None yet

2 participants