Skip to content

Commit eb87c77

Browse files
committed
[Workspace] Improve error message for minimum required tools version
<rdar://problem/44194498> Diagnostic when building packages which use manifest v3 is confusing
1 parent 416f00f commit eb87c77

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Sources/Workspace/Diagnostics.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ public enum WorkspaceDiagnostics {
256256
name: "org.swift.diags.workspace.incompatible-tools-version",
257257
description: {
258258
$0 <<< "package at" <<< { "'\($0.rootPackagePath.asString)'" }
259-
$0 <<< "requires a minimum Swift tools version of" <<< { $0.requiredToolsVersion.description }
260-
$0 <<< { "(currently \($0.currentToolsVersion.description))" }
259+
$0 <<< "is using Swift tools version" <<< { $0.currentToolsVersion.description }
260+
$0 <<< "which is no longer supported; use" <<< { $0.requiredToolsVersion.description }
261+
$0 <<< "or newer instead"
261262
})
262263

263264
/// The path of the package.

Tests/FunctionalTests/ToolsVersionTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class ToolsVersionTests: XCTestCase {
103103
_ = try SwiftPMProduct.SwiftBuild.execute([], packagePath: primaryPath)
104104
XCTFail()
105105
} catch SwiftPMProductError.executionFailure(_, _, let stderr) {
106-
XCTAssert(stderr.contains("equires a minimum Swift tools version of 10000.1.0 (currently \(ToolsVersion.currentToolsVersion)"), stderr)
106+
XCTAssert(stderr.contains("is using Swift tools version 4.2.0 which is no longer supported; use 10000.1.0 or newer instead"), stderr)
107107
}
108108

109109
// Write the manifest with incompatible sources.

Tests/WorkspaceTests/WorkspaceTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,17 +1264,17 @@ final class WorkspaceTests: XCTestCase {
12641264
}
12651265
workspace.checkPackageGraph(roots: ["Bar"]) { (graph, diagnostics) in
12661266
DiagnosticsEngineTester(diagnostics) { result in
1267-
result.check(diagnostic: .equal("package at '/tmp/ws/roots/Bar' requires a minimum Swift tools version of 4.1.0 (currently 4.0.0)"), behavior: .error, location: "/tmp/ws/roots/Bar")
1267+
result.check(diagnostic: .equal("package at '/tmp/ws/roots/Bar' is using Swift tools version 4.0.0 which is no longer supported; use 4.1.0 or newer instead"), behavior: .error, location: "/tmp/ws/roots/Bar")
12681268
}
12691269
}
12701270
workspace.checkPackageGraph(roots: ["Foo", "Bar"]) { (graph, diagnostics) in
12711271
DiagnosticsEngineTester(diagnostics) { result in
1272-
result.check(diagnostic: .equal("package at '/tmp/ws/roots/Bar' requires a minimum Swift tools version of 4.1.0 (currently 4.0.0)"), behavior: .error, location: "/tmp/ws/roots/Bar")
1272+
result.check(diagnostic: .equal("package at '/tmp/ws/roots/Bar' is using Swift tools version 4.0.0 which is no longer supported; use 4.1.0 or newer instead"), behavior: .error, location: "/tmp/ws/roots/Bar")
12731273
}
12741274
}
12751275
workspace.checkPackageGraph(roots: ["Baz"]) { (graph, diagnostics) in
12761276
DiagnosticsEngineTester(diagnostics) { result in
1277-
result.check(diagnostic: .equal("package at '/tmp/ws/roots/Baz' requires a minimum Swift tools version of 4.0.0 (currently 3.1.0)"), behavior: .error, location: "/tmp/ws/roots/Baz")
1277+
result.check(diagnostic: .equal("package at '/tmp/ws/roots/Baz' is using Swift tools version 3.1.0 which is no longer supported; use 4.0.0 or newer instead"), behavior: .error, location: "/tmp/ws/roots/Baz")
12781278
}
12791279
}
12801280
}

0 commit comments

Comments
 (0)