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

View File

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

View File

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

View File

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

View File

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

View File

@@ -41,20 +41,29 @@ class REMOTELINUX_EXPORT AbstractRemoteLinuxDeployStep : public ProjectExplorer:
public:
~AbstractRemoteLinuxDeployStep() override;
virtual AbstractRemoteLinuxDeployService *deployService() const = 0;
protected:
bool fromMap(const QVariantMap &map) override;
QVariantMap toMap() const override;
bool init() override;
void doRun() override;
void doRun() final;
void doCancel() override;
explicit AbstractRemoteLinuxDeployStep(ProjectExplorer::BuildStepList *bsl, Core::Id id);
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:
void setDeployService(AbstractRemoteLinuxDeployService *service);
void handleProgressMessage(const QString &message);
void handleErrorMessage(const QString &message);
void handleWarningMessage(const QString &message);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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