Skip to content

Enable SWIFTPM_CUSTOM_BINDIR in Non Debug #2347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions Sources/Workspace/Destination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ public struct Destination: Encodable {
//
// This also means that we should have bootstrapped with the same Swift toolchain
// we're using inside Xcode otherwise we will not be able to load the runtime libraries.
//
// FIXME: We may want to allow overriding this using an env variable but that
// doesn't seem urgent or extremely useful as of now.
return AbsolutePath(#file).parentDirectory
.parentDirectory.parentDirectory.appending(components: ".build", hostTargetTriple.tripleString, "debug")
#else
Expand All @@ -84,10 +81,9 @@ public struct Destination: Encodable {
environment: [String:String] = ProcessEnv.vars
) throws -> Destination {
// Select the correct binDir.
var customBinDir: AbsolutePath?
#if DEBUG
customBinDir = ProcessEnv.vars["SWIFTPM_CUSTOM_BINDIR"].flatMap{ try? AbsolutePath(validating: $0) }
#endif
let customBinDir = ProcessEnv
.vars["SWIFTPM_CUSTOM_BINDIR"]
.flatMap{ try? AbsolutePath(validating: $0) }
let binDir = customBinDir ?? binDir ?? Destination.hostBinDir(
originalWorkingDirectory: originalWorkingDirectory)

Expand Down