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

View File

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

View File

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

View File

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

View File

@@ -38,7 +38,7 @@ public:
expected_str<void> isDeploymentPossible() const final; expected_str<void> isDeploymentPossible() const final;
private: private:
Group deployRecipe() final; GroupItem deployRecipe() final;
StringAspect commandLine{this}; StringAspect commandLine{this};
}; };
@@ -51,7 +51,7 @@ expected_str<void> CustomCommandDeployStep::isDeploymentPossible() const
return AbstractRemoteLinuxDeployStep::isDeploymentPossible(); return AbstractRemoteLinuxDeployStep::isDeploymentPossible();
} }
Group CustomCommandDeployStep::deployRecipe() GroupItem CustomCommandDeployStep::deployRecipe()
{ {
const auto setupHandler = [this](Process &process) { const auto setupHandler = [this](Process &process) {
addProgressMessage(Tr::tr("Starting remote command \"%1\"...").arg(commandLine())); addProgressMessage(Tr::tr("Starting remote command \"%1\"...").arg(commandLine()));
@@ -77,7 +77,7 @@ Group CustomCommandDeployStep::deployRecipe()
.arg(process.exitCode())); .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; bool isDeploymentNecessary() const final;
Group deployRecipe() final; GroupItem deployRecipe() final;
QDateTime timestampFromStat(const DeployableFile &file, Process *statProc); QDateTime timestampFromStat(const DeployableFile &file, Process *statProc);
@@ -255,7 +255,7 @@ GroupItem GenericDirectUploadStep::chmodTree(const TreeStorage<UploadStorage> &s
return TaskTreeTask(setupChmodHandler); return TaskTreeTask(setupChmodHandler);
} }
Group GenericDirectUploadStep::deployRecipe() GroupItem GenericDirectUploadStep::deployRecipe()
{ {
const auto preFilesToStat = [this](UploadStorage *storage) { const auto preFilesToStat = [this](UploadStorage *storage) {
QList<DeployableFile> filesToStat; QList<DeployableFile> filesToStat;

View File

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

View File

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

View File

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