@@ -19,6 +19,11 @@ private let whichArgs: [String] = ["xcrun", "--find"]
19
19
#else
20
20
private let whichArgs = [ " which " ]
21
21
#endif
22
+ #if os(Windows)
23
+ private let hostExecutableSuffix = " .exe "
24
+ #else
25
+ private let hostExecutableSuffix = " "
26
+ #endif
22
27
23
28
/// Concrete object for manifest resource provider.
24
29
public struct UserManifestResources : ManifestResourceProvider {
@@ -56,7 +61,7 @@ public final class UserToolchain: Toolchain {
56
61
57
62
/// Path of the `swift` interpreter.
58
63
public var swiftInterpreter : AbsolutePath {
59
- return swiftCompiler. parentDirectory. appending ( component: " swift " )
64
+ return swiftCompiler. parentDirectory. appending ( component: " swift " + hostExecutableSuffix )
60
65
}
61
66
62
67
/// Path to the xctest utility.
@@ -97,7 +102,7 @@ public final class UserToolchain: Toolchain {
97
102
func validateCompiler( at path: AbsolutePath ? ) throws {
98
103
guard let path = path else { return }
99
104
guard localFileSystem. isExecutableFile ( path) else {
100
- throw InvalidToolchainDiagnostic ( " could not find the `swiftc` at expected path \( path) " )
105
+ throw InvalidToolchainDiagnostic ( " could not find the `swiftc \( hostExecutableSuffix ) ` at expected path \( path) " )
101
106
}
102
107
}
103
108
@@ -112,13 +117,13 @@ public final class UserToolchain: Toolchain {
112
117
// We require there is at least one valid swift compiler, either in the
113
118
// bin dir or SWIFT_EXEC.
114
119
let resolvedBinDirCompiler : AbsolutePath
115
- let binDirCompiler = binDir. appending ( component: " swiftc " )
120
+ let binDirCompiler = binDir. appending ( component: " swiftc " + hostExecutableSuffix )
116
121
if localFileSystem. isExecutableFile ( binDirCompiler) {
117
122
resolvedBinDirCompiler = binDirCompiler
118
123
} else if let SWIFT_EXEC = SWIFT_EXEC {
119
124
resolvedBinDirCompiler = SWIFT_EXEC
120
125
} else {
121
- throw InvalidToolchainDiagnostic ( " could not find the `swiftc` at expected path \( binDirCompiler) " )
126
+ throw InvalidToolchainDiagnostic ( " could not find the `swiftc \( hostExecutableSuffix ) ` at expected path \( binDirCompiler) " )
122
127
}
123
128
124
129
// The compiler for compilation tasks is SWIFT_EXEC or the bin dir compiler.
@@ -207,7 +212,7 @@ public final class UserToolchain: Toolchain {
207
212
self . swiftCompiler = swiftCompilers. compile
208
213
209
214
// Look for llbuild in bin dir.
210
- llbuild = binDir. appending ( component: " swift-build-tool " )
215
+ llbuild = binDir. appending ( component: " swift-build-tool " + hostExecutableSuffix )
211
216
guard localFileSystem. exists ( llbuild) else {
212
217
throw InvalidToolchainDiagnostic ( " could not find `llbuild` at expected path \( llbuild) " )
213
218
}
0 commit comments