Skip to content

Commit cb4c4e6

Browse files
committed
Workspace: assume that the user is always correct
When the user specifies the Swift executable via `SWIFT_EXEC` in the environment, assume that the value is supposed to be used. This changes the order in which the Swift compiler is evaluated as being present. This can avoid an unnecessary lookup for the executable in the case that it is specified by the user.
1 parent 6b9f18e commit cb4c4e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/Workspace/UserToolchain.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ public final class UserToolchain: Toolchain {
121121
// We require there is at least one valid swift compiler, either in the
122122
// bin dir or SWIFT_EXEC.
123123
let resolvedBinDirCompiler: AbsolutePath
124-
if let binDirCompiler = try? UserToolchain.getTool("swiftc", binDir: binDir) {
125-
resolvedBinDirCompiler = binDirCompiler
126-
} else if let SWIFT_EXEC = SWIFT_EXEC {
124+
if let SWIFT_EXEC = SWIFT_EXEC {
127125
resolvedBinDirCompiler = SWIFT_EXEC
126+
} else if let binDirCompiler = try? UserToolchain.getTool("swiftc", binDir: binDir) {
127+
resolvedBinDirCompiler = binDirCompiler
128128
} else {
129129
// Try to lookup swift compiler on the system which is possible when
130130
// we're built outside of the Swift toolchain.

0 commit comments

Comments
 (0)