forked from qt-creator/qt-creator
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user