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