AbstractRemoteLinuxDeployService: Refactor API

Instead of implementing two virtual methods:
- doDeploy
- stopDeployment
provide just one to be implemented:
- deployRecipe

The new method returns task tree description enclosed in
Group recipe. The abstract deploy service constructs the
TaskTree when needed, applies the recipe and starts the tree.

Change-Id: I36e52935f98736dafeea6be32fde5595410db077
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Jarek Kobus
2022-11-24 21:45:00 +01:00
parent bec3b9279b
commit f2f1b7c2d7
10 changed files with 60 additions and 182 deletions

View File

@@ -35,16 +35,14 @@ public:
void setFlags(const QString &flags) { m_flags = flags; }
private:
bool isDeploymentNecessary() const override;
void doDeploy() override;
void stopDeployment() override;
bool isDeploymentNecessary() const final;
Group deployRecipe() final;
TaskItem mkdirTask();
TaskItem transferTask();
mutable FilesToTransfer m_files;
bool m_ignoreMissingFiles = false;
QString m_flags;
std::unique_ptr<TaskTree> m_taskTree;
};
void RsyncDeployService::setDeployableFiles(const QList<DeployableFile> &files)
@@ -110,28 +108,9 @@ TaskItem RsyncDeployService::transferTask()
return Transfer(setupHandler, {}, errorHandler);
}
void RsyncDeployService::doDeploy()
Group RsyncDeployService::deployRecipe()
{
const auto finishHandler = [this] {
m_taskTree.release()->deleteLater();
stopDeployment();
};
const Group root {
mkdirTask(),
transferTask(),
OnGroupDone(finishHandler),
OnGroupError(finishHandler),
};
m_taskTree.reset(new TaskTree(root));
m_taskTree->start();
}
void RsyncDeployService::stopDeployment()
{
m_taskTree.reset();
handleDeploymentDone();
return Group { mkdirTask(), transferTask() };
}
// RsyncDeployStep