use of org.gradle.internal.nativeintegration.console.FallbackConsoleMetaData in project gradle by gradle.
the class ConsoleConfigureAction method execute.
public void execute(OutputEventRenderer renderer, ConsoleOutput consoleOutput) {
if (consoleOutput == ConsoleOutput.Plain) {
return;
}
ConsoleDetector consoleDetector = NativeServices.getInstance().get(ConsoleDetector.class);
ConsoleMetaData consoleMetaData = consoleDetector.getConsole();
boolean force = false;
if (consoleMetaData == null) {
if (consoleOutput == ConsoleOutput.Auto) {
return;
}
assert consoleOutput == ConsoleOutput.Rich;
consoleMetaData = new FallbackConsoleMetaData();
force = true;
}
boolean stdOutIsTerminal = consoleMetaData.isStdOut();
boolean stdErrIsTerminal = consoleMetaData.isStdErr();
int numWorkersToDisplay = ConsoleLayoutCalculator.calculateNumWorkersForConsoleDisplay(consoleMetaData);
if (stdOutIsTerminal) {
OutputStream originalStdOut = renderer.getOriginalStdOut();
OutputStreamWriter outStr = new OutputStreamWriter(force ? originalStdOut : AnsiConsoleUtil.wrapOutputStream(originalStdOut));
Console console = new AnsiConsole(outStr, outStr, renderer.getColourMap(), consoleMetaData, numWorkersToDisplay, force);
renderer.addConsole(console, true, stdErrIsTerminal, consoleMetaData);
} else if (stdErrIsTerminal) {
// Only stderr is connected to a terminal
OutputStream originalStdErr = renderer.getOriginalStdErr();
OutputStreamWriter errStr = new OutputStreamWriter(force ? originalStdErr : AnsiConsoleUtil.wrapOutputStream(originalStdErr));
Console console = new AnsiConsole(errStr, errStr, renderer.getColourMap(), consoleMetaData, numWorkersToDisplay, force);
renderer.addConsole(console, false, true, consoleMetaData);
}
}
use of org.gradle.internal.nativeintegration.console.FallbackConsoleMetaData in project gradle by gradle.
the class OutputEventRenderer method attachAnsiConsole.
public void attachAnsiConsole(OutputStream outputStream) {
synchronized (lock) {
ConsoleMetaData consoleMetaData = new FallbackConsoleMetaData();
OutputStreamWriter writer = new OutputStreamWriter(outputStream);
int numWorkersToDisplay = ConsoleLayoutCalculator.calculateNumWorkersForConsoleDisplay(consoleMetaData);
Console console = new AnsiConsole(writer, writer, colourMap, consoleMetaData, numWorkersToDisplay, true);
addConsole(console, true, true, consoleMetaData);
}
}
Aggregations