Compile: add ability to parse standard output in build

When working with make wrapper scripts, sometimes they forward
everything to stdout. When this happens failures are not parsed,
and the are not "clickable" in QtC.
This patch adds an option to enable parsing of standard output.

Change-Id: I44b283dbdf6286f90c546898d496bff41de0d5ed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Petar Perisin
2021-08-05 22:47:23 +02:00
parent 81cbb0a33c
commit fe9a1f52c1
5 changed files with 28 additions and 2 deletions

View File

@@ -217,6 +217,7 @@ public:
bool boldFontEnabled = true;
bool prependCarriageReturn = false;
bool prependLineFeed = false;
bool forwardStdOutToStdError = false;
};
OutputFormatter::OutputFormatter() : d(new Private) { }
@@ -574,6 +575,11 @@ void OutputFormatter::setBoldFontEnabled(bool enabled)
d->formats[ErrorMessageFormat].setFontWeight(fontWeight);
}
void OutputFormatter::setForwardStdOutToStdError(bool enabled)
{
d->forwardStdOutToStdError = enabled;
}
void OutputFormatter::flush()
{
if (!d->incompleteLine.first.isEmpty())
@@ -608,7 +614,7 @@ void OutputFormatter::dropSearchDir(const FilePath &dir)
OutputFormat OutputFormatter::outputTypeForParser(const OutputLineParser *parser,
OutputFormat type) const
{
if (type == StdOutFormat && parser->needsRedirection())
if (type == StdOutFormat && (parser->needsRedirection() || d->forwardStdOutToStdError))
return StdErrFormat;
return type;
}