You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve diagnostic when automatic resolution is disabled (#3639)
- Show the exact path where we looked for a resolved file
- Special case if there wasn't a file to begin with
rdar://81172549
(cherry picked from commit 9b9bed7)
Copy file name to clipboardExpand all lines: Sources/Workspace/Workspace.swift
+5-1Lines changed: 5 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1859,7 +1859,11 @@ extension Workspace {
1859
1859
)
1860
1860
1861
1861
if precomputationResult.isRequired {
1862
-
diagnostics.emit(error:"cannot update Package.resolved file because automatic resolution is disabled")
1862
+
if !fileSystem.exists(resolvedFile){
1863
+
diagnostics.emit(error:"a resolved file is required when automatic dependency resolution is disabled and should be placed at \(resolvedFile.pathString)")
1864
+
}else{
1865
+
diagnostics.emit(error:"an out-of-date resolved file was detected at \(resolvedFile.pathString), which is not allowed when automatic dependency resolution is disabled; please make sure to update the file to reflect the changes in dependencies")
Copy file name to clipboardExpand all lines: Tests/WorkspaceTests/WorkspaceTests.swift
+52-1Lines changed: 52 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3690,7 +3690,7 @@ final class WorkspaceTests: XCTestCase {
3690
3690
// Check force resolve. This should produce an error because the resolved file is out-of-date.
3691
3691
workspace.checkPackageGraphFailure(roots:["Root"], forceResolvedVersions:true){ diagnostics in
3692
3692
DiagnosticsEngineTester(diagnostics){ result in
3693
-
result.check(diagnostic:"cannot update Package.resolved file because automatic resolution is disabled", checkContains:true, behavior:.error)
3693
+
result.check(diagnostic:"an out-of-date resolved file was detected at /tmp/ws/Package.resolved, which is not allowed when automatic dependency resolution is disabled; please make sure to update the file to reflect the changes in dependencies", checkContains:true, behavior:.error)
3694
3694
}
3695
3695
}
3696
3696
workspace.checkManagedDependencies{ result in
@@ -3729,6 +3729,57 @@ final class WorkspaceTests: XCTestCase {
workspace.checkPackageGraphFailure(roots:["Root"], forceResolvedVersions:true){ diagnostics in
3777
+
DiagnosticsEngineTester(diagnostics){ result in
3778
+
result.check(diagnostic:"a resolved file is required when automatic dependency resolution is disabled and should be placed at /tmp/ws/Package.resolved", checkContains:true, behavior:.error)
0 commit comments