RemoteLinux: Slimmer interface of tarpackagedeploystep handling

Change-Id: Iae162718226182dd5d5af87c2aae260a9f8c7b45
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2022-06-02 18:01:30 +02:00
parent d76458a8b6
commit 5c7925a03c
3 changed files with 51 additions and 48 deletions

View File

@@ -75,7 +75,7 @@ public:
RemoteLinuxCustomRunConfigurationFactory customRunConfigurationFactory; RemoteLinuxCustomRunConfigurationFactory customRunConfigurationFactory;
RemoteLinuxDeployConfigurationFactory deployConfigurationFactory; RemoteLinuxDeployConfigurationFactory deployConfigurationFactory;
GenericDeployStepFactory<TarPackageCreationStep> tarPackageCreationStepFactory; GenericDeployStepFactory<TarPackageCreationStep> tarPackageCreationStepFactory;
GenericDeployStepFactory<TarPackageDeployStep> tarPackageDeployStepFactory; TarPackageDeployStepFactory tarPackageDeployStepFactory;
GenericDeployStepFactory<GenericDirectUploadStep> genericDirectUploadStepFactory; GenericDeployStepFactory<GenericDirectUploadStep> genericDirectUploadStepFactory;
GenericDeployStepFactory<RsyncDeployStep> rsyncDeployStepFactory; GenericDeployStepFactory<RsyncDeployStep> rsyncDeployStepFactory;
GenericDeployStepFactory<CustomCommandDeployStep> customCommandDeployStepFactory; GenericDeployStepFactory<CustomCommandDeployStep> customCommandDeployStepFactory;

View File

@@ -26,18 +26,18 @@
#include "tarpackagedeploystep.h" #include "tarpackagedeploystep.h"
#include "abstractremotelinuxdeployservice.h" #include "abstractremotelinuxdeployservice.h"
#include "abstractremotelinuxdeploystep.h"
#include "remotelinux_constants.h" #include "remotelinux_constants.h"
#include "tarpackagecreationstep.h" #include "tarpackagecreationstep.h"
#include <projectexplorer/deployconfiguration.h> #include <projectexplorer/deployconfiguration.h>
#include <projectexplorer/devicesupport/filetransfer.h> #include <projectexplorer/devicesupport/filetransfer.h>
#include <projectexplorer/devicesupport/idevice.h> #include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/projectexplorerconstants.h>
#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;
@@ -49,10 +49,11 @@ class TarPackageInstaller : public QObject
Q_OBJECT Q_OBJECT
public: public:
TarPackageInstaller(QObject *parent = nullptr); TarPackageInstaller();
void installPackage(const ProjectExplorer::IDeviceConstPtr &deviceConfig, void installPackage(const IDeviceConstPtr &deviceConfig,
const QString &packageFilePath, bool removePackageFile); const QString &packageFilePath,
bool removePackageFile);
void cancelInstallation(); void cancelInstallation();
signals: signals:
@@ -66,8 +67,7 @@ private:
QtcProcess m_killer; QtcProcess m_killer;
}; };
TarPackageInstaller::TarPackageInstaller(QObject *parent) TarPackageInstaller::TarPackageInstaller()
: QObject(parent)
{ {
connect(&m_installer, &QtcProcess::readyReadStandardOutput, this, [this] { connect(&m_installer, &QtcProcess::readyReadStandardOutput, this, [this] {
emit stdoutData(QString::fromUtf8(m_installer.readAllStandardOutput())); emit stdoutData(QString::fromUtf8(m_installer.readAllStandardOutput()));
@@ -230,11 +230,14 @@ void TarPackageDeployService::setFinished()
handleDeploymentDone(); handleDeploymentDone();
} }
} // namespace Internal // TarPackageDeployStep
using namespace Internal; class TarPackageDeployStep : public AbstractRemoteLinuxDeployStep
{
Q_DECLARE_TR_FUNCTIONS(RemoteLinux::Internal::TarPackageDeployStep)
TarPackageDeployStep::TarPackageDeployStep(BuildStepList *bsl, Id id) public:
TarPackageDeployStep(BuildStepList *bsl, Id id)
: AbstractRemoteLinuxDeployStep(bsl, id) : AbstractRemoteLinuxDeployStep(bsl, id)
{ {
auto service = createDeployService<TarPackageDeployService>(); auto service = createDeployService<TarPackageDeployService>();
@@ -257,17 +260,20 @@ TarPackageDeployStep::TarPackageDeployStep(BuildStepList *bsl, Id id)
return service->isDeploymentPossible(); return service->isDeploymentPossible();
}); });
} }
};
Id TarPackageDeployStep::stepId()
// TarPackageDeployStepFactory
TarPackageDeployStepFactory::TarPackageDeployStepFactory()
{ {
return Constants::TarPackageDeployStepId; registerStep<TarPackageDeployStep>(Constants::TarPackageDeployStepId);
setDisplayName(TarPackageDeployStep::tr("Deploy tarball via SFTP upload"));
setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
} }
QString TarPackageDeployStep::displayName() } // Internal
{ } // RemoteLinux
return tr("Deploy tarball via SFTP upload");
}
} //namespace RemoteLinux
#include "tarpackagedeploystep.moc" #include "tarpackagedeploystep.moc"

View File

@@ -25,19 +25,16 @@
#pragma once #pragma once
#include "abstractremotelinuxdeploystep.h" #include <projectexplorer/buildstep.h>
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal {
class TarPackageDeployStep : public AbstractRemoteLinuxDeployStep class TarPackageDeployStepFactory : public ProjectExplorer::BuildStepFactory
{ {
Q_OBJECT
public: public:
TarPackageDeployStep(ProjectExplorer::BuildStepList *bsl, Utils::Id id); TarPackageDeployStepFactory();
static Utils::Id stepId();
static QString displayName();
}; };
} //namespace RemoteLinux } // Internal
} // RemoteLinux