Skip to content

Commit be57a56

Browse files
committed
[Workspace] Allow overriding bin directory using env variable in debug
(cherry picked from commit 22f3dd1f2702911a471f868a4d23791dacc225b0)
1 parent a84e834 commit be57a56

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/Workspace/Destination.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ public struct Destination {
8484
environment: [String:String] = Process.env
8585
) throws -> Destination {
8686
// Select the correct binDir.
87-
let binDir = binDir ?? Destination.hostBinDir(
87+
var customBinDir: AbsolutePath?
88+
#if DEBUG
89+
customBinDir = ProcessEnv.vars["SWIFTPM_CUSTOM_BINDIR"].flatMap{ try? AbsolutePath(validating: $0) }
90+
#endif
91+
let binDir = customBinDir ?? binDir ?? Destination.hostBinDir(
8892
originalWorkingDirectory: originalWorkingDirectory)
8993

9094
#if os(macOS)

0 commit comments

Comments
 (0)