RemoteLinux: Streamline RsyncDeployStep interface

Change-Id: I5aa5ff477d1c654fd502575c32af667e436a2129
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2022-08-11 13:50:36 +02:00
parent 0df4d22d35
commit e9d6c0f154
3 changed files with 47 additions and 52 deletions

View File

@@ -58,7 +58,7 @@ public:
TarPackageCreationStepFactory tarPackageCreationStepFactory;
TarPackageDeployStepFactory tarPackageDeployStepFactory;
GenericDeployStepFactory<GenericDirectUploadStep> genericDirectUploadStepFactory;
GenericDeployStepFactory<RsyncDeployStep> rsyncDeployStepFactory;
RsyncDeployStepFactory rsyncDeployStepFactory;
CustomCommandDeployStepFactory customCommandDeployStepFactory;
KillAppStepFactory killAppStepFactory;
GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory;

View File

@@ -3,6 +3,7 @@
#include "rsyncdeploystep.h"
#include "abstractremotelinuxdeploystep.h"
#include "abstractremotelinuxdeployservice.h"
#include "remotelinux_constants.h"
#include "remotelinuxtr.h"
@@ -10,6 +11,7 @@
#include <projectexplorer/deploymentdata.h>
#include <projectexplorer/devicesupport/filetransfer.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/target.h>
@@ -20,13 +22,12 @@
using namespace ProjectExplorer;
using namespace Utils;
namespace RemoteLinux {
namespace Internal {
namespace RemoteLinux::Internal {
class RsyncDeployService : public AbstractRemoteLinuxDeployService
{
public:
RsyncDeployService(QObject *parent = nullptr) : AbstractRemoteLinuxDeployService(parent)
RsyncDeployService()
{
connect(&m_mkdir, &QtcProcess::done, this, [this] {
if (m_mkdir.result() != ProcessResult::FinishedWithSuccess) {
@@ -139,11 +140,14 @@ void RsyncDeployService::setFinished()
handleDeploymentDone();
}
} // namespace Internal
// RsyncDeployStep
RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl, Utils::Id id)
: AbstractRemoteLinuxDeployStep(bsl, id)
class RsyncDeployStep : public AbstractRemoteLinuxDeployStep
{
public:
RsyncDeployStep(BuildStepList *bsl, Id id)
: AbstractRemoteLinuxDeployStep(bsl, id)
{
auto service = createDeployService<Internal::RsyncDeployService>();
auto flags = addAspect<StringAspect>();
@@ -167,18 +171,17 @@ RsyncDeployStep::RsyncDeployStep(BuildStepList *bsl, Utils::Id id)
setRunPreparer([this, service] {
service->setDeployableFiles(target()->deploymentData().allFiles());
});
}
}
};
RsyncDeployStep::~RsyncDeployStep() = default;
// RsyncDeployStepFactory
Utils::Id RsyncDeployStep::stepId()
RsyncDeployStepFactory::RsyncDeployStepFactory()
{
return Constants::RsyncDeployStepId;
registerStep<RsyncDeployStep>(Constants::RsyncDeployStepId);
setDisplayName(Tr::tr("Deploy files via rsync"));
setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
}
QString RsyncDeployStep::displayName()
{
return Tr::tr("Deploy files via rsync");
}
} // RemoteLinux
} // RemoteLinux::Internal

View File

@@ -3,22 +3,14 @@
#pragma once
#include "remotelinux_export.h"
#include <projectexplorer/buildstep.h>
#include "abstractremotelinuxdeploystep.h"
namespace RemoteLinux::Internal {
namespace RemoteLinux {
class REMOTELINUX_EXPORT RsyncDeployStep : public AbstractRemoteLinuxDeployStep
class RsyncDeployStepFactory : public ProjectExplorer::BuildStepFactory
{
Q_OBJECT
public:
RsyncDeployStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id);
~RsyncDeployStep() override;
static Utils::Id stepId();
static QString displayName();
RsyncDeployStepFactory();
};
} // RemoteLinux
} // RemoteLinux::Internal