forked from qt-creator/qt-creator
RemoteLinux: Pimple and avoid unneeded use of global object pool
Following the now-canonical HelpPlugin pattern... Change-Id: I2c02b3dee7238da9fb1e3a9b29afb4cd32424cb8 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -42,16 +42,16 @@
|
|||||||
#include "tarpackagecreationstep.h"
|
#include "tarpackagecreationstep.h"
|
||||||
#include "uploadandinstalltarpackagestep.h"
|
#include "uploadandinstalltarpackagestep.h"
|
||||||
|
|
||||||
#include <QtPlugin>
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace RemoteLinux {
|
namespace RemoteLinux {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
template <class Step>
|
template <class Step>
|
||||||
class GenericLinuxDeployStepFactory : public ProjectExplorer::BuildStepFactory
|
class GenericDeployStepFactory : public ProjectExplorer::BuildStepFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericLinuxDeployStepFactory()
|
GenericDeployStepFactory()
|
||||||
{
|
{
|
||||||
registerStep<Step>(Step::stepId());
|
registerStep<Step>(Step::stepId());
|
||||||
setDisplayName(Step::displayName());
|
setDisplayName(Step::displayName());
|
||||||
@@ -60,19 +60,43 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class RemoteLinuxPluginPrivate
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
GenericLinuxDeviceConfigurationFactory deviceConfigurationFactory;
|
||||||
|
RemoteLinuxRunConfigurationFactory runConfigurationFactory;
|
||||||
|
RemoteLinuxCustomRunConfigurationFactory customRunConfigurationFactory;
|
||||||
|
RemoteLinuxDeployConfigurationFactory deployConfigurationFactory;
|
||||||
|
GenericDeployStepFactory<TarPackageCreationStep> tarPackageCreationStepFactory;
|
||||||
|
GenericDeployStepFactory<UploadAndInstallTarPackageStep> uploadAndInstallTarPackageStepFactory;
|
||||||
|
GenericDeployStepFactory<GenericDirectUploadStep> genericDirectUploadStepFactory;
|
||||||
|
GenericDeployStepFactory<GenericRemoteLinuxCustomCommandDeploymentStep>
|
||||||
|
customCommandDeploymentStepFactory;
|
||||||
|
GenericDeployStepFactory<RemoteLinuxCheckForFreeDiskSpaceStep>
|
||||||
|
checkForFreeDiskSpaceStepFactory;
|
||||||
|
GenericDeployStepFactory<RemoteLinuxKillAppStep> remoteLinuxKillAppStepFactory;
|
||||||
|
EmbeddedLinuxQtVersionFactory embeddedLinuxQtVersionFactory;
|
||||||
|
};
|
||||||
|
|
||||||
|
static RemoteLinuxPluginPrivate *dd = nullptr;
|
||||||
|
|
||||||
RemoteLinuxPlugin::RemoteLinuxPlugin()
|
RemoteLinuxPlugin::RemoteLinuxPlugin()
|
||||||
{
|
{
|
||||||
setObjectName(QLatin1String("RemoteLinuxPlugin"));
|
setObjectName(QLatin1String("RemoteLinuxPlugin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RemoteLinuxPlugin::~RemoteLinuxPlugin()
|
||||||
|
{
|
||||||
|
delete dd;
|
||||||
|
}
|
||||||
|
|
||||||
bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
|
bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
|
||||||
QString *errorMessage)
|
QString *errorMessage)
|
||||||
{
|
{
|
||||||
Q_UNUSED(arguments)
|
Q_UNUSED(arguments)
|
||||||
Q_UNUSED(errorMessage)
|
Q_UNUSED(errorMessage)
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
dd = new RemoteLinuxPluginPrivate;
|
||||||
using namespace ProjectExplorer::Constants;
|
|
||||||
|
|
||||||
auto constraint = [](RunConfiguration *runConfig) {
|
auto constraint = [](RunConfiguration *runConfig) {
|
||||||
const Core::Id id = runConfig->id();
|
const Core::Id id = runConfig->id();
|
||||||
@@ -80,35 +104,14 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments,
|
|||||||
|| id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix);
|
|| id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
using namespace ProjectExplorer::Constants;
|
||||||
RunControl::registerWorker<SimpleTargetRunner>(NORMAL_RUN_MODE, constraint);
|
RunControl::registerWorker<SimpleTargetRunner>(NORMAL_RUN_MODE, constraint);
|
||||||
RunControl::registerWorker<LinuxDeviceDebugSupport>(DEBUG_RUN_MODE, constraint);
|
RunControl::registerWorker<LinuxDeviceDebugSupport>(DEBUG_RUN_MODE, constraint);
|
||||||
RunControl::registerWorker<RemoteLinuxQmlProfilerSupport>(QML_PROFILER_RUN_MODE, constraint);
|
RunControl::registerWorker<RemoteLinuxQmlProfilerSupport>(QML_PROFILER_RUN_MODE, constraint);
|
||||||
RunControl::registerWorker<RemoteLinuxQmlPreviewSupport>(QML_PREVIEW_RUN_MODE, constraint);
|
RunControl::registerWorker<RemoteLinuxQmlPreviewSupport>(QML_PREVIEW_RUN_MODE, constraint);
|
||||||
|
|
||||||
addAutoReleasedObject(new GenericLinuxDeviceConfigurationFactory);
|
|
||||||
addAutoReleasedObject(new RemoteLinuxRunConfigurationFactory);
|
|
||||||
addAutoReleasedObject(new RemoteLinuxCustomRunConfigurationFactory);
|
|
||||||
addAutoReleasedObject(new RemoteLinuxDeployConfigurationFactory);
|
|
||||||
addAutoReleasedObject(new GenericLinuxDeployStepFactory<TarPackageCreationStep>);
|
|
||||||
addAutoReleasedObject(new GenericLinuxDeployStepFactory<UploadAndInstallTarPackageStep>);
|
|
||||||
addAutoReleasedObject(new GenericLinuxDeployStepFactory<GenericDirectUploadStep>);
|
|
||||||
addAutoReleasedObject(new GenericLinuxDeployStepFactory
|
|
||||||
<GenericRemoteLinuxCustomCommandDeploymentStep>);
|
|
||||||
addAutoReleasedObject(new GenericLinuxDeployStepFactory<RemoteLinuxCheckForFreeDiskSpaceStep>);
|
|
||||||
addAutoReleasedObject(new GenericLinuxDeployStepFactory<RemoteLinuxKillAppStep>);
|
|
||||||
|
|
||||||
addAutoReleasedObject(new EmbeddedLinuxQtVersionFactory);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoteLinuxPlugin::~RemoteLinuxPlugin()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void RemoteLinuxPlugin::extensionsInitialized()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace RemoteLinux
|
} // namespace RemoteLinux
|
||||||
|
|||||||
@@ -37,10 +37,11 @@ class RemoteLinuxPlugin : public ExtensionSystem::IPlugin
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
RemoteLinuxPlugin();
|
RemoteLinuxPlugin();
|
||||||
~RemoteLinuxPlugin();
|
~RemoteLinuxPlugin() final;
|
||||||
|
|
||||||
bool initialize(const QStringList &arguments, QString *errorMessage);
|
private:
|
||||||
void extensionsInitialized();
|
bool initialize(const QStringList &arguments, QString *errorMessage) final;
|
||||||
|
void extensionsInitialized() final {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user