Skip to content

Commit 1a26634

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 swiftlang#707 rdar://105173375
1 parent d66705c commit 1a26634

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Sources/SKSwiftPMWorkspace/SwiftPMWorkspace.swift

+1
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ extension SwiftPMWorkspace {
182182

183183
let packageGraph = try self.workspace.loadPackageGraph(
184184
rootInput: PackageGraphRootInput(packages: [AbsolutePath(packageRoot)]),
185+
forceResolvedVersions: true,
185186
observabilityScope: observabilitySystem.topScope
186187
)
187188

0 commit comments

Comments
 (0)