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,53 +122,56 @@ void AndroidPackageInstallationStep::setupOutputFormatter(OutputFormatter *forma
|
|||||||
|
|
||||||
void AndroidPackageInstallationStep::doRun()
|
void AndroidPackageInstallationStep::doRun()
|
||||||
{
|
{
|
||||||
if (AndroidManager::skipInstallationAndPackageSteps(target())) {
|
using namespace Tasking;
|
||||||
reportWarningOrError(Tr::tr("Product type is not an application, not running the "
|
|
||||||
"Make install step."),
|
|
||||||
Task::Warning);
|
|
||||||
emit finished(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString error;
|
const auto onSetup = [this] {
|
||||||
for (const QString &dir : std::as_const(m_androidDirsToClean)) {
|
if (AndroidManager::skipInstallationAndPackageSteps(target())) {
|
||||||
FilePath androidDir = FilePath::fromString(dir);
|
reportWarningOrError(Tr::tr("Product type is not an application, not running the "
|
||||||
if (!dir.isEmpty() && androidDir.exists()) {
|
"Make install step."), Task::Warning);
|
||||||
emit addOutput(Tr::tr("Removing directory %1").arg(dir), OutputFormat::NormalMessage);
|
return SetupResult::StopWithDone;
|
||||||
if (!androidDir.removeRecursively(&error)) {
|
}
|
||||||
reportWarningOrError(Tr::tr("Failed to clean \"%1\" from the previous build, with "
|
|
||||||
"error:\n%2").arg(androidDir.toUserOutput()).arg(error),
|
for (const QString &dir : std::as_const(m_androidDirsToClean)) {
|
||||||
Task::TaskType::Error);
|
const FilePath androidDir = FilePath::fromString(dir);
|
||||||
emit finished(false);
|
if (!dir.isEmpty() && androidDir.exists()) {
|
||||||
return;
|
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),
|
||||||
|
Task::TaskType::Error);
|
||||||
|
return SetupResult::StopWithError;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
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
|
||||||
if (buildType() == BuildConfiguration::BuildType::Debug) {
|
if (buildType() == BuildConfiguration::BuildType::Debug) {
|
||||||
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(kit());
|
QtSupport::QtVersion *version = QtSupport::QtKitAspect::qtVersion(kit());
|
||||||
if (version && version->qtVersion() >= QVersionNumber(5, 14)
|
if (version && version->qtVersion() >= QVersionNumber(5, 14)
|
||||||
&& version->qtVersion() <= QVersionNumber(5, 15, 0)) {
|
&& version->qtVersion() <= QVersionNumber(5, 15, 0)) {
|
||||||
const QString assetsDebugDir = nativeAndroidBuildPath().append(
|
const QString assetsDebugDir = nativeAndroidBuildPath().append(
|
||||||
"/assets/--Added-by-androiddeployqt--/");
|
"/assets/--Added-by-androiddeployqt--/");
|
||||||
QDir dir;
|
QDir dir;
|
||||||
if (!dir.exists(assetsDebugDir))
|
if (!dir.exists(assetsDebugDir))
|
||||||
dir.mkpath(assetsDebugDir);
|
dir.mkpath(assetsDebugDir);
|
||||||
|
|
||||||
QFile file(assetsDebugDir + "debugger.command");
|
QFile file(assetsDebugDir + "debugger.command");
|
||||||
if (file.open(QIODevice::WriteOnly)) {
|
if (file.open(QIODevice::WriteOnly)) {
|
||||||
qCDebug(packageInstallationStepLog, "Successful added %s to the package.",
|
qCDebug(packageInstallationStepLog, "Successful added %s to the package.",
|
||||||
qPrintable(file.fileName()));
|
qPrintable(file.fileName()));
|
||||||
} else {
|
} else {
|
||||||
qCDebug(packageInstallationStepLog,
|
qCDebug(packageInstallationStepLog,
|
||||||
"Cannot add %s to the package. The QML debugger might not work properly.",
|
"Cannot add %s to the package. The QML debugger might not work properly.",
|
||||||
qPrintable(file.fileName()));
|
qPrintable(file.fileName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
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