Skip to content

Commit 5470726

Browse files
Austinateaciidgh
authored andcommitted
[SR-4830] Propagate colors from compiler output for swiftc
1 parent 42b26ce commit 5470726

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Sources/Build/BuildPlan.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ public struct BuildParameters {
5757
public var swiftCompilerFlags: [String] {
5858
var flags = self.flags.cCompilerFlags.flatMap({ ["-Xcc", $0] })
5959
flags += self.flags.swiftCompilerFlags
60+
61+
let stream = stdoutStream as? LocalFileOutputByteStream
62+
let terminalController = stream.flatMap({ TerminalController(stream: $0) })
63+
// Add extra flags if stdout is tty
64+
if terminalController != nil {
65+
flags += ["-Xfrontend", "-color-diagnostics"]
66+
}
67+
6068
flags += verbosity.ccArgs
6169
return flags
6270
}

0 commit comments

Comments
 (0)