RemoteLinux/Qnx: Disentangle deploy step factories further

Change-Id: I5d6c9a6de05bf8284be13f877642de39f7c3d22d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-03-28 18:22:17 +02:00
parent 3cd0dad3d4
commit a8abb5ca50
8 changed files with 81 additions and 99 deletions

View File

@@ -4,6 +4,7 @@
#include "devicecheckbuildstep.h" #include "devicecheckbuildstep.h"
#include "../kitinformation.h" #include "../kitinformation.h"
#include "../projectexplorerconstants.h"
#include "../projectexplorertr.h" #include "../projectexplorertr.h"
#include "devicemanager.h" #include "devicemanager.h"
@@ -12,16 +13,19 @@
#include <QMessageBox> #include <QMessageBox>
using namespace ProjectExplorer; namespace ProjectExplorer {
DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl, Utils::Id id) class DeviceCheckBuildStep : public BuildStep
{
public:
DeviceCheckBuildStep(BuildStepList *bsl, Utils::Id id)
: BuildStep(bsl, id) : BuildStep(bsl, id)
{ {
setWidgetExpandedByDefault(false); setWidgetExpandedByDefault(false);
} }
bool DeviceCheckBuildStep::init() bool init() override
{ {
IDevice::ConstPtr device = DeviceKitAspect::device(kit()); IDevice::ConstPtr device = DeviceKitAspect::device(kit());
if (!device) { if (!device) {
Utils::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(kit()); Utils::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(kit());
@@ -53,19 +57,17 @@ bool DeviceCheckBuildStep::init()
} }
return true; return true;
}
void doRun() override { emit finished(true); }
};
// Factory
DeviceCheckBuildStepFactory::DeviceCheckBuildStepFactory()
{
registerStep<DeviceCheckBuildStep>(Constants::DEVICE_CHECK_STEP);
setDisplayName(Tr::tr("Check for a configured device"));
} }
void DeviceCheckBuildStep::doRun() } // ProjectExplorer
{
emit finished(true);
}
Utils::Id DeviceCheckBuildStep::stepId()
{
return "ProjectExplorer.DeviceCheckBuildStep";
}
QString DeviceCheckBuildStep::displayName()
{
return Tr::tr("Check for a configured device");
}

View File

@@ -8,18 +8,10 @@
namespace ProjectExplorer { namespace ProjectExplorer {
class PROJECTEXPLORER_EXPORT DeviceCheckBuildStep : public BuildStep class PROJECTEXPLORER_EXPORT DeviceCheckBuildStepFactory : public BuildStepFactory
{ {
Q_OBJECT
public: public:
DeviceCheckBuildStep(BuildStepList *bsl, Utils::Id id); DeviceCheckBuildStepFactory();
bool init() override;
void doRun() override;
static Utils::Id stepId();
static QString displayName();
}; };
} // namespace ProjectExplorer } // ProjectExplorer

View File

@@ -134,6 +134,7 @@ const char BUILDSTEPS_DEPLOY[] = "ProjectExplorer.BuildSteps.Deploy";
const char COPY_FILE_STEP[] = "ProjectExplorer.CopyFileStep"; const char COPY_FILE_STEP[] = "ProjectExplorer.CopyFileStep";
const char COPY_DIRECTORY_STEP[] = "ProjectExplorer.CopyDirectoryStep"; const char COPY_DIRECTORY_STEP[] = "ProjectExplorer.CopyDirectoryStep";
const char DEVICE_CHECK_STEP[] = "ProjectExplorer.DeviceCheckBuildStep";
// Language // Language

View File

@@ -15,5 +15,6 @@ const char QNX_QNX_OS_TYPE[] = "QnxOsType"; // Also used for device type.
const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain"; const char QNX_TOOLCHAIN_ID[] = "Qnx.QccToolChain";
const char QNX_TMP_DIR[] = "/tmp"; // /var/run is root:root drwxr-xr-x const char QNX_TMP_DIR[] = "/tmp"; // /var/run is root:root drwxr-xr-x
const char QNX_DIRECT_UPLOAD_STEP_ID[] ="Qnx.DirectUploadStep";
} // Qnx::Constants } // Qnx::Constants

View File

@@ -43,21 +43,22 @@ using namespace ProjectExplorer;
namespace Qnx::Internal { namespace Qnx::Internal {
class QnxUploadStep : public RemoteLinux::GenericDirectUploadStep // FIXME: Remove...
class QnxUploadStepFactory : public RemoteLinux::GenericDirectUploadStepFactory
{ {
public: public:
QnxUploadStep(BuildStepList *bsl, Utils::Id id) : GenericDirectUploadStep(bsl, id) {} QnxUploadStepFactory()
static Utils::Id stepId() { return "Qnx.DirectUploadStep"; } {
registerStep<RemoteLinux::GenericDirectUploadStep>(Constants::QNX_DIRECT_UPLOAD_STEP_ID);
}
}; };
template <class Step> template <class Factory>
class GenericQnxDeployStepFactory : public BuildStepFactory class QnxDeployStepFactory : public RemoteLinux::MakeInstallStepFactory
{ {
public: public:
GenericQnxDeployStepFactory() QnxDeployStepFactory()
{ {
registerStep<Step>(Step::stepId());
setDisplayName(Step::displayName());
setSupportedConfiguration(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID); setSupportedConfiguration(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
} }
@@ -78,8 +79,8 @@ public:
return prj->deploymentKnowledge() == DeploymentKnowledge::Bad return prj->deploymentKnowledge() == DeploymentKnowledge::Bad
&& prj->hasMakeInstallEquivalent(); && prj->hasMakeInstallEquivalent();
}); });
addInitialStep(DeviceCheckBuildStep::stepId()); addInitialStep(ProjectExplorer::Constants::DEVICE_CHECK_STEP);
addInitialStep(QnxUploadStep::stepId()); addInitialStep(Constants::QNX_DIRECT_UPLOAD_STEP_ID);
} }
}; };
@@ -95,9 +96,9 @@ public:
QnxQtVersionFactory qtVersionFactory; QnxQtVersionFactory qtVersionFactory;
QnxDeviceFactory deviceFactory; QnxDeviceFactory deviceFactory;
QnxDeployConfigurationFactory deployConfigFactory; QnxDeployConfigurationFactory deployConfigFactory;
GenericQnxDeployStepFactory<QnxUploadStep> directUploadDeployFactory; QnxDeployStepFactory<QnxUploadStepFactory> directUploadDeployFactory;
GenericQnxDeployStepFactory<RemoteLinux::MakeInstallStep> makeInstallDeployFactory; QnxDeployStepFactory<RemoteLinux::MakeInstallStepFactory> makeInstallDeployFactory;
GenericQnxDeployStepFactory<DeviceCheckBuildStep> checkBuildDeployFactory; QnxDeployStepFactory<DeviceCheckBuildStepFactory> checkBuildDeployFactory;
QnxRunConfigurationFactory runConfigFactory; QnxRunConfigurationFactory runConfigFactory;
QnxSettingsPage settingsPage; QnxSettingsPage settingsPage;
QnxToolChainFactory toolChainFactory; QnxToolChainFactory toolChainFactory;

View File

@@ -322,16 +322,6 @@ GenericDirectUploadStep::~GenericDirectUploadStep()
delete d; delete d;
} }
Utils::Id GenericDirectUploadStep::stepId()
{
return Constants::DirectUploadStepId;
}
QString GenericDirectUploadStep::displayName()
{
return Tr::tr("Upload files via SFTP");
}
// Factory // Factory
GenericDirectUploadStepFactory::GenericDirectUploadStepFactory() GenericDirectUploadStepFactory::GenericDirectUploadStepFactory()
@@ -340,4 +330,4 @@ GenericDirectUploadStepFactory::GenericDirectUploadStepFactory()
setDisplayName(Tr::tr("Upload files via SFTP")); setDisplayName(Tr::tr("Upload files via SFTP"));
} }
} //namespace RemoteLinux } // RemoteLinux

View File

@@ -20,9 +20,6 @@ public:
bool isDeploymentNecessary() const final; bool isDeploymentNecessary() const final;
Utils::Tasking::Group deployRecipe() final; Utils::Tasking::Group deployRecipe() final;
static Utils::Id stepId();
static QString displayName();
private: private:
friend class GenericDirectUploadStepPrivate; friend class GenericDirectUploadStepPrivate;
class GenericDirectUploadStepPrivate *d; class GenericDirectUploadStepPrivate *d;

View File

@@ -34,16 +34,14 @@ using namespace Utils;
namespace RemoteLinux { namespace RemoteLinux {
namespace Internal { namespace Internal {
template <class Step> template <class Factory>
class GenericDeployStepFactory : public ProjectExplorer::BuildStepFactory class RemoteLinuxDeployStepFactory : public Factory
{ {
public: public:
GenericDeployStepFactory() RemoteLinuxDeployStepFactory()
{ {
registerStep<Step>(Step::stepId()); Factory::setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux);
setDisplayName(Step::displayName()); Factory::setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
setSupportedConfiguration(RemoteLinux::Constants::DeployToGenericLinux);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
} }
}; };
@@ -56,11 +54,11 @@ public:
RemoteLinuxDeployConfigurationFactory deployConfigurationFactory; RemoteLinuxDeployConfigurationFactory deployConfigurationFactory;
TarPackageCreationStepFactory tarPackageCreationStepFactory; TarPackageCreationStepFactory tarPackageCreationStepFactory;
TarPackageDeployStepFactory tarPackageDeployStepFactory; TarPackageDeployStepFactory tarPackageDeployStepFactory;
GenericDeployStepFactory<GenericDirectUploadStep> genericDirectUploadStepFactory; RemoteLinuxDeployStepFactory<GenericDirectUploadStepFactory> genericDirectUploadStepFactory;
GenericDeployStepFactory<RsyncDeployStep> rsyncDeployStepFactory; RemoteLinuxDeployStepFactory<RsyncDeployStepFactory> rsyncDeployStepFactory;
CustomCommandDeployStepFactory customCommandDeployStepFactory; CustomCommandDeployStepFactory customCommandDeployStepFactory;
KillAppStepFactory killAppStepFactory; KillAppStepFactory killAppStepFactory;
GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory; RemoteLinuxDeployStepFactory<MakeInstallStepFactory> makeInstallStepFactory;
RemoteLinuxRunWorkerFactory runWorkerFactory; RemoteLinuxRunWorkerFactory runWorkerFactory;
RemoteLinuxDebugWorkerFactory debugWorkerFactory; RemoteLinuxDebugWorkerFactory debugWorkerFactory;
RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory; RemoteLinuxQmlToolingWorkerFactory qmlToolingWorkerFactory;