forked from qt-creator/qt-creator
RemoteLinux: Prevent step factory sharing by inheritance
This was the preferred way for a while, but has been superseded by creating the steps by ID. Not exposing the factory classes in a header prevents following the old approach in downstream plugins. Change-Id: Iaa89458a87602006f1a05fa142a34cc1f9d63c64 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "remotelinux_constants.h"
|
||||
#include "remotelinuxtr.h"
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/deploymentdata.h>
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
@@ -28,9 +29,9 @@ using namespace Utils;
|
||||
|
||||
namespace RemoteLinux::Internal {
|
||||
|
||||
// RsyncDeployStep
|
||||
// GenericDeployStep
|
||||
|
||||
class GenericDeployStep : public AbstractRemoteLinuxDeployStep
|
||||
class GenericDeployStep final : public AbstractRemoteLinuxDeployStep
|
||||
{
|
||||
public:
|
||||
GenericDeployStep(BuildStepList *bsl, Id id)
|
||||
@@ -223,10 +224,21 @@ GroupItem GenericDeployStep::deployRecipe()
|
||||
|
||||
// Factory
|
||||
|
||||
GenericDeployStepFactory::GenericDeployStepFactory()
|
||||
class GenericDeployStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
GenericDeployStepFactory()
|
||||
{
|
||||
registerStep<GenericDeployStep>(Constants::GenericDeployStepId);
|
||||
setDisplayName(Tr::tr("Deploy files"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
setSupportedDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||
}
|
||||
};
|
||||
|
||||
void setupGenericDeployStep()
|
||||
{
|
||||
static GenericDeployStepFactory theGenericDeployStepFactory;
|
||||
}
|
||||
|
||||
} // RemoteLinux::Internal
|
||||
|
||||
@@ -3,14 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace RemoteLinux::Internal {
|
||||
|
||||
class GenericDeployStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
GenericDeployStepFactory();
|
||||
};
|
||||
void setupGenericDeployStep();
|
||||
|
||||
} // namespace RemoteLinux::Internal
|
||||
|
||||
@@ -7,10 +7,12 @@
|
||||
#include "remotelinux_constants.h"
|
||||
#include "remotelinuxtr.h"
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/deployablefile.h>
|
||||
#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>
|
||||
|
||||
@@ -35,7 +37,7 @@ struct UploadStorage
|
||||
QList<DeployableFile> filesToUpload;
|
||||
};
|
||||
|
||||
class GenericDirectUploadStep : public AbstractRemoteLinuxDeployStep
|
||||
class GenericDirectUploadStep final : public AbstractRemoteLinuxDeployStep
|
||||
{
|
||||
public:
|
||||
GenericDirectUploadStep(BuildStepList *bsl, Id id)
|
||||
@@ -266,10 +268,21 @@ GroupItem GenericDirectUploadStep::deployRecipe()
|
||||
|
||||
// Factory
|
||||
|
||||
GenericDirectUploadStepFactory::GenericDirectUploadStepFactory()
|
||||
class GenericDirectUploadStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
GenericDirectUploadStepFactory()
|
||||
{
|
||||
registerStep<GenericDirectUploadStep>(Constants::DirectUploadStepId);
|
||||
setDisplayName(Tr::tr("Upload files via SFTP"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
setSupportedDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||
}
|
||||
};
|
||||
|
||||
void setupGenericDirectUploadStep()
|
||||
{
|
||||
static GenericDirectUploadStepFactory theGenericDirectUploadStepFactory;
|
||||
}
|
||||
|
||||
} // RemoteLinux::Internal
|
||||
|
||||
@@ -3,14 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace RemoteLinux::Internal {
|
||||
|
||||
class GenericDirectUploadStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
GenericDirectUploadStepFactory();
|
||||
};
|
||||
void setupGenericDirectUploadStep();
|
||||
|
||||
} // RemoteLinux::Internal
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "remotelinuxtr.h"
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
#include <projectexplorer/buildsystem.h>
|
||||
#include <projectexplorer/deployconfiguration.h>
|
||||
@@ -32,17 +33,17 @@ using namespace Utils;
|
||||
|
||||
namespace RemoteLinux::Internal {
|
||||
|
||||
class MakeInstallStep : public MakeStep
|
||||
class MakeInstallStep final : public MakeStep
|
||||
{
|
||||
public:
|
||||
MakeInstallStep(BuildStepList *parent, Id id);
|
||||
|
||||
private:
|
||||
void fromMap(const Store &map) override;
|
||||
QWidget *createConfigWidget() override;
|
||||
bool init() override;
|
||||
void fromMap(const Store &map) final;
|
||||
QWidget *createConfigWidget() final;
|
||||
bool init() final;
|
||||
Tasking::GroupItem runRecipe() final;
|
||||
bool isJobCountSupported() const override { return false; }
|
||||
bool isJobCountSupported() const final { return false; }
|
||||
|
||||
void updateCommandFromAspect();
|
||||
void updateArgsFromAspect();
|
||||
@@ -270,10 +271,21 @@ void MakeInstallStep::fromMap(const Store &map)
|
||||
|
||||
// Factory
|
||||
|
||||
MakeInstallStepFactory::MakeInstallStepFactory()
|
||||
class MakeInstallStepFactory final : public BuildStepFactory
|
||||
{
|
||||
public:
|
||||
MakeInstallStepFactory()
|
||||
{
|
||||
registerStep<MakeInstallStep>(Constants::MakeInstallStepId);
|
||||
setDisplayName(Tr::tr("Install into temporary host directory"));
|
||||
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
setSupportedDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||
}
|
||||
};
|
||||
|
||||
void setupMakeInstallStep()
|
||||
{
|
||||
static MakeInstallStepFactory theMakeInstallStepFactory;
|
||||
}
|
||||
|
||||
} // RemoteLinux::Internal
|
||||
|
||||
@@ -3,14 +3,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
|
||||
namespace RemoteLinux::Internal {
|
||||
|
||||
class MakeInstallStepFactory : public ProjectExplorer::BuildStepFactory
|
||||
{
|
||||
public:
|
||||
MakeInstallStepFactory();
|
||||
};
|
||||
void setupMakeInstallStep();
|
||||
|
||||
} // namespace RemoteLinux::Internal
|
||||
} // RemoteLinux::Internal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "remotelinuxdebugsupport.h"
|
||||
#include "remotelinuxdeploysupport.h"
|
||||
|
||||
#include "genericdeploystep.h"
|
||||
#include "genericdirectuploadstep.h"
|
||||
@@ -14,24 +14,11 @@
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/store.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace RemoteLinux::Internal {
|
||||
|
||||
template <class Factory>
|
||||
class RemoteLinuxDeployStepFactory : public Factory
|
||||
{
|
||||
public:
|
||||
RemoteLinuxDeployStepFactory()
|
||||
{
|
||||
Factory::setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
|
||||
Factory::setSupportedDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
|
||||
}
|
||||
};
|
||||
|
||||
class RemoteLinuxDeployConfigurationFactory : public DeployConfigurationFactory
|
||||
class RemoteLinuxDeployConfigurationFactory final : public DeployConfigurationFactory
|
||||
{
|
||||
public:
|
||||
RemoteLinuxDeployConfigurationFactory()
|
||||
@@ -54,10 +41,13 @@ public:
|
||||
}
|
||||
});
|
||||
|
||||
// Make sure we can use the steps below.
|
||||
setupGenericDirectUploadStep();
|
||||
setupGenericDeployStep();
|
||||
setupMakeInstallStep();
|
||||
|
||||
addInitialStep(Constants::MakeInstallStepId, needsMakeInstall);
|
||||
addInitialStep(Constants::KillAppStepId);
|
||||
|
||||
// TODO: Rename RsyncDeployStep to something more generic.
|
||||
addInitialStep(Constants::GenericDeployStepId);
|
||||
}
|
||||
};
|
||||
@@ -65,9 +55,6 @@ public:
|
||||
void setupRemoteLinuxDeploySupport()
|
||||
{
|
||||
static RemoteLinuxDeployConfigurationFactory deployConfigurationFactory;
|
||||
static RemoteLinuxDeployStepFactory<GenericDirectUploadStepFactory> genericDirectUploadStep;
|
||||
static RemoteLinuxDeployStepFactory<GenericDeployStepFactory> rsyncDeployStepFactory;
|
||||
static RemoteLinuxDeployStepFactory<MakeInstallStepFactory> makeInstallStepFactory;
|
||||
}
|
||||
|
||||
} // RemoteLinux::Internal
|
||||
|
||||
Reference in New Issue
Block a user