Skip to content

Commit 8084737

Browse files
committed
If a tool isn't found next to the driver, try looking for it next to the frontend
This might reduce the need for SWIFT_DRIVER_*_EXEC overrides in library clients like SPM
1 parent 8179c27 commit 8084737

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/SwiftDriver/Toolchains/Toolchain.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,12 @@ extension Toolchain {
126126
return try AbsolutePath(validating: overrideString)
127127
} else if let path = lookupExecutablePath(filename: executable, searchPaths: [executableDir]) {
128128
return path
129+
} else if !["swift-frontend", "swift"].contains(executable),
130+
let parentDir = try? getToolPath(.swiftCompiler).parentDirectory,
131+
parentDir != executableDir,
132+
let path = lookupExecutablePath(filename: executable, searchPaths: [parentDir]) {
133+
// If the frontend and driver have different parent directories, try looking in both.
134+
return path
129135
} else if let path = try? xcrunFind(executable: executable) {
130136
return path
131137
} else if let path = lookupExecutablePath(filename: executable, searchPaths: searchPaths) {

0 commit comments

Comments
 (0)