PE/Qnx: Disentangle BuildStep factories from downstream further

The idea is to only expose factories with properties and not the actual
step implementations.

Change-Id: I72dc3944993f898f12b6a9bec11317f87e45c648
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2023-04-03 09:50:51 +02:00
parent ee52d204e6
commit 9c182911d3
4 changed files with 33 additions and 18 deletions

View File

@@ -380,6 +380,29 @@ QString BuildStepFactory::displayName() const
return m_displayName; return m_displayName;
} }
void BuildStepFactory::cloneStep(Utils::Id exitstingStepId, Utils::Id overrideNewStepId)
{
m_stepId = {};
m_creator = {};
for (BuildStepFactory *factory : BuildStepFactory::allBuildStepFactories()) {
if (factory->m_stepId == exitstingStepId) {
m_creator = factory->m_creator;
m_stepId = factory->m_stepId;
m_displayName = factory->m_displayName;
// Other bits are intentionally not copied as they are unlikely to be
// useful in the cloner's context. The cloner can/has to finish the
// setup on its own.
break;
}
}
// Existence should be guaranteed by plugin dependencies. In case it fails,
// bark and keep the factory in a state where the invalid m_stepId keeps it
// inaction.
QTC_ASSERT(m_creator, return);
if (overrideNewStepId.isValid())
m_stepId = overrideNewStepId;
}
void BuildStepFactory::setDisplayName(const QString &displayName) void BuildStepFactory::setDisplayName(const QString &displayName)
{ {
m_displayName = displayName; m_displayName = displayName;
@@ -432,6 +455,7 @@ Id BuildStepFactory::stepId() const
BuildStep *BuildStepFactory::create(BuildStepList *parent) BuildStep *BuildStepFactory::create(BuildStepList *parent)
{ {
QTC_ASSERT(m_creator, return nullptr);
BuildStep *step = m_creator(parent); BuildStep *step = m_creator(parent);
step->setDefaultDisplayName(m_displayName); step->setDefaultDisplayName(m_displayName);
return step; return step;

View File

@@ -171,6 +171,7 @@ protected:
m_stepId = id; m_stepId = id;
m_creator = [id](BuildStepList *bsl) { return new BuildStepType(bsl, id); }; m_creator = [id](BuildStepList *bsl) { return new BuildStepType(bsl, id); };
} }
void cloneStep(Utils::Id exitstingStepId, Utils::Id overrideNewStepId = {});
void setSupportedStepList(Utils::Id id); void setSupportedStepList(Utils::Id id);
void setSupportedStepLists(const QList<Utils::Id> &ids); void setSupportedStepLists(const QList<Utils::Id> &ids);

View File

@@ -36,6 +36,7 @@
#include "devicesupport/desktopdevice.h" #include "devicesupport/desktopdevice.h"
#include "devicesupport/desktopdevicefactory.h" #include "devicesupport/desktopdevicefactory.h"
#include "devicesupport/devicemanager.h" #include "devicesupport/devicemanager.h"
#include "devicesupport/devicecheckbuildstep.h"
#include "devicesupport/devicesettingspage.h" #include "devicesupport/devicesettingspage.h"
#include "devicesupport/sshsettings.h" #include "devicesupport/sshsettings.h"
#include "devicesupport/sshsettingspage.h" #include "devicesupport/sshsettingspage.h"
@@ -726,6 +727,7 @@ public:
cmakeRunConfigFactory.runConfigurationId() cmakeRunConfigFactory.runConfigurationId()
}}; }};
DeviceCheckBuildStepFactory deviceCheckBuildStepFactory;
SanitizerOutputFormatterFactory sanitizerFormatterFactory; SanitizerOutputFormatterFactory sanitizerFormatterFactory;
}; };

View File

@@ -33,8 +33,6 @@
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <remotelinux/genericdirectuploadstep.h>
#include <remotelinux/makeinstallstep.h>
#include <remotelinux/remotelinux_constants.h> #include <remotelinux/remotelinux_constants.h>
#include <QAction> #include <QAction>
@@ -43,22 +41,12 @@ using namespace ProjectExplorer;
namespace Qnx::Internal { namespace Qnx::Internal {
// FIXME: Remove... class QnxDeployStepFactory : public BuildStepFactory
class QnxUploadStepFactory : public RemoteLinux::GenericDirectUploadStepFactory
{ {
public: public:
QnxUploadStepFactory() QnxDeployStepFactory(Utils::Id existingStepId, Utils::Id overrideId = {})
{
registerStep<RemoteLinux::GenericDirectUploadStep>(Constants::QNX_DIRECT_UPLOAD_STEP_ID);
}
};
template <class Factory>
class QnxDeployStepFactory : public RemoteLinux::MakeInstallStepFactory
{
public:
QnxDeployStepFactory()
{ {
cloneStep(existingStepId, overrideId);
setSupportedConfiguration(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID); setSupportedConfiguration(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
} }
@@ -96,9 +84,9 @@ public:
QnxQtVersionFactory qtVersionFactory; QnxQtVersionFactory qtVersionFactory;
QnxDeviceFactory deviceFactory; QnxDeviceFactory deviceFactory;
QnxDeployConfigurationFactory deployConfigFactory; QnxDeployConfigurationFactory deployConfigFactory;
QnxDeployStepFactory<QnxUploadStepFactory> directUploadDeployFactory; QnxDeployStepFactory directUploadDeployFactory{RemoteLinux::Constants::DirectUploadStepId,
QnxDeployStepFactory<RemoteLinux::MakeInstallStepFactory> makeInstallDeployFactory; Constants::QNX_DIRECT_UPLOAD_STEP_ID};
QnxDeployStepFactory<DeviceCheckBuildStepFactory> checkBuildDeployFactory; QnxDeployStepFactory makeInstallStepFactory{RemoteLinux::Constants::MakeInstallStepId};
QnxRunConfigurationFactory runConfigFactory; QnxRunConfigurationFactory runConfigFactory;
QnxSettingsPage settingsPage; QnxSettingsPage settingsPage;
QnxToolChainFactory toolChainFactory; QnxToolChainFactory toolChainFactory;