Skip to content

Commit 531f8a9

Browse files
committed
Don’t update Package.resolved from sourcekit-lsp
`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
1 parent af5cd53 commit 531f8a9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ extension SwiftPMWorkspace {
177177

178178
let packageGraph = try self.workspace.loadPackageGraph(
179179
rootInput: PackageGraphRootInput(packages: [packageRoot]),
180+
forceResolvedVersions: true,
180181
observabilityScope: observabilitySystem.topScope
181182
)
182183

0 commit comments

Comments
 (0)