AbstractRemoteLinuxDeployStep: Make recipe return GroupItem

There is no need for extra nested Group item in deployRecipe()
overloads, as sometimes it's just one task, like in case of
QdbStopApplicationStep or CustomCommandDeployStep.

Change-Id: I89cdb703c24198f3cbdfb17d0317e40f1929c376
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Jarek Kobus
2023-07-10 09:25:59 +02:00
parent 181b5ee28b
commit 02ffee322b
9 changed files with 22 additions and 22 deletions

View File

@@ -36,7 +36,7 @@ public:
}
private:
Group deployRecipe() final
GroupItem deployRecipe() final
{
const auto setupHandler = [this](Process &process) {
QString remoteExe;
@@ -64,7 +64,7 @@ private:
const auto errorHandler = [this](const Process &process) {
addErrorMessage(Tr::tr("Remote process failed: %1").arg(process.errorString()));
};
return Group { ProcessTask(setupHandler, doneHandler, errorHandler) };
return ProcessTask(setupHandler, doneHandler, errorHandler);
}
SelectionAspect selection{this};

View File

@@ -34,10 +34,10 @@ public:
setInternalInitializer([this] { return isDeploymentPossible(); });
}
Group deployRecipe() final;
GroupItem deployRecipe() final;
};
Group QdbStopApplicationStep::deployRecipe()
GroupItem QdbStopApplicationStep::deployRecipe()
{
const auto setupHandler = [this](Process &process) {
const auto device = DeviceKitAspect::device(target()->kit());
@@ -71,7 +71,7 @@ Group QdbStopApplicationStep::deployRecipe()
addErrorMessage(failureMessage);
}
};
return Group { ProcessTask(setupHandler, doneHandler, errorHandler) };
return ProcessTask(setupHandler, doneHandler, errorHandler);
}
// QdbStopApplicationStepFactory

View File

@@ -117,7 +117,7 @@ void AbstractRemoteLinuxDeployStep::doRun()
QTC_ASSERT(!d->m_taskTree, return);
d->m_taskTree.reset(new TaskTree(runRecipe()));
d->m_taskTree.reset(new TaskTree({runRecipe()}));
const auto endHandler = [this] {
d->m_taskTree.release()->deleteLater();
handleFinished();
@@ -185,7 +185,7 @@ bool AbstractRemoteLinuxDeployStep::isDeploymentNecessary() const
return true;
}
Group AbstractRemoteLinuxDeployStep::runRecipe()
GroupItem AbstractRemoteLinuxDeployStep::runRecipe()
{
const auto onSetup = [this] {
const auto canDeploy = isDeploymentPossible();

View File

@@ -11,7 +11,7 @@
#include <QObject>
namespace ProjectExplorer { class DeployableFile; }
namespace Tasking { class Group; }
namespace Tasking { class GroupItem; }
namespace RemoteLinux {
@@ -53,8 +53,8 @@ protected:
private:
virtual bool isDeploymentNecessary() const;
virtual Tasking::Group deployRecipe() = 0;
Tasking::Group runRecipe();
virtual Tasking::GroupItem deployRecipe() = 0;
Tasking::GroupItem runRecipe();
Internal::AbstractRemoteLinuxDeployStepPrivate *d;
};

View File

@@ -38,7 +38,7 @@ public:
expected_str<void> isDeploymentPossible() const final;
private:
Group deployRecipe() final;
GroupItem deployRecipe() final;
StringAspect commandLine{this};
};
@@ -51,7 +51,7 @@ expected_str<void> CustomCommandDeployStep::isDeploymentPossible() const
return AbstractRemoteLinuxDeployStep::isDeploymentPossible();
}
Group CustomCommandDeployStep::deployRecipe()
GroupItem CustomCommandDeployStep::deployRecipe()
{
const auto setupHandler = [this](Process &process) {
addProgressMessage(Tr::tr("Starting remote command \"%1\"...").arg(commandLine()));
@@ -77,7 +77,7 @@ Group CustomCommandDeployStep::deployRecipe()
.arg(process.exitCode()));
}
};
return Group { ProcessTask(setupHandler, doneHandler, errorHandler) };
return ProcessTask(setupHandler, doneHandler, errorHandler);
}

View File

@@ -55,7 +55,7 @@ public:
}
bool isDeploymentNecessary() const final;
Group deployRecipe() final;
GroupItem deployRecipe() final;
QDateTime timestampFromStat(const DeployableFile &file, Process *statProc);
@@ -255,7 +255,7 @@ GroupItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &s
return TaskTreeTask(setupChmodHandler);
}
Group GenericDirectUploadStep::deployRecipe()
GroupItem GenericDirectUploadStep::deployRecipe()
{
const auto preFilesToStat = [this](UploadStorage *storage) {
QList<DeployableFile> filesToStat;

View File

@@ -38,12 +38,12 @@ public:
private:
bool isDeploymentNecessary() const final { return !m_remoteExecutable.isEmpty(); }
Group deployRecipe() final;
GroupItem deployRecipe() final;
FilePath m_remoteExecutable;
};
Group KillAppStep::deployRecipe()
GroupItem KillAppStep::deployRecipe()
{
const auto setupHandler = [this](DeviceProcessKiller &killer) {
killer.setProcessPath(m_remoteExecutable);
@@ -57,7 +57,7 @@ Group KillAppStep::deployRecipe()
addProgressMessage(Tr::tr("Failed to kill remote application. "
"Assuming it was not running."));
};
return Group { DeviceProcessKillerTask(setupHandler, doneHandler, errorHandler) };
return DeviceProcessKillerTask(setupHandler, doneHandler, errorHandler);
}
KillAppStepFactory::KillAppStepFactory()

View File

@@ -64,7 +64,7 @@ public:
private:
bool isDeploymentNecessary() const final;
Group deployRecipe() final;
GroupItem deployRecipe() final;
GroupItem mkdirTask();
GroupItem transferTask();
@@ -193,7 +193,7 @@ GroupItem RsyncDeployStep::transferTask()
return FileTransferTask(setupHandler, {}, errorHandler);
}
Group RsyncDeployStep::deployRecipe()
GroupItem RsyncDeployStep::deployRecipe()
{
return Group { mkdirTask(), transferTask() };
}

View File

@@ -54,7 +54,7 @@ public:
private:
QString remoteFilePath() const;
bool isDeploymentNecessary() const final;
Group deployRecipe() final;
GroupItem deployRecipe() final;
GroupItem uploadTask();
GroupItem installTask();
@@ -115,7 +115,7 @@ GroupItem TarPackageDeployStep::installTask()
return ProcessTask(setupHandler, doneHandler, errorHandler);
}
Group TarPackageDeployStep::deployRecipe()
GroupItem TarPackageDeployStep::deployRecipe()
{
return Group { uploadTask(), installTask() };
}