Android: remove newline chars before adding output in error/warning pane

The output of androiddeployqt that is picked by QC, can contain newline
char at the start of the received line like:
"\nNote: Recompile with -Xlint:deprecation for details."
Such output is sould be only a warning
and not an error, that's we try to remove the newline from the start to
avdoid this behavior.

Fixes: QTCREATORBUG-24881
Change-Id: Iad7556917cb0f53dc691dfb316f999ad504976e9
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Assam Boudjelthia
2020-11-20 18:11:33 +02:00
parent 8cee978e55
commit 34a7f6f9f2
2 changed files with 14 additions and 10 deletions

View File

@@ -895,13 +895,15 @@ void AndroidBuildApkStep::setBuildTargetSdk(const QString &sdk)
void AndroidBuildApkStep::stdError(const QString &output)
{
AbstractProcessStep::stdError(output);
if (output == "\n")
return;
if (output.startsWith("warning", Qt::CaseInsensitive) || output.startsWith("note", Qt::CaseInsensitive))
TaskHub::addTask(BuildSystemTask(Task::Warning, output));
QString newOutput = output;
newOutput.remove(QRegularExpression("^(\\n)+"));
if (newOutput.startsWith("warning", Qt::CaseInsensitive)
|| newOutput.startsWith("note", Qt::CaseInsensitive))
TaskHub::addTask(BuildSystemTask(Task::Warning, newOutput));
else
TaskHub::addTask(BuildSystemTask(Task::Error, output));
TaskHub::addTask(BuildSystemTask(Task::Error, newOutput));
}
QVariant AndroidBuildApkStep::data(Utils::Id id) const

View File

@@ -552,13 +552,15 @@ void AndroidDeployQtStep::processReadyReadStdError(DeployErrorCode &errorCode)
void AndroidDeployQtStep::stdError(const QString &line)
{
emit addOutput(line, BuildStep::OutputFormat::Stderr, BuildStep::DontAppendNewline);
if (line == "\n")
return;
if (line.startsWith("warning", Qt::CaseInsensitive) || line.startsWith("note", Qt::CaseInsensitive))
TaskHub::addTask(DeploymentTask(Task::Warning, line));
QString newOutput = line;
newOutput.remove(QRegularExpression("^(\\n)+"));
if (newOutput.startsWith("warning", Qt::CaseInsensitive)
|| newOutput.startsWith("note", Qt::CaseInsensitive))
TaskHub::addTask(DeploymentTask(Task::Warning, newOutput));
else
TaskHub::addTask(DeploymentTask(Task::Error, line));
TaskHub::addTask(DeploymentTask(Task::Error, newOutput));
}
AndroidDeployQtStep::DeployErrorCode AndroidDeployQtStep::parseDeployErrors(QString &deployOutputLine) const