AndroidPackageInstallationStep: Employ task tree for running

Task-number: QTCREATORBUG-29168
Change-Id: I18d1188a18559bb8030a2c966ea3764833ad96f8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Jarek Kobus
2023-07-12 14:09:02 +02:00
parent f507eec207
commit bc2c2bbae9

View File

@@ -122,29 +122,28 @@ void AndroidPackageInstallationStep::setupOutputFormatter(OutputFormatter *forma
void AndroidPackageInstallationStep::doRun()
{
using namespace Tasking;
const auto onSetup = [this] {
if (AndroidManager::skipInstallationAndPackageSteps(target())) {
reportWarningOrError(Tr::tr("Product type is not an application, not running the "
"Make install step."),
Task::Warning);
emit finished(true);
return;
"Make install step."), Task::Warning);
return SetupResult::StopWithDone;
}
QString error;
for (const QString &dir : std::as_const(m_androidDirsToClean)) {
FilePath androidDir = FilePath::fromString(dir);
const FilePath androidDir = FilePath::fromString(dir);
if (!dir.isEmpty() && androidDir.exists()) {
emit addOutput(Tr::tr("Removing directory %1").arg(dir), OutputFormat::NormalMessage);
QString error;
if (!androidDir.removeRecursively(&error)) {
reportWarningOrError(Tr::tr("Failed to clean \"%1\" from the previous build, with "
"error:\n%2").arg(androidDir.toUserOutput()).arg(error),
reportWarningOrError(Tr::tr("Failed to clean \"%1\" from the previous build, "
"with error:\n%2").arg(androidDir.toUserOutput()).arg(error),
Task::TaskType::Error);
emit finished(false);
return;
return SetupResult::StopWithError;
}
}
}
AbstractProcessStep::doRun();
// NOTE: This is a workaround for QTCREATORBUG-24155
// Needed for Qt 5.15.0 and Qt 5.14.x versions
@@ -169,6 +168,10 @@ void AndroidPackageInstallationStep::doRun()
}
}
}
return SetupResult::Continue;
};
runTaskTree({onGroupSetup(onSetup), defaultProcessTask()});
}
void AndroidPackageInstallationStep::reportWarningOrError(const QString &message,