RemoteLinux: Move deployservice ownership to AbstractRemoteLinuxDeployStep

Change-Id: I12cfa0d2cdb171d381e6fde6b0e71fc0c098d746
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-06-13 17:03:56 +02:00
parent 7ceb26defc
commit 77e8e1707c
22 changed files with 108 additions and 241 deletions

View File

@@ -33,13 +33,6 @@
namespace Qdb { namespace Qdb {
namespace Internal { namespace Internal {
class QdbMakeDefaultAppStepPrivate
{
public:
QdbMakeDefaultAppService deployService;
bool makeDefault;
};
class QdbConfigWidget : public ProjectExplorer::BuildStepConfigWidget class QdbConfigWidget : public ProjectExplorer::BuildStepConfigWidget
{ {
public: public:
@@ -78,18 +71,14 @@ private:
QdbMakeDefaultAppStep::QdbMakeDefaultAppStep(ProjectExplorer::BuildStepList *bsl) QdbMakeDefaultAppStep::QdbMakeDefaultAppStep(ProjectExplorer::BuildStepList *bsl)
: AbstractRemoteLinuxDeployStep(bsl, stepId()) : AbstractRemoteLinuxDeployStep(bsl, stepId())
{ {
d = new QdbMakeDefaultAppStepPrivate;
setDefaultDisplayName(stepDisplayName()); setDefaultDisplayName(stepDisplayName());
setInternalInitializer([this] { auto service = createDeployService<QdbMakeDefaultAppService>();
d->deployService.setMakeDefault(d->makeDefault);
return deployService()->isDeploymentPossible();
});
}
QdbMakeDefaultAppStep::~QdbMakeDefaultAppStep() setInternalInitializer([this, service] {
{ service->setMakeDefault(m_makeDefault);
delete d; return service->isDeploymentPossible();
});
} }
Core::Id QdbMakeDefaultAppStep::stepId() Core::Id QdbMakeDefaultAppStep::stepId()
@@ -97,11 +86,6 @@ Core::Id QdbMakeDefaultAppStep::stepId()
return "Qdb.MakeDefaultAppStep"; return "Qdb.MakeDefaultAppStep";
} }
RemoteLinux::AbstractRemoteLinuxDeployService *QdbMakeDefaultAppStep::deployService() const
{
return &d->deployService;
}
ProjectExplorer::BuildStepConfigWidget *QdbMakeDefaultAppStep::createConfigWidget() ProjectExplorer::BuildStepConfigWidget *QdbMakeDefaultAppStep::createConfigWidget()
{ {
return new QdbConfigWidget(this); return new QdbConfigWidget(this);
@@ -114,12 +98,12 @@ QString QdbMakeDefaultAppStep::stepDisplayName()
void QdbMakeDefaultAppStep::setMakeDefault(bool makeDefault) void QdbMakeDefaultAppStep::setMakeDefault(bool makeDefault)
{ {
d->makeDefault = makeDefault; m_makeDefault = makeDefault;
} }
bool QdbMakeDefaultAppStep::makeDefault() const bool QdbMakeDefaultAppStep::makeDefault() const
{ {
return d->makeDefault; return m_makeDefault;
} }
static QString makeDefaultKey() static QString makeDefaultKey()
@@ -131,14 +115,14 @@ bool QdbMakeDefaultAppStep::fromMap(const QVariantMap &map)
{ {
if (!AbstractRemoteLinuxDeployStep::fromMap(map)) if (!AbstractRemoteLinuxDeployStep::fromMap(map))
return false; return false;
d->makeDefault = map.value(makeDefaultKey()).toBool(); m_makeDefault = map.value(makeDefaultKey()).toBool();
return true; return true;
} }
QVariantMap QdbMakeDefaultAppStep::toMap() const QVariantMap QdbMakeDefaultAppStep::toMap() const
{ {
QVariantMap map = AbstractRemoteLinuxDeployStep::toMap(); QVariantMap map = AbstractRemoteLinuxDeployStep::toMap();
map.insert(makeDefaultKey(), d->makeDefault); map.insert(makeDefaultKey(), m_makeDefault);
return map; return map;
} }

View File

@@ -30,8 +30,6 @@
namespace Qdb { namespace Qdb {
namespace Internal { namespace Internal {
class QdbMakeDefaultAppStepPrivate;
class QdbMakeDefaultAppStep : public RemoteLinux::AbstractRemoteLinuxDeployStep class QdbMakeDefaultAppStep : public RemoteLinux::AbstractRemoteLinuxDeployStep
{ {
Q_OBJECT Q_OBJECT
@@ -39,7 +37,6 @@ class QdbMakeDefaultAppStep : public RemoteLinux::AbstractRemoteLinuxDeployStep
public: public:
explicit QdbMakeDefaultAppStep(ProjectExplorer::BuildStepList *bsl); explicit QdbMakeDefaultAppStep(ProjectExplorer::BuildStepList *bsl);
~QdbMakeDefaultAppStep() override;
static Core::Id stepId(); static Core::Id stepId();
static QString stepDisplayName(); static QString stepDisplayName();
@@ -47,13 +44,12 @@ public:
bool makeDefault() const; bool makeDefault() const;
protected: protected:
RemoteLinux::AbstractRemoteLinuxDeployService *deployService() const override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override; ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool fromMap(const QVariantMap &map) override; bool fromMap(const QVariantMap &map) override;
QVariantMap toMap() const override; QVariantMap toMap() const override;
private: private:
QdbMakeDefaultAppStepPrivate *d; bool m_makeDefault = false;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -30,24 +30,15 @@
namespace Qdb { namespace Qdb {
namespace Internal { namespace Internal {
class QdbStopApplicationStepPrivate
{
public:
QdbStopApplicationService deployService;
};
QdbStopApplicationStep::QdbStopApplicationStep(ProjectExplorer::BuildStepList *bsl) QdbStopApplicationStep::QdbStopApplicationStep(ProjectExplorer::BuildStepList *bsl)
: AbstractRemoteLinuxDeployStep(bsl, stepId()) : AbstractRemoteLinuxDeployStep(bsl, stepId())
{ {
d = new QdbStopApplicationStepPrivate; auto service = createDeployService<QdbStopApplicationService>();
setDefaultDisplayName(stepDisplayName()); setDefaultDisplayName(stepDisplayName());
setWidgetExpandedByDefault(false); setWidgetExpandedByDefault(false);
setInternalInitializer([this] { return deployService()->isDeploymentPossible(); });
}
QdbStopApplicationStep::~QdbStopApplicationStep() setInternalInitializer([service] { return service->isDeploymentPossible(); });
{
delete d;
} }
Core::Id QdbStopApplicationStep::stepId() Core::Id QdbStopApplicationStep::stepId()
@@ -55,11 +46,6 @@ Core::Id QdbStopApplicationStep::stepId()
return "Qdb.StopApplicationStep"; return "Qdb.StopApplicationStep";
} }
RemoteLinux::AbstractRemoteLinuxDeployService *QdbStopApplicationStep::deployService() const
{
return &d->deployService;
}
QString QdbStopApplicationStep::stepDisplayName() QString QdbStopApplicationStep::stepDisplayName()
{ {
return tr("Stop already running application"); return tr("Stop already running application");

View File

@@ -30,23 +30,14 @@
namespace Qdb { namespace Qdb {
namespace Internal { namespace Internal {
class QdbStopApplicationStepPrivate;
class QdbStopApplicationStep : public RemoteLinux::AbstractRemoteLinuxDeployStep class QdbStopApplicationStep : public RemoteLinux::AbstractRemoteLinuxDeployStep
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit QdbStopApplicationStep(ProjectExplorer::BuildStepList *bsl); explicit QdbStopApplicationStep(ProjectExplorer::BuildStepList *bsl);
~QdbStopApplicationStep() final;
static Core::Id stepId(); static Core::Id stepId();
static QString stepDisplayName(); static QString stepDisplayName();
protected:
RemoteLinux::AbstractRemoteLinuxDeployService *deployService() const final;
private:
QdbStopApplicationStepPrivate *d;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -41,6 +41,8 @@ class AbstractRemoteLinuxDeployStepPrivate
public: public:
bool hasError; bool hasError;
std::function<CheckResult()> internalInit; std::function<CheckResult()> internalInit;
std::function<void()> runPreparer;
AbstractRemoteLinuxDeployService *deployService = nullptr;
}; };
} // namespace Internal } // namespace Internal
@@ -55,8 +57,19 @@ void AbstractRemoteLinuxDeployStep::setInternalInitializer(const std::function<C
d->internalInit = init; d->internalInit = init;
} }
void AbstractRemoteLinuxDeployStep::setRunPreparer(const std::function<void ()> &prep)
{
d->runPreparer = prep;
}
void AbstractRemoteLinuxDeployStep::setDeployService(AbstractRemoteLinuxDeployService *service)
{
d->deployService = service;
}
AbstractRemoteLinuxDeployStep::~AbstractRemoteLinuxDeployStep() AbstractRemoteLinuxDeployStep::~AbstractRemoteLinuxDeployStep()
{ {
delete d->deployService;
delete d; delete d;
} }
@@ -64,18 +77,18 @@ bool AbstractRemoteLinuxDeployStep::fromMap(const QVariantMap &map)
{ {
if (!BuildStep::fromMap(map)) if (!BuildStep::fromMap(map))
return false; return false;
deployService()->importDeployTimes(map); d->deployService->importDeployTimes(map);
return true; return true;
} }
QVariantMap AbstractRemoteLinuxDeployStep::toMap() const QVariantMap AbstractRemoteLinuxDeployStep::toMap() const
{ {
return BuildStep::toMap().unite(deployService()->exportDeployTimes()); return BuildStep::toMap().unite(d->deployService->exportDeployTimes());
} }
bool AbstractRemoteLinuxDeployStep::init() bool AbstractRemoteLinuxDeployStep::init()
{ {
deployService()->setTarget(target()); d->deployService->setTarget(target());
QTC_ASSERT(d->internalInit, return false); QTC_ASSERT(d->internalInit, return false);
const CheckResult canDeploy = d->internalInit(); const CheckResult canDeploy = d->internalInit();
@@ -88,21 +101,24 @@ bool AbstractRemoteLinuxDeployStep::init()
void AbstractRemoteLinuxDeployStep::doRun() void AbstractRemoteLinuxDeployStep::doRun()
{ {
connect(deployService(), &AbstractRemoteLinuxDeployService::errorMessage, if (d->runPreparer)
d->runPreparer();
connect(d->deployService, &AbstractRemoteLinuxDeployService::errorMessage,
this, &AbstractRemoteLinuxDeployStep::handleErrorMessage); this, &AbstractRemoteLinuxDeployStep::handleErrorMessage);
connect(deployService(), &AbstractRemoteLinuxDeployService::progressMessage, connect(d->deployService, &AbstractRemoteLinuxDeployService::progressMessage,
this, &AbstractRemoteLinuxDeployStep::handleProgressMessage); this, &AbstractRemoteLinuxDeployStep::handleProgressMessage);
connect(deployService(), &AbstractRemoteLinuxDeployService::warningMessage, connect(d->deployService, &AbstractRemoteLinuxDeployService::warningMessage,
this, &AbstractRemoteLinuxDeployStep::handleWarningMessage); this, &AbstractRemoteLinuxDeployStep::handleWarningMessage);
connect(deployService(), &AbstractRemoteLinuxDeployService::stdOutData, connect(d->deployService, &AbstractRemoteLinuxDeployService::stdOutData,
this, &AbstractRemoteLinuxDeployStep::handleStdOutData); this, &AbstractRemoteLinuxDeployStep::handleStdOutData);
connect(deployService(), &AbstractRemoteLinuxDeployService::stdErrData, connect(d->deployService, &AbstractRemoteLinuxDeployService::stdErrData,
this, &AbstractRemoteLinuxDeployStep::handleStdErrData); this, &AbstractRemoteLinuxDeployStep::handleStdErrData);
connect(deployService(), &AbstractRemoteLinuxDeployService::finished, connect(d->deployService, &AbstractRemoteLinuxDeployService::finished,
this, &AbstractRemoteLinuxDeployStep::handleFinished); this, &AbstractRemoteLinuxDeployStep::handleFinished);
d->hasError = false; d->hasError = false;
deployService()->start(); d->deployService->start();
} }
void AbstractRemoteLinuxDeployStep::doCancel() void AbstractRemoteLinuxDeployStep::doCancel()
@@ -113,7 +129,7 @@ void AbstractRemoteLinuxDeployStep::doCancel()
emit addOutput(tr("User requests deployment to stop; cleaning up."), emit addOutput(tr("User requests deployment to stop; cleaning up."),
OutputFormat::NormalMessage); OutputFormat::NormalMessage);
d->hasError = true; d->hasError = true;
deployService()->stop(); d->deployService->stop();
} }
void AbstractRemoteLinuxDeployStep::handleProgressMessage(const QString &message) void AbstractRemoteLinuxDeployStep::handleProgressMessage(const QString &message)
@@ -144,7 +160,7 @@ void AbstractRemoteLinuxDeployStep::handleFinished()
emit addOutput(tr("Deploy step failed."), OutputFormat::ErrorMessage); emit addOutput(tr("Deploy step failed."), OutputFormat::ErrorMessage);
else else
emit addOutput(tr("Deploy step finished."), OutputFormat::NormalMessage); emit addOutput(tr("Deploy step finished."), OutputFormat::NormalMessage);
disconnect(deployService(), nullptr, this, nullptr); disconnect(d->deployService, nullptr, this, nullptr);
emit finished(!d->hasError); emit finished(!d->hasError);
} }

View File

@@ -41,20 +41,29 @@ class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployStep : public ProjectExplorer:
public: public:
~AbstractRemoteLinuxDeployStep() override; ~AbstractRemoteLinuxDeployStep() override;
virtual AbstractRemoteLinuxDeployService *deployService() const = 0;
protected: protected:
bool fromMap(const QVariantMap &map) override; bool fromMap(const QVariantMap &map) override;
QVariantMap toMap() const override; QVariantMap toMap() const override;
bool init() override; bool init() override;
void doRun() override; void doRun() final;
void doCancel() override; void doCancel() override;
explicit AbstractRemoteLinuxDeployStep(ProjectExplorer::BuildStepList *bsl, Core::Id id); explicit AbstractRemoteLinuxDeployStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
void setInternalInitializer(const std::function<CheckResult()> &init); void setInternalInitializer(const std::function<CheckResult()> &init);
void setRunPreparer(const std::function<void()> &prep);
template <class T>
T *createDeployService()
{
T *service = new T;
setDeployService(service);
return service;
}
private: private:
void setDeployService(AbstractRemoteLinuxDeployService *service);
void handleProgressMessage(const QString &message); void handleProgressMessage(const QString &message);
void handleErrorMessage(const QString &message); void handleErrorMessage(const QString &message);
void handleWarningMessage(const QString &message); void handleWarningMessage(const QString &message);

View File

@@ -60,9 +60,8 @@ public:
using namespace Internal; using namespace Internal;
AbstractUploadAndInstallPackageService::AbstractUploadAndInstallPackageService(QObject *parent) AbstractUploadAndInstallPackageService::AbstractUploadAndInstallPackageService()
: AbstractRemoteLinuxDeployService(parent), : d(new AbstractUploadAndInstallPackageServicePrivate)
d(new AbstractUploadAndInstallPackageServicePrivate)
{ {
} }

View File

@@ -41,7 +41,7 @@ public:
void setPackageFilePath(const QString &filePath); void setPackageFilePath(const QString &filePath);
protected: protected:
explicit AbstractUploadAndInstallPackageService(QObject *parent); AbstractUploadAndInstallPackageService();
~AbstractUploadAndInstallPackageService() override; ~AbstractUploadAndInstallPackageService() override;
QString packageFilePath() const; QString packageFilePath() const;

View File

@@ -34,20 +34,11 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal {
class GenericDirectUploadStepPrivate
{
public:
GenericDirectUploadService deployService;
};
} // namespace Internal
GenericDirectUploadStep::GenericDirectUploadStep(BuildStepList *bsl) GenericDirectUploadStep::GenericDirectUploadStep(BuildStepList *bsl)
: AbstractRemoteLinuxDeployStep(bsl, stepId()) : AbstractRemoteLinuxDeployStep(bsl, stepId())
{ {
d = new Internal::GenericDirectUploadStepPrivate; auto service = createDeployService<GenericDirectUploadService>();
auto incremental = addAspect<BaseBoolAspect>(); auto incremental = addAspect<BaseBoolAspect>();
incremental->setSettingsKey("RemoteLinux.GenericDirectUploadStep.Incremental"); incremental->setSettingsKey("RemoteLinux.GenericDirectUploadStep.Incremental");
@@ -60,30 +51,20 @@ GenericDirectUploadStep::GenericDirectUploadStep(BuildStepList *bsl)
ignoreMissingFiles->setLabel(tr("Ignore missing files")); ignoreMissingFiles->setLabel(tr("Ignore missing files"));
ignoreMissingFiles->setValue(false); ignoreMissingFiles->setValue(false);
setInternalInitializer([this, incremental, ignoreMissingFiles] { setInternalInitializer([incremental, ignoreMissingFiles, service] {
d->deployService.setIncrementalDeployment(incremental->value()); service->setIncrementalDeployment(incremental->value());
d->deployService.setIgnoreMissingFiles(ignoreMissingFiles->value()); service->setIgnoreMissingFiles(ignoreMissingFiles->value());
return d->deployService.isDeploymentPossible(); return service->isDeploymentPossible();
});
setRunPreparer([this, service] {
service->setDeployableFiles(target()->deploymentData().allFiles());
}); });
setDefaultDisplayName(displayName()); setDefaultDisplayName(displayName());
} }
GenericDirectUploadStep::~GenericDirectUploadStep() GenericDirectUploadStep::~GenericDirectUploadStep() = default;
{
delete d;
}
GenericDirectUploadService *GenericDirectUploadStep::deployService() const
{
return &d->deployService;
}
void GenericDirectUploadStep::doRun()
{
d->deployService.setDeployableFiles(target()->deploymentData().allFiles());
AbstractRemoteLinuxDeployStep::doRun();
}
Core::Id GenericDirectUploadStep::stepId() Core::Id GenericDirectUploadStep::stepId()
{ {

View File

@@ -26,11 +26,9 @@
#pragma once #pragma once
#include "abstractremotelinuxdeploystep.h" #include "abstractremotelinuxdeploystep.h"
#include "genericdirectuploadservice.h"
#include "remotelinux_export.h" #include "remotelinux_export.h"
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { class GenericDirectUploadStepPrivate; }
class REMOTELINUX_EXPORT GenericDirectUploadStep : public AbstractRemoteLinuxDeployStep class REMOTELINUX_EXPORT GenericDirectUploadStep : public AbstractRemoteLinuxDeployStep
{ {
@@ -42,12 +40,6 @@ public:
static Core::Id stepId(); static Core::Id stepId();
static QString displayName(); static QString displayName();
private:
GenericDirectUploadService *deployService() const override;
void doRun() override;
Internal::GenericDirectUploadStepPrivate *d;
}; };
} //namespace RemoteLinux } //namespace RemoteLinux

View File

@@ -34,57 +34,36 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal {
const char PathToCheckKey[] = "RemoteLinux.CheckForFreeDiskSpaceStep.PathToCheck";
const char RequiredSpaceKey[] = "RemoteLinux.CheckForFreeDiskSpaceStep.RequiredSpace";
class RemoteLinuxCheckForFreeDiskSpaceStepPrivate
{
public:
RemoteLinuxCheckForFreeDiskSpaceService deployService;
};
} // namespace Internal
using namespace Internal;
RemoteLinuxCheckForFreeDiskSpaceStep::RemoteLinuxCheckForFreeDiskSpaceStep(BuildStepList *bsl) RemoteLinuxCheckForFreeDiskSpaceStep::RemoteLinuxCheckForFreeDiskSpaceStep(BuildStepList *bsl)
: AbstractRemoteLinuxDeployStep(bsl, stepId()) : AbstractRemoteLinuxDeployStep(bsl, stepId())
{ {
d = new Internal::RemoteLinuxCheckForFreeDiskSpaceStepPrivate;
setDefaultDisplayName(displayName()); setDefaultDisplayName(displayName());
auto service = createDeployService<RemoteLinuxCheckForFreeDiskSpaceService>();
auto pathToCheckAspect = addAspect<BaseStringAspect>(); auto pathToCheckAspect = addAspect<BaseStringAspect>();
pathToCheckAspect->setSettingsKey(PathToCheckKey); pathToCheckAspect->setSettingsKey("RemoteLinux.CheckForFreeDiskSpaceStep.PathToCheck");
pathToCheckAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay); pathToCheckAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
pathToCheckAspect->setValue("/"); pathToCheckAspect->setValue("/");
pathToCheckAspect->setLabelText(tr("Remote path to check for free space:")); pathToCheckAspect->setLabelText(tr("Remote path to check for free space:"));
auto requiredSpaceAspect = addAspect<BaseIntegerAspect>(); auto requiredSpaceAspect = addAspect<BaseIntegerAspect>();
requiredSpaceAspect->setSettingsKey(RequiredSpaceKey); requiredSpaceAspect->setSettingsKey("RemoteLinux.CheckForFreeDiskSpaceStep.RequiredSpace");
requiredSpaceAspect->setLabel(tr("Required disk space:")); requiredSpaceAspect->setLabel(tr("Required disk space:"));
requiredSpaceAspect->setDisplayScaleFactor(1024*1024); requiredSpaceAspect->setDisplayScaleFactor(1024*1024);
requiredSpaceAspect->setValue(5*1024*1024); requiredSpaceAspect->setValue(5*1024*1024);
requiredSpaceAspect->setSuffix(tr("MB")); requiredSpaceAspect->setSuffix(tr("MB"));
requiredSpaceAspect->setRange(1, std::numeric_limits<int>::max()); requiredSpaceAspect->setRange(1, std::numeric_limits<int>::max());
setInternalInitializer([this, pathToCheckAspect, requiredSpaceAspect] { setInternalInitializer([service, pathToCheckAspect, requiredSpaceAspect] {
d->deployService.setPathToCheck(pathToCheckAspect->value()); service->setPathToCheck(pathToCheckAspect->value());
d->deployService.setRequiredSpaceInBytes(requiredSpaceAspect->value()); service->setRequiredSpaceInBytes(requiredSpaceAspect->value());
return CheckResult::success(); return CheckResult::success();
}); });
} }
RemoteLinuxCheckForFreeDiskSpaceStep::~RemoteLinuxCheckForFreeDiskSpaceStep() RemoteLinuxCheckForFreeDiskSpaceStep::~RemoteLinuxCheckForFreeDiskSpaceStep() = default;
{
delete d;
}
AbstractRemoteLinuxDeployService *RemoteLinuxCheckForFreeDiskSpaceStep::deployService() const
{
return &d->deployService;
}
Core::Id RemoteLinuxCheckForFreeDiskSpaceStep::stepId() Core::Id RemoteLinuxCheckForFreeDiskSpaceStep::stepId()
{ {

View File

@@ -28,23 +28,17 @@
#include "abstractremotelinuxdeploystep.h" #include "abstractremotelinuxdeploystep.h"
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { class RemoteLinuxCheckForFreeDiskSpaceStepPrivate; }
class REMOTELINUX_EXPORT RemoteLinuxCheckForFreeDiskSpaceStep : public AbstractRemoteLinuxDeployStep class REMOTELINUX_EXPORT RemoteLinuxCheckForFreeDiskSpaceStep : public AbstractRemoteLinuxDeployStep
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RemoteLinuxCheckForFreeDiskSpaceStep(ProjectExplorer::BuildStepList *bsl); explicit RemoteLinuxCheckForFreeDiskSpaceStep(ProjectExplorer::BuildStepList *bsl);
~RemoteLinuxCheckForFreeDiskSpaceStep() override; ~RemoteLinuxCheckForFreeDiskSpaceStep() override;
static Core::Id stepId(); static Core::Id stepId();
static QString displayName(); static QString displayName();
protected:
AbstractRemoteLinuxDeployService *deployService() const override;
private:
Internal::RemoteLinuxCheckForFreeDiskSpaceStepPrivate *d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -31,20 +31,11 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal {
class RemoteLinuxCustomCommandDeploymentStepPrivate
{
public:
RemoteLinuxCustomCommandDeployService service;
};
} // namespace Internal
RemoteLinuxCustomCommandDeploymentStep::RemoteLinuxCustomCommandDeploymentStep(BuildStepList *bsl) RemoteLinuxCustomCommandDeploymentStep::RemoteLinuxCustomCommandDeploymentStep(BuildStepList *bsl)
: AbstractRemoteLinuxDeployStep(bsl, stepId()) : AbstractRemoteLinuxDeployStep(bsl, stepId())
{ {
d = new Internal::RemoteLinuxCustomCommandDeploymentStepPrivate; auto service = createDeployService<RemoteLinuxCustomCommandDeployService>();
auto commandLine = addAspect<BaseStringAspect>(); auto commandLine = addAspect<BaseStringAspect>();
commandLine->setSettingsKey("RemoteLinuxCustomCommandDeploymentStep.CommandLine"); commandLine->setSettingsKey("RemoteLinuxCustomCommandDeploymentStep.CommandLine");
@@ -53,21 +44,13 @@ RemoteLinuxCustomCommandDeploymentStep::RemoteLinuxCustomCommandDeploymentStep(B
setDefaultDisplayName(displayName()); setDefaultDisplayName(displayName());
setInternalInitializer([this, commandLine] { setInternalInitializer([service, commandLine] {
d->service.setCommandLine(commandLine->value().trimmed()); service->setCommandLine(commandLine->value().trimmed());
return d->service.isDeploymentPossible(); return service->isDeploymentPossible();
}); });
} }
RemoteLinuxCustomCommandDeploymentStep::~RemoteLinuxCustomCommandDeploymentStep() RemoteLinuxCustomCommandDeploymentStep::~RemoteLinuxCustomCommandDeploymentStep() = default;
{
delete d;
}
AbstractRemoteLinuxDeployService *RemoteLinuxCustomCommandDeploymentStep::deployService() const
{
return &d->service;
}
Core::Id RemoteLinuxCustomCommandDeploymentStep::stepId() Core::Id RemoteLinuxCustomCommandDeploymentStep::stepId()
{ {

View File

@@ -28,23 +28,18 @@
#include "abstractremotelinuxdeploystep.h" #include "abstractremotelinuxdeploystep.h"
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { class RemoteLinuxCustomCommandDeploymentStepPrivate; }
class REMOTELINUX_EXPORT RemoteLinuxCustomCommandDeploymentStep class REMOTELINUX_EXPORT RemoteLinuxCustomCommandDeploymentStep
: public AbstractRemoteLinuxDeployStep : public AbstractRemoteLinuxDeployStep
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl); explicit RemoteLinuxCustomCommandDeploymentStep(ProjectExplorer::BuildStepList *bsl);
~RemoteLinuxCustomCommandDeploymentStep() override; ~RemoteLinuxCustomCommandDeploymentStep() override;
static Core::Id stepId(); static Core::Id stepId();
static QString displayName(); static QString displayName();
private:
AbstractRemoteLinuxDeployService *deployService() const override;
Internal::RemoteLinuxCustomCommandDeploymentStepPrivate *d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -35,9 +35,8 @@ public:
}; };
} // namespace Internal } // namespace Internal
RemoteLinuxKillAppService::RemoteLinuxKillAppService(QObject *parent) RemoteLinuxKillAppService::RemoteLinuxKillAppService()
: AbstractRemoteLinuxDeployService(parent), : d(new Internal::RemoteLinuxKillAppServicePrivate)
d(new Internal::RemoteLinuxKillAppServicePrivate)
{ {
} }

View File

@@ -34,7 +34,7 @@ class REMOTELINUX_EXPORT RemoteLinuxKillAppService : public AbstractRemoteLinuxD
{ {
Q_OBJECT Q_OBJECT
public: public:
RemoteLinuxKillAppService(QObject *parent = nullptr); RemoteLinuxKillAppService();
~RemoteLinuxKillAppService() override; ~RemoteLinuxKillAppService() override;
void setRemoteExecutable(const QString &filePath); void setRemoteExecutable(const QString &filePath);

View File

@@ -31,33 +31,28 @@
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QString>
using namespace ProjectExplorer; using namespace ProjectExplorer;
namespace RemoteLinux { namespace RemoteLinux {
RemoteLinuxKillAppStep::RemoteLinuxKillAppStep(BuildStepList *bsl, Core::Id id) RemoteLinuxKillAppStep::RemoteLinuxKillAppStep(BuildStepList *bsl, Core::Id id)
: AbstractRemoteLinuxDeployStep(bsl, id), m_service(new RemoteLinuxKillAppService(this)) : AbstractRemoteLinuxDeployStep(bsl, id)
{ {
auto service = createDeployService<RemoteLinuxKillAppService>();
setDefaultDisplayName(displayName()); setDefaultDisplayName(displayName());
setWidgetExpandedByDefault(false); setWidgetExpandedByDefault(false);
setInternalInitializer([this] { setInternalInitializer([this, service] {
Target * const theTarget = target(); Target * const theTarget = target();
QTC_ASSERT(theTarget, return CheckResult::failure()); QTC_ASSERT(theTarget, return CheckResult::failure());
RunConfiguration * const rc = theTarget->activeRunConfiguration(); RunConfiguration * const rc = theTarget->activeRunConfiguration();
const QString remoteExe = rc ? rc->runnable().executable : QString(); const QString remoteExe = rc ? rc->runnable().executable : QString();
m_service->setRemoteExecutable(remoteExe); service->setRemoteExecutable(remoteExe);
return CheckResult::success(); return CheckResult::success();
}); });
} }
AbstractRemoteLinuxDeployService *RemoteLinuxKillAppStep::deployService() const
{
return m_service;
}
Core::Id RemoteLinuxKillAppStep::stepId() Core::Id RemoteLinuxKillAppStep::stepId()
{ {
return "RemoteLinux.KillAppStep"; return "RemoteLinux.KillAppStep";

View File

@@ -28,7 +28,6 @@
#include "abstractremotelinuxdeploystep.h" #include "abstractremotelinuxdeploystep.h"
namespace RemoteLinux { namespace RemoteLinux {
class RemoteLinuxKillAppService;
class REMOTELINUX_EXPORT RemoteLinuxKillAppStep : public AbstractRemoteLinuxDeployStep class REMOTELINUX_EXPORT RemoteLinuxKillAppStep : public AbstractRemoteLinuxDeployStep
{ {
@@ -39,11 +38,6 @@ public:
static Core::Id stepId(); static Core::Id stepId();
static QString displayName(); static QString displayName();
private:
AbstractRemoteLinuxDeployService *deployService() const override;
RemoteLinuxKillAppService * const m_service;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -177,15 +177,11 @@ void RsyncDeployService::setFinished()
} // namespace Internal } // namespace Internal
class RsyncDeployStep::RsyncDeployStepPrivate
{
public:
Internal::RsyncDeployService deployService;
};
RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl) RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl)
: AbstractRemoteLinuxDeployStep(bsl, stepId()), d(new RsyncDeployStepPrivate) : AbstractRemoteLinuxDeployStep(bsl, stepId())
{ {
auto service = createDeployService<Internal::RsyncDeployService>();
auto flags = addAspect<BaseStringAspect>(); auto flags = addAspect<BaseStringAspect>();
flags->setDisplayStyle(BaseStringAspect::LineEditDisplay); flags->setDisplayStyle(BaseStringAspect::LineEditDisplay);
flags->setSettingsKey("RemoteLinux.RsyncDeployStep.Flags"); flags->setSettingsKey("RemoteLinux.RsyncDeployStep.Flags");
@@ -199,28 +195,18 @@ RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl)
setDefaultDisplayName(displayName()); setDefaultDisplayName(displayName());
setInternalInitializer([this, flags, ignoreMissingFiles] { setInternalInitializer([service, flags, ignoreMissingFiles] {
d->deployService.setIgnoreMissingFiles(ignoreMissingFiles->value()); service->setIgnoreMissingFiles(ignoreMissingFiles->value());
d->deployService.setFlags(flags->value()); service->setFlags(flags->value());
return d->deployService.isDeploymentPossible(); return service->isDeploymentPossible();
});
setRunPreparer([this, service] {
service->setDeployableFiles(target()->deploymentData().allFiles());
}); });
} }
RsyncDeployStep::~RsyncDeployStep() RsyncDeployStep::~RsyncDeployStep() = default;
{
delete d;
}
AbstractRemoteLinuxDeployService *RsyncDeployStep::deployService() const
{
return &d->deployService;
}
void RsyncDeployStep::doRun()
{
d->deployService.setDeployableFiles(target()->deploymentData().allFiles());
AbstractRemoteLinuxDeployStep::doRun();
}
Core::Id RsyncDeployStep::stepId() Core::Id RsyncDeployStep::stepId()
{ {

View File

@@ -54,13 +54,6 @@ public:
static QString defaultFlags(); static QString defaultFlags();
static RsyncCommandLine rsyncCommand(const QSsh::SshConnection &sshConnection, static RsyncCommandLine rsyncCommand(const QSsh::SshConnection &sshConnection,
const QString &flags); const QString &flags);
private:
AbstractRemoteLinuxDeployService *deployService() const override;
void doRun() override;
class RsyncDeployStepPrivate;
RsyncDeployStepPrivate * const d;
}; };
} // namespace RemoteLinux } // namespace RemoteLinux

View File

@@ -44,9 +44,8 @@ public:
using namespace Internal; using namespace Internal;
UploadAndInstallTarPackageService::UploadAndInstallTarPackageService(QObject *parent) UploadAndInstallTarPackageService::UploadAndInstallTarPackageService()
: AbstractUploadAndInstallPackageService(parent), : d(new UploadAndInstallTarPackageServicePrivate)
d(new UploadAndInstallTarPackageServicePrivate)
{ {
} }
@@ -64,11 +63,12 @@ AbstractRemoteLinuxPackageInstaller *UploadAndInstallTarPackageService::packageI
UploadAndInstallTarPackageStep::UploadAndInstallTarPackageStep(BuildStepList *bsl) UploadAndInstallTarPackageStep::UploadAndInstallTarPackageStep(BuildStepList *bsl)
: AbstractRemoteLinuxDeployStep(bsl, stepId()) : AbstractRemoteLinuxDeployStep(bsl, stepId())
{ {
m_deployService = new UploadAndInstallTarPackageService(this); auto service = createDeployService<UploadAndInstallTarPackageService>();
setDefaultDisplayName(displayName()); setDefaultDisplayName(displayName());
setWidgetExpandedByDefault(false); setWidgetExpandedByDefault(false);
setInternalInitializer([this] { setInternalInitializer([this, service] {
const TarPackageCreationStep *pStep = nullptr; const TarPackageCreationStep *pStep = nullptr;
for (BuildStep *step : deployConfiguration()->stepList()->steps()) { for (BuildStep *step : deployConfiguration()->stepList()->steps()) {
@@ -80,8 +80,8 @@ UploadAndInstallTarPackageStep::UploadAndInstallTarPackageStep(BuildStepList *bs
if (!pStep) if (!pStep)
return CheckResult::failure(tr("No tarball creation step found.")); return CheckResult::failure(tr("No tarball creation step found."));
m_deployService->setPackageFilePath(pStep->packageFilePath()); service->setPackageFilePath(pStep->packageFilePath());
return m_deployService->isDeploymentPossible(); return service->isDeploymentPossible();
}); });
} }

View File

@@ -38,7 +38,7 @@ class REMOTELINUX_EXPORT UploadAndInstallTarPackageService : public AbstractUplo
Q_OBJECT Q_OBJECT
public: public:
explicit UploadAndInstallTarPackageService(QObject *parent); UploadAndInstallTarPackageService();
~UploadAndInstallTarPackageService() override; ~UploadAndInstallTarPackageService() override;
private: private:
@@ -57,11 +57,6 @@ public:
static Core::Id stepId(); static Core::Id stepId();
static QString displayName(); static QString displayName();
private:
AbstractRemoteLinuxDeployService *deployService() const override { return m_deployService; }
UploadAndInstallTarPackageService *m_deployService;
}; };
} //namespace RemoteLinux } //namespace RemoteLinux