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:
@@ -34,10 +34,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
bool isDeploymentNecessary() const final { return true; }
|
bool isDeploymentNecessary() const final { return true; }
|
||||||
|
|
||||||
void doDeploy() final
|
Group deployRecipe() final
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_taskTree, return);
|
|
||||||
|
|
||||||
const auto setupHandler = [this](QtcProcess &process) {
|
const auto setupHandler = [this](QtcProcess &process) {
|
||||||
QString remoteExe;
|
QString remoteExe;
|
||||||
if (RunConfiguration *rc = target()->activeRunConfiguration()) {
|
if (RunConfiguration *rc = target()->activeRunConfiguration()) {
|
||||||
@@ -63,27 +61,10 @@ private:
|
|||||||
const auto errorHandler = [this](const QtcProcess &process) {
|
const auto errorHandler = [this](const QtcProcess &process) {
|
||||||
emit errorMessage(tr("Remote process failed: %1").arg(process.errorString()));
|
emit errorMessage(tr("Remote process failed: %1").arg(process.errorString()));
|
||||||
};
|
};
|
||||||
const auto endHandler = [this] {
|
return Group { Process(setupHandler, doneHandler, errorHandler) };
|
||||||
m_taskTree.release()->deleteLater();
|
|
||||||
stopDeployment();
|
|
||||||
};
|
|
||||||
const Group root {
|
|
||||||
Process(setupHandler, doneHandler, errorHandler),
|
|
||||||
OnGroupDone(endHandler),
|
|
||||||
OnGroupError(endHandler)
|
|
||||||
};
|
|
||||||
m_taskTree.reset(new TaskTree(root));
|
|
||||||
m_taskTree->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void stopDeployment() final
|
|
||||||
{
|
|
||||||
m_taskTree.reset();
|
|
||||||
handleDeploymentDone();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool m_makeDefault = true;
|
bool m_makeDefault = true;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// QdbMakeDefaultAppStep
|
// QdbMakeDefaultAppStep
|
||||||
|
@@ -30,16 +30,11 @@ class QdbStopApplicationService : public RemoteLinux::AbstractRemoteLinuxDeployS
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool isDeploymentNecessary() const final { return true; }
|
bool isDeploymentNecessary() const final { return true; }
|
||||||
void doDeploy() final;
|
Group deployRecipe() final;
|
||||||
void stopDeployment() final;
|
|
||||||
|
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void QdbStopApplicationService::doDeploy()
|
Group QdbStopApplicationService::deployRecipe()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_taskTree, return);
|
|
||||||
|
|
||||||
const auto setupHandler = [this](QtcProcess &process) {
|
const auto setupHandler = [this](QtcProcess &process) {
|
||||||
const auto device = DeviceKitAspect::device(target()->kit());
|
const auto device = DeviceKitAspect::device(target()->kit());
|
||||||
QTC_CHECK(device);
|
QTC_CHECK(device);
|
||||||
@@ -75,24 +70,11 @@ void QdbStopApplicationService::doDeploy()
|
|||||||
}
|
}
|
||||||
return GroupConfig();
|
return GroupConfig();
|
||||||
};
|
};
|
||||||
const auto rootEndHandler = [this] {
|
|
||||||
m_taskTree.release()->deleteLater();
|
|
||||||
stopDeployment();
|
|
||||||
};
|
|
||||||
const Group root {
|
const Group root {
|
||||||
DynamicSetup(rootSetupHandler),
|
DynamicSetup(rootSetupHandler),
|
||||||
Process(setupHandler, doneHandler, errorHandler),
|
Process(setupHandler, doneHandler, errorHandler)
|
||||||
OnGroupDone(rootEndHandler),
|
|
||||||
OnGroupError(rootEndHandler)
|
|
||||||
};
|
};
|
||||||
m_taskTree.reset(new TaskTree(root));
|
return root;
|
||||||
m_taskTree->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void QdbStopApplicationService::stopDeployment()
|
|
||||||
{
|
|
||||||
m_taskTree.reset();
|
|
||||||
handleDeploymentDone();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// QdbStopApplicationStep
|
// QdbStopApplicationStep
|
||||||
|
@@ -12,12 +12,13 @@
|
|||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/tasktree.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
using namespace Utils;
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -34,6 +35,7 @@ public:
|
|||||||
|
|
||||||
DeploymentTimeInfo deployTimes;
|
DeploymentTimeInfo deployTimes;
|
||||||
State state = Inactive;
|
State state = Inactive;
|
||||||
|
std::unique_ptr<TaskTree> m_taskTree;
|
||||||
};
|
};
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
@@ -146,4 +148,23 @@ void AbstractRemoteLinuxDeployService::handleDeploymentDone()
|
|||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractRemoteLinuxDeployService::doDeploy()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(!d->m_taskTree, return);
|
||||||
|
d->m_taskTree.reset(new TaskTree(deployRecipe()));
|
||||||
|
const auto endHandler = [this] {
|
||||||
|
d->m_taskTree.release()->deleteLater();
|
||||||
|
handleDeploymentDone();
|
||||||
|
};
|
||||||
|
connect(d->m_taskTree.get(), &TaskTree::done, this, endHandler);
|
||||||
|
connect(d->m_taskTree.get(), &TaskTree::errorOccurred, this, endHandler);
|
||||||
|
d->m_taskTree->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AbstractRemoteLinuxDeployService::stopDeployment()
|
||||||
|
{
|
||||||
|
d->m_taskTree.reset();
|
||||||
|
handleDeploymentDone();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
@@ -16,6 +16,8 @@ class Kit;
|
|||||||
class Target;
|
class Target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Utils::Tasking { class Group; }
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
namespace Internal { class AbstractRemoteLinuxDeployServicePrivate; }
|
namespace Internal { class AbstractRemoteLinuxDeployServicePrivate; }
|
||||||
|
|
||||||
@@ -77,8 +79,9 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool isDeploymentNecessary() const = 0;
|
virtual bool isDeploymentNecessary() const = 0;
|
||||||
virtual void doDeploy() = 0;
|
virtual Utils::Tasking::Group deployRecipe() = 0;
|
||||||
virtual void stopDeployment() = 0;
|
void doDeploy();
|
||||||
|
void stopDeployment();
|
||||||
|
|
||||||
Internal::AbstractRemoteLinuxDeployServicePrivate * const d;
|
Internal::AbstractRemoteLinuxDeployServicePrivate * const d;
|
||||||
};
|
};
|
||||||
|
@@ -24,17 +24,15 @@ class CustomCommandDeployService : public AbstractRemoteLinuxDeployService
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void setCommandLine(const QString &commandLine);
|
void setCommandLine(const QString &commandLine);
|
||||||
CheckResult isDeploymentPossible() const override;
|
CheckResult isDeploymentPossible() const final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doDeploy() override;
|
Group deployRecipe() final;
|
||||||
void stopDeployment() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isDeploymentNecessary() const override { return true; }
|
bool isDeploymentNecessary() const final { return true; }
|
||||||
|
|
||||||
QString m_commandLine;
|
QString m_commandLine;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void CustomCommandDeployService::setCommandLine(const QString &commandLine)
|
void CustomCommandDeployService::setCommandLine(const QString &commandLine)
|
||||||
@@ -50,10 +48,8 @@ CheckResult CustomCommandDeployService::isDeploymentPossible() const
|
|||||||
return AbstractRemoteLinuxDeployService::isDeploymentPossible();
|
return AbstractRemoteLinuxDeployService::isDeploymentPossible();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CustomCommandDeployService::doDeploy()
|
Group CustomCommandDeployService::deployRecipe()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_taskTree, return);
|
|
||||||
|
|
||||||
const auto setupHandler = [this](QtcProcess &process) {
|
const auto setupHandler = [this](QtcProcess &process) {
|
||||||
emit progressMessage(Tr::tr("Starting remote command \"%1\"...").arg(m_commandLine));
|
emit progressMessage(Tr::tr("Starting remote command \"%1\"...").arg(m_commandLine));
|
||||||
process.setCommand({deviceConfiguration()->filePath("/bin/sh"),
|
process.setCommand({deviceConfiguration()->filePath("/bin/sh"),
|
||||||
@@ -78,23 +74,7 @@ void CustomCommandDeployService::doDeploy()
|
|||||||
.arg(process.exitCode()));
|
.arg(process.exitCode()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const auto endHandler = [this] {
|
return Group { Process(setupHandler, doneHandler, errorHandler) };
|
||||||
m_taskTree.release()->deleteLater();
|
|
||||||
stopDeployment();
|
|
||||||
};
|
|
||||||
const Group root {
|
|
||||||
Process(setupHandler, doneHandler, errorHandler),
|
|
||||||
OnGroupDone(endHandler),
|
|
||||||
OnGroupError(endHandler)
|
|
||||||
};
|
|
||||||
m_taskTree.reset(new TaskTree(root));
|
|
||||||
m_taskTree->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CustomCommandDeployService::stopDeployment()
|
|
||||||
{
|
|
||||||
m_taskTree.reset();
|
|
||||||
handleDeploymentDone();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CustomCommandDeployStep : public AbstractRemoteLinuxDeployStep
|
class CustomCommandDeployStep : public AbstractRemoteLinuxDeployStep
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QList>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
@@ -55,7 +54,6 @@ public:
|
|||||||
IncrementalDeployment incremental = IncrementalDeployment::NotSupported;
|
IncrementalDeployment incremental = IncrementalDeployment::NotSupported;
|
||||||
bool ignoreMissingFiles = false;
|
bool ignoreMissingFiles = false;
|
||||||
QList<DeployableFile> deployableFiles;
|
QList<DeployableFile> deployableFiles;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QList<DeployableFile> collectFilesToUpload(const DeployableFile &deployable)
|
QList<DeployableFile> collectFilesToUpload(const DeployableFile &deployable)
|
||||||
@@ -125,12 +123,6 @@ bool GenericDirectUploadService::isDeploymentNecessary() const
|
|||||||
return !d->deployableFiles.isEmpty();
|
return !d->deployableFiles.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericDirectUploadService::stopDeployment()
|
|
||||||
{
|
|
||||||
d->m_taskTree.reset();
|
|
||||||
handleDeploymentDone();
|
|
||||||
}
|
|
||||||
|
|
||||||
QDateTime GenericDirectUploadServicePrivate::timestampFromStat(const DeployableFile &file,
|
QDateTime GenericDirectUploadServicePrivate::timestampFromStat(const DeployableFile &file,
|
||||||
QtcProcess *statProc)
|
QtcProcess *statProc)
|
||||||
{
|
{
|
||||||
@@ -291,19 +283,8 @@ TaskItem GenericDirectUploadServicePrivate::chmodTree(const TreeStorage<UploadSt
|
|||||||
return Tree {setupChmodHandler};
|
return Tree {setupChmodHandler};
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericDirectUploadService::doDeploy()
|
Group GenericDirectUploadService::deployRecipe()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!d->m_taskTree, return);
|
|
||||||
|
|
||||||
const auto endHandler = [this] {
|
|
||||||
d->m_taskTree.release()->deleteLater();
|
|
||||||
stopDeployment();
|
|
||||||
};
|
|
||||||
const auto doneHandler = [this, endHandler] {
|
|
||||||
emit progressMessage(Tr::tr("All files successfully deployed."));
|
|
||||||
endHandler();
|
|
||||||
};
|
|
||||||
|
|
||||||
const auto preFilesToStat = [this](UploadStorage *storage) {
|
const auto preFilesToStat = [this](UploadStorage *storage) {
|
||||||
QList<DeployableFile> filesToStat;
|
QList<DeployableFile> filesToStat;
|
||||||
for (const DeployableFile &file : std::as_const(d->deployableFiles)) {
|
for (const DeployableFile &file : std::as_const(d->deployableFiles)) {
|
||||||
@@ -333,6 +314,9 @@ void GenericDirectUploadService::doDeploy()
|
|||||||
if (timestamp.isValid())
|
if (timestamp.isValid())
|
||||||
saveDeploymentTimeStamp(file, timestamp);
|
saveDeploymentTimeStamp(file, timestamp);
|
||||||
};
|
};
|
||||||
|
const auto doneHandler = [this] {
|
||||||
|
emit progressMessage(Tr::tr("All files successfully deployed."));
|
||||||
|
};
|
||||||
|
|
||||||
const TreeStorage<UploadStorage> storage;
|
const TreeStorage<UploadStorage> storage;
|
||||||
const Group root {
|
const Group root {
|
||||||
@@ -343,12 +327,9 @@ void GenericDirectUploadService::doDeploy()
|
|||||||
d->chmodTree(storage),
|
d->chmodTree(storage),
|
||||||
d->statTree(storage, postFilesToStat, postStatEndHandler)
|
d->statTree(storage, postFilesToStat, postStatEndHandler)
|
||||||
},
|
},
|
||||||
OnGroupDone(doneHandler),
|
OnGroupDone(doneHandler)
|
||||||
OnGroupError(endHandler)
|
|
||||||
};
|
};
|
||||||
|
return root;
|
||||||
d->m_taskTree.reset(new TaskTree(root));
|
|
||||||
d->m_taskTree->start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace RemoteLinux
|
} //namespace RemoteLinux
|
||||||
|
@@ -21,18 +21,16 @@ class REMOTELINUX_EXPORT GenericDirectUploadService : public AbstractRemoteLinux
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GenericDirectUploadService(QObject *parent = nullptr);
|
GenericDirectUploadService(QObject *parent = nullptr);
|
||||||
~GenericDirectUploadService() override;
|
~GenericDirectUploadService();
|
||||||
|
|
||||||
void setDeployableFiles(const QList<ProjectExplorer::DeployableFile> &deployableFiles);
|
void setDeployableFiles(const QList<ProjectExplorer::DeployableFile> &deployableFiles);
|
||||||
void setIncrementalDeployment(IncrementalDeployment incremental);
|
void setIncrementalDeployment(IncrementalDeployment incremental);
|
||||||
void setIgnoreMissingFiles(bool ignoreMissingFiles);
|
void setIgnoreMissingFiles(bool ignoreMissingFiles);
|
||||||
|
|
||||||
protected:
|
|
||||||
bool isDeploymentNecessary() const override;
|
|
||||||
void doDeploy() override;
|
|
||||||
void stopDeployment() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool isDeploymentNecessary() const final;
|
||||||
|
Utils::Tasking::Group deployRecipe() final;
|
||||||
|
|
||||||
friend class Internal::GenericDirectUploadServicePrivate;
|
friend class Internal::GenericDirectUploadServicePrivate;
|
||||||
Internal::GenericDirectUploadServicePrivate * const d;
|
Internal::GenericDirectUploadServicePrivate * const d;
|
||||||
};
|
};
|
||||||
|
@@ -27,19 +27,14 @@ public:
|
|||||||
void setRemoteExecutable(const FilePath &filePath) { m_remoteExecutable = filePath; }
|
void setRemoteExecutable(const FilePath &filePath) { m_remoteExecutable = filePath; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isDeploymentNecessary() const override { return !m_remoteExecutable.isEmpty(); }
|
bool isDeploymentNecessary() const final { return !m_remoteExecutable.isEmpty(); }
|
||||||
|
Group deployRecipe() final;
|
||||||
void doDeploy() override;
|
|
||||||
void stopDeployment() override;
|
|
||||||
|
|
||||||
FilePath m_remoteExecutable;
|
FilePath m_remoteExecutable;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void KillAppService::doDeploy()
|
Group KillAppService::deployRecipe()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_taskTree, return);
|
|
||||||
|
|
||||||
const auto setupHandler = [this](DeviceProcessKiller &killer) {
|
const auto setupHandler = [this](DeviceProcessKiller &killer) {
|
||||||
killer.setProcessPath(m_remoteExecutable);
|
killer.setProcessPath(m_remoteExecutable);
|
||||||
emit progressMessage(Tr::tr("Trying to kill \"%1\" on remote device...")
|
emit progressMessage(Tr::tr("Trying to kill \"%1\" on remote device...")
|
||||||
@@ -52,25 +47,7 @@ void KillAppService::doDeploy()
|
|||||||
emit progressMessage(Tr::tr("Failed to kill remote application. "
|
emit progressMessage(Tr::tr("Failed to kill remote application. "
|
||||||
"Assuming it was not running."));
|
"Assuming it was not running."));
|
||||||
};
|
};
|
||||||
|
return Group { Killer(setupHandler, doneHandler, errorHandler) };
|
||||||
const auto endHandler = [this] {
|
|
||||||
m_taskTree.release()->deleteLater();
|
|
||||||
stopDeployment();
|
|
||||||
};
|
|
||||||
|
|
||||||
const Group root {
|
|
||||||
Killer(setupHandler, doneHandler, errorHandler),
|
|
||||||
OnGroupDone(endHandler),
|
|
||||||
OnGroupError(endHandler)
|
|
||||||
};
|
|
||||||
m_taskTree.reset(new TaskTree(root));
|
|
||||||
m_taskTree->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KillAppService::stopDeployment()
|
|
||||||
{
|
|
||||||
m_taskTree.reset();
|
|
||||||
handleDeploymentDone();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class KillAppStep : public AbstractRemoteLinuxDeployStep
|
class KillAppStep : public AbstractRemoteLinuxDeployStep
|
||||||
|
@@ -35,16 +35,14 @@ public:
|
|||||||
void setFlags(const QString &flags) { m_flags = flags; }
|
void setFlags(const QString &flags) { m_flags = flags; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isDeploymentNecessary() const override;
|
bool isDeploymentNecessary() const final;
|
||||||
void doDeploy() override;
|
Group deployRecipe() final;
|
||||||
void stopDeployment() override;
|
|
||||||
TaskItem mkdirTask();
|
TaskItem mkdirTask();
|
||||||
TaskItem transferTask();
|
TaskItem transferTask();
|
||||||
|
|
||||||
mutable FilesToTransfer m_files;
|
mutable FilesToTransfer m_files;
|
||||||
bool m_ignoreMissingFiles = false;
|
bool m_ignoreMissingFiles = false;
|
||||||
QString m_flags;
|
QString m_flags;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void RsyncDeployService::setDeployableFiles(const QList<DeployableFile> &files)
|
void RsyncDeployService::setDeployableFiles(const QList<DeployableFile> &files)
|
||||||
@@ -110,28 +108,9 @@ TaskItem RsyncDeployService::transferTask()
|
|||||||
return Transfer(setupHandler, {}, errorHandler);
|
return Transfer(setupHandler, {}, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RsyncDeployService::doDeploy()
|
Group RsyncDeployService::deployRecipe()
|
||||||
{
|
{
|
||||||
const auto finishHandler = [this] {
|
return Group { mkdirTask(), transferTask() };
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RsyncDeployStep
|
// RsyncDeployStep
|
||||||
|
@@ -16,8 +16,6 @@
|
|||||||
#include <utils/processinterface.h>
|
#include <utils/processinterface.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QDateTime>
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
using namespace Utils::Tasking;
|
using namespace Utils::Tasking;
|
||||||
@@ -31,15 +29,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString remoteFilePath() const;
|
QString remoteFilePath() const;
|
||||||
|
bool isDeploymentNecessary() const final;
|
||||||
bool isDeploymentNecessary() const override;
|
Group deployRecipe() final;
|
||||||
void doDeploy() override;
|
|
||||||
void stopDeployment() override;
|
|
||||||
TaskItem uploadTask();
|
TaskItem uploadTask();
|
||||||
TaskItem installTask();
|
TaskItem installTask();
|
||||||
|
|
||||||
FilePath m_packageFilePath;
|
FilePath m_packageFilePath;
|
||||||
std::unique_ptr<TaskTree> m_taskTree;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void TarPackageDeployService::setPackageFilePath(const FilePath &filePath)
|
void TarPackageDeployService::setPackageFilePath(const FilePath &filePath)
|
||||||
@@ -102,28 +97,9 @@ TaskItem TarPackageDeployService::installTask()
|
|||||||
return Process(setupHandler, doneHandler, errorHandler);
|
return Process(setupHandler, doneHandler, errorHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TarPackageDeployService::doDeploy()
|
Group TarPackageDeployService::deployRecipe()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_taskTree, return);
|
return Group { uploadTask(), installTask() };
|
||||||
|
|
||||||
const auto finishHandler = [this] {
|
|
||||||
m_taskTree.release()->deleteLater();
|
|
||||||
stopDeployment();
|
|
||||||
};
|
|
||||||
const Group root {
|
|
||||||
uploadTask(),
|
|
||||||
installTask(),
|
|
||||||
OnGroupDone(finishHandler),
|
|
||||||
OnGroupError(finishHandler),
|
|
||||||
};
|
|
||||||
m_taskTree.reset(new TaskTree(root));
|
|
||||||
m_taskTree->start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void TarPackageDeployService::stopDeployment()
|
|
||||||
{
|
|
||||||
m_taskTree.reset();
|
|
||||||
handleDeploymentDone();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TarPackageDeployStep
|
// TarPackageDeployStep
|
||||||
|
Reference in New Issue
Block a user