From 34a7f6f9f2af0f752d7fada1caeb705bb7ba7432 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Fri, 20 Nov 2020 18:11:33 +0200 Subject: [PATCH] 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 --- src/plugins/android/androidbuildapkstep.cpp | 12 +++++++----- src/plugins/android/androiddeployqtstep.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index 4c33d6b5679..400d2b9bca4 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -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 diff --git a/src/plugins/android/androiddeployqtstep.cpp b/src/plugins/android/androiddeployqtstep.cpp index 3f23838e7ec..19990e149ee 100644 --- a/src/plugins/android/androiddeployqtstep.cpp +++ b/src/plugins/android/androiddeployqtstep.cpp @@ -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