RemoteLinux: Replace RemoteLinuxDeployConfiguration

... by base DeployConfiguration and adapt remaining users.

Change-Id: I6e2a0ab0c9b682b221de0089f8768b5e621e0025
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-01-18 15:19:59 +01:00
parent a8d2546dad
commit 59ac20b8d5
6 changed files with 12 additions and 39 deletions

View File

@@ -110,11 +110,6 @@ void AbstractRemoteLinuxDeployStep::cancel()
deployService()->stop(); deployService()->stop();
} }
RemoteLinuxDeployConfiguration *AbstractRemoteLinuxDeployStep::deployConfiguration() const
{
return qobject_cast<RemoteLinuxDeployConfiguration *>(BuildStep::deployConfiguration());
}
void AbstractRemoteLinuxDeployStep::handleProgressMessage(const QString &message) void AbstractRemoteLinuxDeployStep::handleProgressMessage(const QString &message)
{ {
emit addOutput(message, OutputFormat::NormalMessage); emit addOutput(message, OutputFormat::NormalMessage);

View File

@@ -33,7 +33,6 @@
namespace RemoteLinux { namespace RemoteLinux {
class AbstractRemoteLinuxDeployService; class AbstractRemoteLinuxDeployService;
class RemoteLinuxDeployConfiguration;
namespace Internal { class AbstractRemoteLinuxDeployStepPrivate; } namespace Internal { class AbstractRemoteLinuxDeployStepPrivate; }
@@ -48,7 +47,6 @@ public:
bool init() override; bool init() override;
void run(QFutureInterface<bool> &fi) override; void run(QFutureInterface<bool> &fi) override;
void cancel() override; void cancel() override;
RemoteLinuxDeployConfiguration *deployConfiguration() const;
virtual AbstractRemoteLinuxDeployService *deployService() const = 0; virtual AbstractRemoteLinuxDeployService *deployService() const = 0;

View File

@@ -45,11 +45,7 @@ namespace RemoteLinux {
using namespace Internal; using namespace Internal;
RemoteLinuxDeployConfiguration::RemoteLinuxDeployConfiguration(Target *target, Core::Id id) Core::Id genericDeployConfigurationId()
: DeployConfiguration(target, id)
{}
Core::Id RemoteLinuxDeployConfiguration::genericDeployConfigurationId()
{ {
return "DeployToGenericLinux"; return "DeployToGenericLinux";
} }
@@ -58,8 +54,7 @@ namespace Internal {
RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory() RemoteLinuxDeployConfigurationFactory::RemoteLinuxDeployConfigurationFactory()
{ {
registerDeployConfiguration<RemoteLinuxDeployConfiguration> registerDeployConfiguration<DeployConfiguration>(genericDeployConfigurationId());
(RemoteLinuxDeployConfiguration::genericDeployConfigurationId());
addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType); addSupportedTargetDeviceType(RemoteLinux::Constants::GenericLinuxOsType);
setDefaultDisplayName(QCoreApplication::translate("RemoteLinux", setDefaultDisplayName(QCoreApplication::translate("RemoteLinux",
"Deploy to Remote Linux Host")); "Deploy to Remote Linux Host"));

View File

@@ -32,28 +32,7 @@
namespace RemoteLinux { namespace RemoteLinux {
class REMOTELINUX_EXPORT RemoteLinuxDeployConfiguration Core::Id genericDeployConfigurationId();
: public ProjectExplorer::DeployConfiguration
{
Q_OBJECT
public:
RemoteLinuxDeployConfiguration(ProjectExplorer::Target *target, Core::Id id);
static Core::Id genericDeployConfigurationId();
template<class T> T *earlierBuildStep(const ProjectExplorer::BuildStep *laterBuildStep) const
{
const QList<ProjectExplorer::BuildStep *> &buildSteps = stepList()->steps();
for (int i = 0; i < buildSteps.count(); ++i) {
if (buildSteps.at(i) == laterBuildStep)
return 0;
if (T * const step = dynamic_cast<T *>(buildSteps.at(i)))
return step;
}
return 0;
}
};
namespace Internal { namespace Internal {

View File

@@ -59,7 +59,7 @@ public:
{ {
registerStep<Step>(Step::stepId()); registerStep<Step>(Step::stepId());
setDisplayName(Step::displayName()); setDisplayName(Step::displayName());
setSupportedConfiguration(RemoteLinuxDeployConfiguration::genericDeployConfigurationId()); setSupportedConfiguration(genericDeployConfigurationId());
setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY); setSupportedStepList(ProjectExplorer::Constants::BUILDSTEPS_DEPLOY);
} }
}; };

View File

@@ -71,8 +71,14 @@ UploadAndInstallTarPackageStep::UploadAndInstallTarPackageStep(BuildStepList *bs
bool UploadAndInstallTarPackageStep::initInternal(QString *error) bool UploadAndInstallTarPackageStep::initInternal(QString *error)
{ {
const TarPackageCreationStep * const pStep const TarPackageCreationStep *pStep = nullptr;
= deployConfiguration()->earlierBuildStep<TarPackageCreationStep>(this);
for (BuildStep *step : deployConfiguration()->stepList()->steps()) {
if (step == this)
break;
if ((pStep = dynamic_cast<TarPackageCreationStep *>(step)))
break;
}
if (!pStep) { if (!pStep) {
if (error) if (error)
*error = tr("No tarball creation step found."); *error = tr("No tarball creation step found.");