Qnx: Fix persisting of deploy steps

While the deploy steps re-used from RemoteLinux were created ok when
creating a new QnxDeployConfiguration, they did not survive a restart
(or rather a toMap/fromMap cycle, as the restoring insisted on having
a RemoteLinuxDeployConfiguration).

Since sharing DeployConfiguration*Factory*s is not yet possible, this
patch here creates additional DeployConfigurationFactories creating the
same steps, but insisting on a QnxDeployConfiguration parent.

Task-number: QTCREATORBUG-20248
Change-Id: I70666f79993a1332cd1959ab5e3665797d2401ca
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2018-05-14 15:30:35 +02:00
parent 1fce7ff4f5
commit a86eda329e
3 changed files with 27 additions and 3 deletions

View File

@@ -38,7 +38,7 @@ using namespace ProjectExplorer;
DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl) DeviceCheckBuildStep::DeviceCheckBuildStep(BuildStepList *bsl)
: BuildStep(bsl, stepId()) : BuildStep(bsl, stepId())
{ {
setDefaultDisplayName(stepDisplayName()); setDefaultDisplayName(displayName());
} }
bool DeviceCheckBuildStep::init(QList<const BuildStep *> &earlierSteps) bool DeviceCheckBuildStep::init(QList<const BuildStep *> &earlierSteps)
@@ -92,7 +92,7 @@ Core::Id DeviceCheckBuildStep::stepId()
return "ProjectExplorer.DeviceCheckBuildStep"; return "ProjectExplorer.DeviceCheckBuildStep";
} }
QString DeviceCheckBuildStep::stepDisplayName() QString DeviceCheckBuildStep::displayName()
{ {
return tr("Check for a configured device"); return tr("Check for a configured device");
} }

View File

@@ -45,7 +45,7 @@ public:
BuildStepConfigWidget *createConfigWidget() override; BuildStepConfigWidget *createConfigWidget() override;
static Core::Id stepId(); static Core::Id stepId();
static QString stepDisplayName(); static QString displayName();
}; };
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -46,6 +46,7 @@
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <projectexplorer/devicesupport/devicecheckbuildstep.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/projectexplorer.h> #include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
@@ -57,6 +58,9 @@
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/toolchain.h> #include <projectexplorer/toolchain.h>
#include <remotelinux/genericdirectuploadstep.h>
#include <remotelinux/remotelinuxcheckforfreediskspacestep.h>
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <QAction> #include <QAction>
@@ -67,6 +71,19 @@ using namespace ProjectExplorer;
namespace Qnx { namespace Qnx {
namespace Internal { namespace Internal {
template <class Step>
class GenericQnxDeployStepFactory : public BuildStepFactory
{
public:
GenericQnxDeployStepFactory()
{
registerStep<Step>(Step::stepId());
setDisplayName(Step::displayName());
setSupportedConfiguration(Constants::QNX_QNX_DEPLOYCONFIGURATION_ID);
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
}
};
bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString) bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString)
{ {
Q_UNUSED(arguments) Q_UNUSED(arguments)
@@ -80,6 +97,13 @@ bool QnxPlugin::initialize(const QStringList &arguments, QString *errorString)
addAutoReleasedObject(new QnxRunConfigurationFactory); addAutoReleasedObject(new QnxRunConfigurationFactory);
addAutoReleasedObject(new QnxSettingsPage); addAutoReleasedObject(new QnxSettingsPage);
addAutoReleasedObject(new GenericQnxDeployStepFactory
<RemoteLinux::GenericDirectUploadStep>);
addAutoReleasedObject(new GenericQnxDeployStepFactory
<RemoteLinux::RemoteLinuxCheckForFreeDiskSpaceStep>);
addAutoReleasedObject(new GenericQnxDeployStepFactory
<DeviceCheckBuildStep>);
auto constraint = [](RunConfiguration *runConfig) { auto constraint = [](RunConfiguration *runConfig) {
if (!runConfig->isEnabled() if (!runConfig->isEnabled()
|| !runConfig->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) { || !runConfig->id().name().startsWith(Constants::QNX_QNX_RUNCONFIGURATION_PREFIX)) {