Skip to content

Commit b8f0837

Browse files
committed
Enable SWIFTPM_CUSTOM_BINDIR in Non Debug
This is particularly useful for Windows which doesn't currently have a standardized place to install the toolchain to.
1 parent 9c5a13a commit b8f0837

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

Sources/Workspace/Destination.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import TSCBasic
22
import Build
33
import TSCUtility
4+
import Foundation
45

56
public enum DestinationError: Swift.Error {
67
/// Couldn't find the Xcode installation.
@@ -64,9 +65,6 @@ public struct Destination: Encodable {
6465
//
6566
// This also means that we should have bootstrapped with the same Swift toolchain
6667
// we're using inside Xcode otherwise we will not be able to load the runtime libraries.
67-
//
68-
// FIXME: We may want to allow overriding this using an env variable but that
69-
// doesn't seem urgent or extremely useful as of now.
7068
return AbsolutePath(#file).parentDirectory
7169
.parentDirectory.parentDirectory.appending(components: ".build", hostTargetTriple.tripleString, "debug")
7270
#else
@@ -84,10 +82,9 @@ public struct Destination: Encodable {
8482
environment: [String:String] = ProcessEnv.vars
8583
) throws -> Destination {
8684
// Select the correct binDir.
87-
var customBinDir: AbsolutePath?
88-
#if DEBUG
89-
customBinDir = ProcessEnv.vars["SWIFTPM_CUSTOM_BINDIR"].flatMap{ try? AbsolutePath(validating: $0) }
90-
#endif
85+
let customBinDir = ProcessEnv
86+
.vars["SWIFTPM_CUSTOM_BINDIR"]
87+
.flatMap{ try? AbsolutePath(validating: $0) }
9188
let binDir = customBinDir ?? binDir ?? Destination.hostBinDir(
9289
originalWorkingDirectory: originalWorkingDirectory)
9390

0 commit comments

Comments
 (0)