aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/android/androidplugin.cpp54
-rw-r--r--src/plugins/baremetal/baremetalplugin.cpp19
-rw-r--r--src/plugins/boot2qt/qdbplugin.cpp52
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp30
-rw-r--r--src/plugins/ios/iosplugin.cpp21
-rw-r--r--src/plugins/nim/nimplugin.cpp6
-rw-r--r--src/plugins/perfprofiler/perfprofilerplugin.cpp9
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp9
-rw-r--r--src/plugins/projectexplorer/runconfiguration.h1
-rw-r--r--src/plugins/projectexplorer/runcontrol.cpp66
-rw-r--r--src/plugins/projectexplorer/runcontrol.h64
-rw-r--r--src/plugins/python/pythonplugin.cpp6
-rw-r--r--src/plugins/qmlpreview/qmlpreviewplugin.cpp13
-rw-r--r--src/plugins/qmlpreview/qmlpreviewplugin.h1
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerplugin.cpp28
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp10
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerruncontrol.h4
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.cpp9
-rw-r--r--src/plugins/qmlprofiler/qmlprofilertool.h2
-rw-r--r--src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp9
-rw-r--r--src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp4
-rw-r--r--src/plugins/qmlprojectmanager/qmlprojectplugin.cpp7
-rw-r--r--src/plugins/qnx/qnxplugin.cpp21
-rw-r--r--src/plugins/qtsupport/desktoprunconfiguration.cpp10
-rw-r--r--src/plugins/qtsupport/desktoprunconfiguration.h6
-rw-r--r--src/plugins/qtsupport/qtsupportplugin.cpp13
-rw-r--r--src/plugins/remotelinux/remotelinuxplugin.cpp50
-rw-r--r--src/plugins/valgrind/callgrindtool.cpp6
-rw-r--r--src/plugins/valgrind/memchecktool.cpp8
-rw-r--r--src/plugins/webassembly/webassemblyplugin.cpp8
-rw-r--r--src/plugins/webassembly/webassemblyrunconfiguration.cpp11
-rw-r--r--src/plugins/webassembly/webassemblyrunconfiguration.h6
-rw-r--r--src/plugins/winrt/winrtplugin.cpp34
33 files changed, 289 insertions, 308 deletions
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp
index 61c4b622524..759e0d5993e 100644
--- a/src/plugins/android/androidplugin.cpp
+++ b/src/plugins/android/androidplugin.cpp
@@ -88,23 +88,13 @@ public:
}
};
-class QmlPreviewRunWorkerFactory : public RunWorkerFactory
+class AndroidQmlPreviewWorker : public AndroidQmlToolingSupport
{
public:
- QmlPreviewRunWorkerFactory()
- {
- addSupportedRunMode(QML_PREVIEW_RUN_MODE);
- setProducer([](RunControl *runControl) -> RunWorker * {
- const Runnable runnable = runControl->runConfiguration()->runnable();
- return new AndroidQmlToolingSupport(runControl, runnable.executable.toString());
- });
- addConstraint([](RunConfiguration *runConfig) {
- return runConfig->isEnabled()
- && runConfig->id().name().startsWith("QmlProjectManager.QmlRunConfiguration")
- && DeviceTypeKitAspect::deviceTypeId(runConfig->target()->kit())
- == Android::Constants::ANDROID_DEVICE_TYPE;
- });
- }
+ AndroidQmlPreviewWorker(RunControl *runControl)
+ : AndroidQmlToolingSupport(runControl,
+ runControl->runConfiguration()->runnable().executable.toString())
+ {}
};
class AndroidPluginPrivate : public QObject
@@ -151,14 +141,32 @@ public:
AndroidManifestEditorFactory manifestEditorFactory;
AndroidRunConfigurationFactory runConfigFactory;
- SimpleRunWorkerFactory<AndroidRunSupport, AndroidRunConfiguration> runWorkerFactory;
- SimpleRunWorkerFactory<AndroidDebugSupport, AndroidRunConfiguration>
- debugWorkerFactory{DEBUG_RUN_MODE};
- SimpleRunWorkerFactory<AndroidQmlToolingSupport, AndroidRunConfiguration>
- profilerWorkerFactory{QML_PROFILER_RUN_MODE};
- SimpleRunWorkerFactory<AndroidQmlToolingSupport, AndroidRunConfiguration>
- qmlPreviewWorkerFactory{QML_PREVIEW_RUN_MODE};
- QmlPreviewRunWorkerFactory qmlPreviewWorkerFactory2;
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<AndroidRunSupport>(),
+ {NORMAL_RUN_MODE},
+ {runConfigFactory.id()}
+ };
+ RunWorkerFactory debugWorkerFactory{
+ RunWorkerFactory::make<AndroidDebugSupport>(),
+ {DEBUG_RUN_MODE},
+ {runConfigFactory.id()}
+ };
+ RunWorkerFactory profilerWorkerFactory{
+ RunWorkerFactory::make<AndroidQmlToolingSupport>(),
+ {QML_PROFILER_RUN_MODE},
+ {runConfigFactory.id()}
+ };
+ RunWorkerFactory qmlPreviewWorkerFactory{
+ RunWorkerFactory::make<AndroidQmlToolingSupport>(),
+ {QML_PREVIEW_RUN_MODE},
+ {runConfigFactory.id()}
+ };
+ RunWorkerFactory qmlPreviewWorkerFactory2{
+ RunWorkerFactory::make<AndroidQmlPreviewWorker>(),
+ {QML_PREVIEW_RUN_MODE},
+ {"QmlProjectManager.QmlRunConfiguration"},
+ {Android::Constants::ANDROID_DEVICE_TYPE}
+ };
AndroidBuildApkStepFactory buildApkStepFactory;
AndroidGdbServerKitAspect gdbServerKitAspect;
diff --git a/src/plugins/baremetal/baremetalplugin.cpp b/src/plugins/baremetal/baremetalplugin.cpp
index 0ce4c518355..d45367ac7d9 100644
--- a/src/plugins/baremetal/baremetalplugin.cpp
+++ b/src/plugins/baremetal/baremetalplugin.cpp
@@ -63,6 +63,12 @@ public:
BareMetalCustomRunConfigurationFactory customRunConfigurationFactory;
GdbServerProvidersSettingsPage gdbServerProviderSettinsPage;
GdbServerProviderManager gdbServerProviderManager;
+
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<BareMetalDebugSupport>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE, ProjectExplorer::Constants::DEBUG_RUN_MODE},
+ {runConfigurationFactory.id(), customRunConfigurationFactory.id()}
+ };
};
// BareMetalPlugin
@@ -78,19 +84,6 @@ bool BareMetalPlugin::initialize(const QStringList &arguments, QString *errorStr
Q_UNUSED(errorString)
d = new BareMetalPluginPrivate;
-
- auto constraint = [](RunConfiguration *runConfig) {
- const QByteArray idStr = runConfig->id().name();
- const bool res = idStr.startsWith(BareMetalRunConfiguration::IdPrefix)
- || idStr == BareMetalCustomRunConfiguration::Id;
- return res;
- };
-
- RunControl::registerWorker<BareMetalDebugSupport>
- (ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint);
- RunControl::registerWorker<BareMetalDebugSupport>
- (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
-
return true;
}
diff --git a/src/plugins/boot2qt/qdbplugin.cpp b/src/plugins/boot2qt/qdbplugin.cpp
index e0a0be790d6..2a3c85f0851 100644
--- a/src/plugins/boot2qt/qdbplugin.cpp
+++ b/src/plugins/boot2qt/qdbplugin.cpp
@@ -180,6 +180,36 @@ public:
QdbDeployStepFactory<RemoteLinux::GenericDirectUploadStep>
m_directUploadStepFactory;
+ const QList<Core::Id> supportedRunConfigs {
+ m_runConfigFactory.id(),
+ "QmlProjectManager.QmlRunConfiguration"
+ };
+
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<QdbDeviceRunSupport>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ supportedRunConfigs,
+ {Qdb::Constants::QdbLinuxOsType}
+ };
+ RunWorkerFactory debugWorkerFactory{
+ RunWorkerFactory::make<QdbDeviceDebugSupport>(),
+ {ProjectExplorer::Constants::DEBUG_RUN_MODE},
+ supportedRunConfigs,
+ {Qdb::Constants::QdbLinuxOsType}
+ };
+ RunWorkerFactory qmlProfilerWorkerFactory{
+ RunWorkerFactory::make<QdbDeviceQmlProfilerSupport>(),
+ {ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
+ supportedRunConfigs,
+ {Qdb::Constants::QdbLinuxOsType}
+ };
+ RunWorkerFactory qmlPreviewWorkerFactory{
+ RunWorkerFactory::make<QdbDeviceQmlPreviewSupport>(),
+ {ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
+ supportedRunConfigs,
+ {Qdb::Constants::QdbLinuxOsType}
+ };
+
DeviceDetector m_deviceDetector;
};
@@ -195,28 +225,6 @@ bool QdbPlugin::initialize(const QStringList &arguments, QString *errorString)
d = new QdbPluginPrivate;
- auto constraint = [](RunConfiguration *runConfiguration) {
- const Core::Id devType = DeviceTypeKitAspect::deviceTypeId(
- runConfiguration->target()->kit());
-
- if (devType != Qdb::Constants::QdbLinuxOsType)
- return false;
-
- const Core::Id id = runConfiguration->id();
- return runConfiguration->isEnabled()
- && (id.name().startsWith(Constants::QdbRunConfigurationPrefix)
- || id.name().startsWith("QmlProjectManager.QmlRunConfiguration"));
- };
-
- RunControl::registerWorker<QdbDeviceRunSupport>
- (ProjectExplorer::Constants::NORMAL_RUN_MODE, constraint);
- RunControl::registerWorker<QdbDeviceDebugSupport>
- (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
- RunControl::registerWorker<QdbDeviceQmlProfilerSupport>
- (ProjectExplorer::Constants::QML_PROFILER_RUN_MODE, constraint);
- RunControl::registerWorker<QdbDeviceQmlPreviewSupport>
- (ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE, constraint);
-
registerFlashAction(this);
return true;
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index c7ccd5d961f..ec7f47f6b70 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -610,6 +610,7 @@ private:
QHash<unsigned, QString> m_debugInfoTasks;
};
+
///////////////////////////////////////////////////////////////////////
//
// DebuggerPluginPrivate
@@ -776,6 +777,18 @@ public:
Perspective m_perspective{Constants::PRESET_PERSPECTIVE_ID, tr("Debugger")};
DebuggerKitAspect debuggerKitAspect;
+
+ RunWorkerFactory debuggerWorkerFactory{
+ RunWorkerFactory::make<DebuggerRunTool>(),
+ {ProjectExplorer::Constants::DEBUG_RUN_MODE},
+ {}, // All local run configs?
+ {PE::DESKTOP_DEVICE_TYPE}
+ };
+
+ // FIXME: Needed?
+// QString mainScript = runConfig->property("mainScript").toString();
+// const bool isDebuggableScript = mainScript.endsWith(".py"); // Only Python for now.
+// return isDebuggableScript;
};
DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin)
@@ -2086,23 +2099,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
}
}
- auto constraint = [](RunConfiguration *runConfig) {
- Runnable runnable = runConfig->runnable();
- if (runnable.device && runnable.device->type() == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
- return true;
-
- if (DeviceTypeKitAspect::deviceTypeId(runConfig->target()->kit())
- == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)
- return true;
-
- QString mainScript = runConfig->property("mainScript").toString();
- const bool isDebuggableScript = mainScript.endsWith(".py"); // Only Python for now.
- return isDebuggableScript;
- };
-
- RunControl::registerWorker<DebuggerRunTool>
- (ProjectExplorer::Constants::DEBUG_RUN_MODE, constraint);
-
DebuggerMainWindow::ensureMainWindowExists();
}
diff --git a/src/plugins/ios/iosplugin.cpp b/src/plugins/ios/iosplugin.cpp
index da41cbb109e..50540c331f1 100644
--- a/src/plugins/ios/iosplugin.cpp
+++ b/src/plugins/ios/iosplugin.cpp
@@ -95,12 +95,21 @@ public:
IosDsymBuildStepFactory dsymBuildStepFactory;
IosDeployConfigurationFactory deployConfigurationFactory;
- SimpleRunWorkerFactory<Internal::IosRunSupport, IosRunConfiguration>
- runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE};
- SimpleRunWorkerFactory<Internal::IosDebugSupport, IosRunConfiguration>
- debugWorkerFactory{ProjectExplorer::Constants::DEBUG_RUN_MODE};
- SimpleRunWorkerFactory<Internal::IosQmlProfilerSupport, IosRunConfiguration>
- qmlProfilerWorkerFactory{ProjectExplorer::Constants::QML_PROFILER_RUN_MODE};
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<IosRunSupport>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {runConfigurationFactory.id()}
+ };
+ RunWorkerFactory debugWorkerFactory{
+ RunWorkerFactory::make<IosDebugSupport>(),
+ {ProjectExplorer::Constants::DEBUG_RUN_MODE},
+ {runConfigurationFactory.id()}
+ };
+ RunWorkerFactory qmlProfilerWorkerFactory{
+ RunWorkerFactory::make<IosQmlProfilerSupport>(),
+ {ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
+ {runConfigurationFactory.id()}
+ };
};
IosPlugin::~IosPlugin()
diff --git a/src/plugins/nim/nimplugin.cpp b/src/plugins/nim/nimplugin.cpp
index d9ff1871793..7740e6096e1 100644
--- a/src/plugins/nim/nimplugin.cpp
+++ b/src/plugins/nim/nimplugin.cpp
@@ -67,7 +67,11 @@ public:
NimEditorFactory editorFactory;
NimBuildConfigurationFactory buildConfigFactory;
NimRunConfigurationFactory runConfigFactory;
- SimpleRunWorkerFactory<SimpleTargetRunner, NimRunConfiguration> runWorkerFactory;
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<SimpleTargetRunner>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {runConfigFactory.id()}
+ };
NimCompilerBuildStepFactory buildStepFactory;
NimCompilerCleanStepFactory cleanStepFactory;
NimCodeStyleSettingsPage codeStyleSettingsPage;
diff --git a/src/plugins/perfprofiler/perfprofilerplugin.cpp b/src/plugins/perfprofiler/perfprofilerplugin.cpp
index 26f2272204d..d6f791b553e 100644
--- a/src/plugins/perfprofiler/perfprofilerplugin.cpp
+++ b/src/plugins/perfprofiler/perfprofilerplugin.cpp
@@ -69,12 +69,13 @@ public:
RunControl::registerWorkerCreator(ProjectExplorer::Constants::PERFPROFILER_RUN_MODE,
[](RunControl *runControl){ return new PerfProfilerRunner(runControl); });
-
- auto constraint = [](RunConfiguration *) { return true; };
- RunControl::registerWorker<PerfProfilerRunner>
- (ProjectExplorer::Constants::PERFPROFILER_RUN_MODE, constraint);
}
+ RunWorkerFactory profilerWorkerFactory{
+ RunWorkerFactory::make<PerfProfilerRunner>(),
+ {ProjectExplorer::Constants::PERFPROFILER_RUN_MODE}
+ };
+
PerfOptionsPage optionsPage;
PerfProfilerTool profilerTool;
};
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 645fab095df..a101015df2f 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -565,8 +565,11 @@ public:
CurrentProjectFind m_curretProjectFind;
CustomExecutableRunConfigurationFactory m_customExecutableRunConfigFactory;
- SimpleRunWorkerFactory<SimpleTargetRunner, CustomExecutableRunConfiguration>
- m_customExecutableRunWorkerFactory;
+ RunWorkerFactory m_customExecutableRunWorkerFactory{
+ RunWorkerFactory::make<SimpleTargetRunner>(),
+ {Constants::NORMAL_RUN_MODE},
+ {m_customExecutableRunConfigFactory.id()}
+ };
ProjectFileWizardExtension m_projectFileWizardExtension;
@@ -610,8 +613,6 @@ ProjectExplorerPlugin::~ProjectExplorerPlugin()
delete dd;
dd = nullptr;
m_instance = nullptr;
-
- RunWorkerFactory::destroyRemainingRunWorkerFactories();
}
ProjectExplorerPlugin *ProjectExplorerPlugin::instance()
diff --git a/src/plugins/projectexplorer/runconfiguration.h b/src/plugins/projectexplorer/runconfiguration.h
index c051db26101..e56ecb92ad5 100644
--- a/src/plugins/projectexplorer/runconfiguration.h
+++ b/src/plugins/projectexplorer/runconfiguration.h
@@ -227,6 +227,7 @@ public:
static RunConfiguration *clone(Target *parent, RunConfiguration *source);
static const QList<RunConfigurationCreationInfo> creatorsForTarget(Target *parent);
+ Core::Id id() const { return m_runConfigBaseId; }
Core::Id runConfigurationBaseId() const { return m_runConfigBaseId; }
static QString decoratedTargetName(const QString &targetName, Target *kit);
diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp
index 3dae8d7ecbd..f207eb9c8b6 100644
--- a/src/plugins/projectexplorer/runcontrol.cpp
+++ b/src/plugins/projectexplorer/runcontrol.cpp
@@ -73,7 +73,14 @@ namespace ProjectExplorer {
static QList<RunWorkerFactory *> g_runWorkerFactories;
-RunWorkerFactory::RunWorkerFactory()
+RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer,
+ const QList<Core::Id> &runModes,
+ const QList<Core::Id> &runConfigs,
+ const QList<Core::Id> &deviceTypes)
+ : m_producer(producer),
+ m_supportedRunModes(runModes),
+ m_supportedRunConfigurations(runConfigs),
+ m_supportedDeviceTypes(deviceTypes)
{
g_runWorkerFactories.append(this);
}
@@ -89,53 +96,32 @@ bool RunWorkerFactory::canRun(RunConfiguration *runConfiguration, Core::Id runMo
return false;
if (!m_supportedRunConfigurations.isEmpty()) {
- if (!m_supportedRunConfigurations.contains(runConfiguration->id()))
+ // FIXME: That's to be used after mangled ids are gone.
+ //if (!m_supportedRunConfigurations.contains(runConfiguration->id()))
+ // return false;
+ bool ok = false;
+ const QString rcid = runConfiguration->id().toString();
+ for (const Core::Id &id : m_supportedRunConfigurations) {
+ if (rcid.startsWith(id.toString())) {
+ ok = true;
+ break;
+ }
+ }
+
+ if (!ok)
return false;
}
- for (const Constraint &constraint : m_constraints) {
- if (!constraint(runConfiguration))
- return false;
+ if (!m_supportedDeviceTypes.isEmpty()) {
+ Target *target = runConfiguration ? runConfiguration->target() : nullptr;
+ Kit *kit = target ? target->kit() : nullptr;
+ const Core::Id devid = DeviceTypeKitAspect::deviceTypeId(kit);
+ return m_supportedDeviceTypes.contains(devid);
}
return true;
}
-void RunWorkerFactory::setProducer(const WorkerCreator &producer)
-{
- m_producer = producer;
-}
-
-void RunWorkerFactory::addConstraint(const Constraint &constraint)
-{
- // Default constructed Constraints are not worth keeping.
- // FIXME: Make it a QTC_ASSERT once there is no code path
- // using this "feature" anymore.
- if (!constraint)
- return;
- m_constraints.append(constraint);
-}
-
-void RunWorkerFactory::addSupportedRunMode(Core::Id runMode)
-{
- m_supportedRunModes.append(runMode);
-}
-
-void RunWorkerFactory::setSupportedRunConfigurations(const QList<Core::Id> &ids)
-{
- m_supportedRunConfigurations = ids;
-}
-
-void RunWorkerFactory::addSupportedRunConfiguration(Core::Id id)
-{
- m_supportedRunConfigurations.append(id);
-}
-
-void RunWorkerFactory::destroyRemainingRunWorkerFactories()
-{
- qDeleteAll(g_runWorkerFactories);
-}
-
/*!
\class ProjectExplorer::RunControl
\brief The RunControl class instances represent one item that is run.
diff --git a/src/plugins/projectexplorer/runcontrol.h b/src/plugins/projectexplorer/runcontrol.h
index ae6058580e2..b7946347429 100644
--- a/src/plugins/projectexplorer/runcontrol.h
+++ b/src/plugins/projectexplorer/runcontrol.h
@@ -50,11 +50,8 @@ class OutputFormatter;
namespace ProjectExplorer {
class GlobalOrProjectAspect;
class Node;
-class RunConfigurationFactory;
class RunConfiguration;
-class RunConfigurationCreationInfo;
class RunControl;
-class RunWorkerFactory;
class Target;
namespace Internal {
@@ -142,36 +139,32 @@ private:
const std::unique_ptr<Internal::RunWorkerPrivate> d;
};
-class PROJECTEXPLORER_EXPORT RunWorkerFactory
+class PROJECTEXPLORER_EXPORT RunWorkerFactory final
{
public:
using WorkerCreator = std::function<RunWorker *(RunControl *)>;
- using Constraint = std::function<bool(RunConfiguration *)>;
-
- RunWorkerFactory();
- virtual ~RunWorkerFactory();
-
- bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const;
- void setProducer(const WorkerCreator &producer);
- void addConstraint(const Constraint &constraint);
- void addSupportedRunMode(Core::Id runMode);
+ RunWorkerFactory(const WorkerCreator &producer,
+ const QList<Core::Id> &runModes,
+ const QList<Core::Id> &runConfigs = {},
+ const QList<Core::Id> &deviceTypes = {});
- void setSupportedRunConfigurations(const QList<Core::Id> &ids);
- void addSupportedRunConfiguration(Core::Id id);
+ ~RunWorkerFactory();
+ bool canRun(RunConfiguration *runConfiguration, Core::Id runMode) const;
WorkerCreator producer() const { return m_producer; }
-private:
- // FIXME: That's temporary until ownership has been transferred to
- // the individual plugins.
- friend class ProjectExplorerPlugin;
- static void destroyRemainingRunWorkerFactories();
+ template <typename Worker>
+ static WorkerCreator make()
+ {
+ return [](RunControl *runControl) { return new Worker(runControl); };
+ }
+private:
+ WorkerCreator m_producer;
QList<Core::Id> m_supportedRunModes;
QList<Core::Id> m_supportedRunConfigurations;
- QList<Constraint> m_constraints;
- WorkerCreator m_producer;
+ QList<Core::Id> m_supportedDeviceTypes;
};
/**
@@ -258,19 +251,10 @@ public:
RunWorker *createWorker(Core::Id id);
using WorkerCreator = RunWorkerFactory::WorkerCreator;
- using Constraint = RunWorkerFactory::Constraint;
+ using Constraint = std::function<bool(RunConfiguration *)>;
static void registerWorkerCreator(Core::Id id, const WorkerCreator &workerCreator);
- template <class Worker>
- static void registerWorker(Core::Id runMode, const Constraint &constraint)
- {
- auto factory = new RunWorkerFactory;
- factory->setProducer([](RunControl *rc) { return new Worker(rc); });
- factory->addSupportedRunMode(runMode);
- factory->addConstraint(constraint);
- }
-
bool createMainWorker();
static bool canRun(RunConfiguration *runConfig, Core::Id runMode);
@@ -325,20 +309,4 @@ private:
bool m_useTerminal = false;
};
-template <class RunWorker, class RunConfig>
-class SimpleRunWorkerFactory : public RunWorkerFactory
-{
-public:
- SimpleRunWorkerFactory(Core::Id runMode = ProjectExplorer::Constants::NORMAL_RUN_MODE)
- {
- addSupportedRunMode(runMode);
- addConstraint([](RunConfiguration *runConfig) {
- return qobject_cast<RunConfig *>(runConfig) != nullptr;
- });
- setProducer([](RunControl *runControl) {
- return new RunWorker(runControl);
- });
- }
-};
-
} // namespace ProjectExplorer
diff --git a/src/plugins/python/pythonplugin.cpp b/src/plugins/python/pythonplugin.cpp
index 475062022b9..657e6269bc8 100644
--- a/src/plugins/python/pythonplugin.cpp
+++ b/src/plugins/python/pythonplugin.cpp
@@ -810,7 +810,11 @@ class PythonPluginPrivate
public:
PythonEditorFactory editorFactory;
PythonRunConfigurationFactory runConfigFactory;
- SimpleRunWorkerFactory<SimpleTargetRunner, PythonRunConfiguration> runWorkerFactory;
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<SimpleTargetRunner>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {runConfigFactory.id()}
+ };
};
PythonPlugin::~PythonPlugin()
diff --git a/src/plugins/qmlpreview/qmlpreviewplugin.cpp b/src/plugins/qmlpreview/qmlpreviewplugin.cpp
index 88555b9f925..fde11cd9836 100644
--- a/src/plugins/qmlpreview/qmlpreviewplugin.cpp
+++ b/src/plugins/qmlpreview/qmlpreviewplugin.cpp
@@ -108,13 +108,12 @@ bool QmlPreviewPlugin::initialize(const QStringList &arguments, QString *errorSt
setFileClassifier(&defaultFileClassifier);
setFpsHandler(&defaultFpsHandler);
- auto constraint = [](RunConfiguration *runConfiguration) {
- Target *target = runConfiguration ? runConfiguration->target() : nullptr;
- Kit *kit = target ? target->kit() : nullptr;
- return DeviceTypeKitAspect::deviceTypeId(kit) == Constants::DESKTOP_DEVICE_TYPE;
- };
-
- RunControl::registerWorker<LocalQmlPreviewSupport>(Constants::QML_PREVIEW_RUN_MODE, constraint);
+ m_runWorkerFactory.reset(new RunWorkerFactory{
+ RunWorkerFactory::make<LocalQmlPreviewSupport>(),
+ {Constants::QML_PREVIEW_RUN_MODE},
+ {}, // All runconfig.
+ {Constants::DESKTOP_DEVICE_TYPE}
+ });
Core::ActionContainer *menu = Core::ActionManager::actionContainer(
Constants::M_BUILDPROJECT);
diff --git a/src/plugins/qmlpreview/qmlpreviewplugin.h b/src/plugins/qmlpreview/qmlpreviewplugin.h
index 559cbb81dd2..faf89e767fe 100644
--- a/src/plugins/qmlpreview/qmlpreviewplugin.h
+++ b/src/plugins/qmlpreview/qmlpreviewplugin.h
@@ -122,6 +122,7 @@ private:
float m_zoomFactor = -1.0;
QmlPreview::QmlPreviewFpsHandler m_fpsHandler = nullptr;
QString m_locale;
+ std::unique_ptr<ProjectExplorer::RunWorkerFactory> m_runWorkerFactory;
};
} // namespace Internal
diff --git a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
index 942ab9344d8..b961a5827b8 100644
--- a/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerplugin.cpp
@@ -80,34 +80,18 @@ namespace Internal {
Q_GLOBAL_STATIC(QmlProfilerSettings, qmlProfilerGlobalSettings)
-bool constraint(RunConfiguration *runConfiguration)
-{
- Target *target = runConfiguration ? runConfiguration->target() : nullptr;
- Kit *kit = target ? target->kit() : nullptr;
- return DeviceTypeKitAspect::deviceTypeId(kit)
- == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE;
-}
-
-class QmlProfilerRunWorkerFactory : public RunWorkerFactory
-{
-public:
- QmlProfilerRunWorkerFactory(QmlProfilerTool *tool)
- {
- addSupportedRunMode(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
- setProducer([tool](RunControl *runControl) {
- return new LocalQmlProfilerSupport(tool, runControl);
- });
- addConstraint(constraint);
- }
-};
-
class QmlProfilerPluginPrivate
{
public:
QmlProfilerTool m_profilerTool;
QmlProfilerOptionsPage m_profilerOptionsPage;
QmlProfilerActions m_actions;
- QmlProfilerRunWorkerFactory m_profilerWorkerFactory{&m_profilerTool};
+ RunWorkerFactory m_profilerWorkerFactory{
+ RunWorkerFactory::make<LocalQmlProfilerSupport>(),
+ {ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
+ {},
+ {ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE}
+ };
};
bool QmlProfilerPlugin::initialize(const QStringList &arguments, QString *errorString)
diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp
index c9cc305d750..4d56267ca42 100644
--- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.cpp
@@ -218,14 +218,12 @@ static QUrl localServerUrl(RunControl *runControl)
return serverUrl;
}
-LocalQmlProfilerSupport::LocalQmlProfilerSupport(QmlProfilerTool *profilerTool,
- RunControl *runControl)
- : LocalQmlProfilerSupport(profilerTool, runControl, localServerUrl(runControl))
+LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl)
+ : LocalQmlProfilerSupport(runControl, localServerUrl(runControl))
{
}
-LocalQmlProfilerSupport::LocalQmlProfilerSupport(QmlProfilerTool *profilerTool,
- RunControl *runControl, const QUrl &serverUrl)
+LocalQmlProfilerSupport::LocalQmlProfilerSupport(RunControl *runControl, const QUrl &serverUrl)
: SimpleTargetRunner(runControl)
{
setId("LocalQmlProfilerSupport");
@@ -233,7 +231,7 @@ LocalQmlProfilerSupport::LocalQmlProfilerSupport(QmlProfilerTool *profilerTool,
auto profiler = new QmlProfilerRunner(runControl);
profiler->setServerUrl(serverUrl);
connect(profiler, &QmlProfilerRunner::starting,
- profilerTool, &QmlProfilerTool::finalizeRunControl);
+ QmlProfilerTool::instance(), &QmlProfilerTool::finalizeRunControl);
addStopDependency(profiler);
// We need to open the local server before the application tries to connect.
diff --git a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h
index 0bdd9315cb0..ac40e16301a 100644
--- a/src/plugins/qmlprofiler/qmlprofilerruncontrol.h
+++ b/src/plugins/qmlprofiler/qmlprofilerruncontrol.h
@@ -72,8 +72,8 @@ class LocalQmlProfilerSupport : public ProjectExplorer::SimpleTargetRunner
Q_OBJECT
public:
- LocalQmlProfilerSupport(QmlProfilerTool *profilerTool, ProjectExplorer::RunControl *runControl);
- LocalQmlProfilerSupport(QmlProfilerTool *profilerTool, ProjectExplorer::RunControl *runControl,
+ LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl);
+ LocalQmlProfilerSupport(ProjectExplorer::RunControl *runControl,
const QUrl &serverUrl);
};
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.cpp b/src/plugins/qmlprofiler/qmlprofilertool.cpp
index d951eb4dce9..9caef0885cc 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilertool.cpp
@@ -96,6 +96,8 @@ using namespace ProjectExplorer;
namespace QmlProfiler {
namespace Internal {
+static QmlProfilerTool *m_instance = nullptr;
+
class QmlProfilerTool::QmlProfilerToolPrivate
{
public:
@@ -129,6 +131,7 @@ public:
QmlProfilerTool::QmlProfilerTool()
: d(new QmlProfilerToolPrivate)
{
+ m_instance = this;
setObjectName(QLatin1String("QmlProfilerTool"));
d->m_profilerState = new QmlProfilerStateManager(this);
@@ -279,6 +282,12 @@ QmlProfilerTool::~QmlProfilerTool()
{
d->m_profilerModelManager->clearAll();
delete d;
+ m_instance = nullptr;
+}
+
+QmlProfilerTool *QmlProfilerTool::instance()
+{
+ return m_instance;
}
void QmlProfilerTool::updateRunActions()
diff --git a/src/plugins/qmlprofiler/qmlprofilertool.h b/src/plugins/qmlprofiler/qmlprofilertool.h
index 180f1c090cf..77759cc690a 100644
--- a/src/plugins/qmlprofiler/qmlprofilertool.h
+++ b/src/plugins/qmlprofiler/qmlprofilertool.h
@@ -52,6 +52,8 @@ public:
QmlProfilerTool();
~QmlProfilerTool() override;
+ static QmlProfilerTool *instance();
+
void finalizeRunControl(QmlProfilerRunner *runWorker);
bool prepareTool();
diff --git a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
index 7fa1a6e34f6..49eeacdde30 100644
--- a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
+++ b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp
@@ -45,7 +45,6 @@ LocalQmlProfilerRunnerTest::LocalQmlProfilerRunnerTest(QObject *parent) : QObjec
void LocalQmlProfilerRunnerTest::testRunner()
{
- QmlProfilerTool tool;
QPointer<ProjectExplorer::RunControl> runControl;
QPointer<LocalQmlProfilerSupport> profiler;
ProjectExplorer::Runnable debuggee;
@@ -66,7 +65,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
runControl->setRunnable(debuggee);
- profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
+ profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
auto connectRunner = [&]() {
connect(runControl, &ProjectExplorer::RunControl::aboutToStart, this, [&]() {
@@ -116,7 +115,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
debuggee.commandLineArguments = QString("-test QmlProfiler,");
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
runControl->setRunnable(debuggee);
- profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
+ profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
connectRunner();
runControl->initiateStart();
@@ -135,7 +134,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
serverUrl = Utils::urlFromLocalHostAndFreePort();
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
runControl->setRunnable(debuggee);
- profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
+ profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
connectRunner();
runControl->initiateStart();
@@ -160,7 +159,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
runControl = new ProjectExplorer::RunControl(ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
runControl->setRunnable(debuggee);
- profiler = new LocalQmlProfilerSupport(&tool, runControl, serverUrl);
+ profiler = new LocalQmlProfilerSupport(runControl, serverUrl);
connectRunner();
runControl->initiateStart();
diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp
index 66edba16daa..ab085ea4586 100644
--- a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp
+++ b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp
@@ -52,7 +52,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
QVERIFY(settings);
settings->setValue(QLatin1String("AnalyzerQmlAttachDialog/kitId"), newKit->id().toSetting());
- QmlProfilerTool profilerTool;
+ QmlProfilerTool &profilerTool = *QmlProfilerTool::instance();
QmlProfilerClientManager *clientManager = profilerTool.clientManager();
clientManager->setRetryInterval(10);
@@ -107,7 +107,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication()
void QmlProfilerToolTest::testClearEvents()
{
- QmlProfilerTool profilerTool;
+ QmlProfilerTool &profilerTool = *QmlProfilerTool::instance();
QmlProfilerModelManager *modelManager = profilerTool.modelManager();
QVERIFY(modelManager);
QmlProfilerStateManager *stateManager = profilerTool.stateManager();
diff --git a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
index d20f4caa43a..b44cbf06707 100644
--- a/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
+++ b/src/plugins/qmlprojectmanager/qmlprojectplugin.cpp
@@ -44,8 +44,11 @@ class QmlProjectPluginPrivate
{
public:
QmlProjectRunConfigurationFactory runConfigFactory;
- SimpleRunWorkerFactory<SimpleTargetRunner, QmlProjectRunConfiguration>
- runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE};
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<SimpleTargetRunner>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {runConfigFactory.id()}
+ };
};
QmlProjectPlugin::~QmlProjectPlugin()
diff --git a/src/plugins/qnx/qnxplugin.cpp b/src/plugins/qnx/qnxplugin.cpp
index 06f2701715b..a0780561369 100644
--- a/src/plugins/qnx/qnxplugin.cpp
+++ b/src/plugins/qnx/qnxplugin.cpp
@@ -115,12 +115,21 @@ public:
QnxSettingsPage settingsPage;
QnxToolChainFactory toolChainFactory;
- SimpleRunWorkerFactory<SimpleTargetRunner, QnxRunConfiguration>
- runWorkerFactory{ProjectExplorer::Constants::NORMAL_RUN_MODE};
- SimpleRunWorkerFactory<QnxDebugSupport, QnxRunConfiguration>
- debugWorkerFactory{ProjectExplorer::Constants::DEBUG_RUN_MODE};
- SimpleRunWorkerFactory<QnxQmlProfilerSupport, QnxRunConfiguration>
- qmlProfilerWorkerFactory;
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<SimpleTargetRunner>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {runConfigFactory.id()}
+ };
+ RunWorkerFactory debugWorkerFactory{
+ RunWorkerFactory::make<QnxDebugSupport>(),
+ {ProjectExplorer::Constants::DEBUG_RUN_MODE},
+ {runConfigFactory.id()}
+ };
+ RunWorkerFactory qmlProfilerWorkerFactory{
+ RunWorkerFactory::make<QnxQmlProfilerSupport>(),
+ {}, // FIXME: Shouldn't this use the run mode id somehow?
+ {runConfigFactory.id()}
+ };
};
static QnxPluginPrivate *dd = nullptr;
diff --git a/src/plugins/qtsupport/desktoprunconfiguration.cpp b/src/plugins/qtsupport/desktoprunconfiguration.cpp
index 31dd6bd0481..86029494d87 100644
--- a/src/plugins/qtsupport/desktoprunconfiguration.cpp
+++ b/src/plugins/qtsupport/desktoprunconfiguration.cpp
@@ -239,16 +239,6 @@ const char QMAKE_RUNCONFIG_ID[] = "Qt4ProjectManager.Qt4RunConfiguration:";
const char QBS_RUNCONFIG_ID[] = "Qbs.RunConfiguration:";
const char CMAKE_RUNCONFIG_ID[] = "CMakeProjectManager.CMakeRunConfiguration.";
-DesktopRunWorkerFactory::DesktopRunWorkerFactory()
-{
- addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
- addSupportedRunConfiguration(QMAKE_RUNCONFIG_ID);
- addSupportedRunConfiguration(QBS_RUNCONFIG_ID);
- addSupportedRunConfiguration(CMAKE_RUNCONFIG_ID);
-
- setProducer([](RunControl *runControl) { return new SimpleTargetRunner(runControl); });
-}
-
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
{
registerRunConfiguration<CMakeRunConfiguration>(CMAKE_RUNCONFIG_ID);
diff --git a/src/plugins/qtsupport/desktoprunconfiguration.h b/src/plugins/qtsupport/desktoprunconfiguration.h
index 4ea41b1a02c..dd38a3e4f40 100644
--- a/src/plugins/qtsupport/desktoprunconfiguration.h
+++ b/src/plugins/qtsupport/desktoprunconfiguration.h
@@ -58,12 +58,6 @@ private:
const Kind m_kind;
};
-class DesktopRunWorkerFactory : public ProjectExplorer::RunWorkerFactory
-{
-public:
- DesktopRunWorkerFactory();
-};
-
class DesktopQmakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
{
public:
diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp
index 47fb80b2dbb..800a185df0b 100644
--- a/src/plugins/qtsupport/qtsupportplugin.cpp
+++ b/src/plugins/qtsupport/qtsupportplugin.cpp
@@ -71,10 +71,15 @@ public:
CodeGenSettingsPage codeGenSettingsPage;
QtOptionsPage qtOptionsPage;
- DesktopRunWorkerFactory desktopRunWorkerFactory;
- DesktopQmakeRunConfigurationFactory desktopQmakeRunConfigFactory;
- QbsRunConfigurationFactory desktopQbsRunConfigFactory;
- CMakeRunConfigurationFactory desktopCMakeRunConfigFactory;
+ DesktopQmakeRunConfigurationFactory qmakeRunConfigFactory;
+ QbsRunConfigurationFactory qbsRunConfigFactory;
+ CMakeRunConfigurationFactory cmakeRunConfigFactory;
+
+ RunWorkerFactory desktopRunWorkerFactory{
+ RunWorkerFactory::make<SimpleTargetRunner>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {qmakeRunConfigFactory.id(), qbsRunConfigFactory.id(), cmakeRunConfigFactory.id()}
+ };
ExamplesWelcomePage examplesPage{true};
ExamplesWelcomePage tutorialPage{false};
diff --git a/src/plugins/remotelinux/remotelinuxplugin.cpp b/src/plugins/remotelinux/remotelinuxplugin.cpp
index 1f25666cbfe..438c5c23e3e 100644
--- a/src/plugins/remotelinux/remotelinuxplugin.cpp
+++ b/src/plugins/remotelinux/remotelinuxplugin.cpp
@@ -83,6 +83,37 @@ public:
GenericDeployStepFactory<RemoteLinuxKillAppStep> remoteLinuxKillAppStepFactory;
GenericDeployStepFactory<MakeInstallStep> makeInstallStepFactory;
EmbeddedLinuxQtVersionFactory embeddedLinuxQtVersionFactory;
+
+ const QList<Core::Id> supportedRunConfigs {
+ runConfigurationFactory.id(),
+ customRunConfigurationFactory.id(),
+ "QmlProjectManager.QmlRunConfiguration"
+ };
+
+ RunWorkerFactory runnerFactory{
+ RunWorkerFactory::make<SimpleTargetRunner>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ supportedRunConfigs,
+ {Constants::GenericLinuxOsType}
+ };
+ RunWorkerFactory debuggerFactory{
+ RunWorkerFactory::make<LinuxDeviceDebugSupport>(),
+ {ProjectExplorer::Constants::DEBUG_RUN_MODE},
+ supportedRunConfigs,
+ {Constants::GenericLinuxOsType}
+ };
+ RunWorkerFactory qmlProfilerFactory{
+ RunWorkerFactory::make<RemoteLinuxQmlProfilerSupport>(),
+ {ProjectExplorer::Constants::QML_PROFILER_RUN_MODE},
+ supportedRunConfigs,
+ {Constants::GenericLinuxOsType}
+ };
+ RunWorkerFactory qmlPreviewFactory{
+ RunWorkerFactory::make<RemoteLinuxQmlPreviewSupport>(),
+ {ProjectExplorer::Constants::QML_PREVIEW_RUN_MODE},
+ supportedRunConfigs,
+ {Constants::GenericLinuxOsType}
+ };
};
static RemoteLinuxPluginPrivate *dd = nullptr;
@@ -104,25 +135,6 @@ bool RemoteLinuxPlugin::initialize(const QStringList &arguments, QString *errorM
dd = new RemoteLinuxPluginPrivate;
- auto constraint = [](RunConfiguration *runConfig) {
- const Core::Id devType = ProjectExplorer::DeviceTypeKitAspect::deviceTypeId(
- runConfig->target()->kit());
-
- if (devType != Constants::GenericLinuxOsType)
- return false;
-
- const Core::Id id = runConfig->id();
- return id == RemoteLinuxCustomRunConfiguration::runConfigId()
- || id.name().startsWith(RemoteLinuxRunConfiguration::IdPrefix)
- || id.name().startsWith("QmlProjectManager.QmlRunConfiguration");
- };
-
- using namespace ProjectExplorer::Constants;
- RunControl::registerWorker<SimpleTargetRunner>(NORMAL_RUN_MODE, constraint);
- RunControl::registerWorker<LinuxDeviceDebugSupport>(DEBUG_RUN_MODE, constraint);
- RunControl::registerWorker<RemoteLinuxQmlProfilerSupport>(QML_PROFILER_RUN_MODE, constraint);
- RunControl::registerWorker<RemoteLinuxQmlPreviewSupport>(QML_PREVIEW_RUN_MODE, constraint);
-
return true;
}
diff --git a/src/plugins/valgrind/callgrindtool.cpp b/src/plugins/valgrind/callgrindtool.cpp
index de4bbb09cdb..5a78b2efaf0 100644
--- a/src/plugins/valgrind/callgrindtool.cpp
+++ b/src/plugins/valgrind/callgrindtool.cpp
@@ -219,6 +219,11 @@ public:
bool m_toolBusy = false;
Perspective m_perspective{"Callgrind.Perspective", CallgrindTool::tr("Callgrind")};
+
+ RunWorkerFactory callgrindRunWorkerFactory{
+ RunWorkerFactory::make<CallgrindToolRunner>(),
+ {CALLGRIND_RUN_MODE}
+ };
};
CallgrindToolPrivate::CallgrindToolPrivate()
@@ -999,7 +1004,6 @@ void setupCallgrindRunner(CallgrindToolRunner *toolRunner)
CallgrindTool::CallgrindTool()
{
dd = new CallgrindToolPrivate;
- RunControl::registerWorker<CallgrindToolRunner>(CALLGRIND_RUN_MODE, {});
}
CallgrindTool::~CallgrindTool()
diff --git a/src/plugins/valgrind/memchecktool.cpp b/src/plugins/valgrind/memchecktool.cpp
index ed194129e97..5f43eee9422 100644
--- a/src/plugins/valgrind/memchecktool.cpp
+++ b/src/plugins/valgrind/memchecktool.cpp
@@ -437,6 +437,11 @@ private:
QString m_exitMsg;
Perspective m_perspective{"Memcheck.Perspective", MemcheckTool::tr("Memcheck")};
+
+ RunWorkerFactory memcheckToolRunnerFactory{
+ RunWorkerFactory::make<MemcheckToolRunner>(),
+ {MEMCHECK_RUN_MODE, MEMCHECK_WITH_GDB_RUN_MODE}
+ };
};
static MemcheckToolPrivate *dd = nullptr;
@@ -1644,9 +1649,6 @@ void HeobData::debugStopped()
MemcheckTool::MemcheckTool()
{
dd = new MemcheckToolPrivate;
-
- RunControl::registerWorker<MemcheckToolRunner>(MEMCHECK_RUN_MODE, {});
- RunControl::registerWorker<MemcheckToolRunner>(MEMCHECK_WITH_GDB_RUN_MODE, {});
}
MemcheckTool::~MemcheckTool()
diff --git a/src/plugins/webassembly/webassemblyplugin.cpp b/src/plugins/webassembly/webassemblyplugin.cpp
index 5fa3c4a9836..97b4ca4ebcb 100644
--- a/src/plugins/webassembly/webassemblyplugin.cpp
+++ b/src/plugins/webassembly/webassemblyplugin.cpp
@@ -36,6 +36,8 @@
#include <projectexplorer/devicesupport/devicemanager.h>
+using namespace ProjectExplorer;
+
namespace WebAssembly {
namespace Internal {
@@ -46,7 +48,11 @@ public:
WebAssemblyDeviceFactory deviceFactory;
WebAssemblyQtVersionFactory qtVersionFactory;
EmrunRunConfigurationFactory emrunRunConfigurationFactory;
- EmrunRunWorkerFactory emrunRunWorkerFactory;
+ RunWorkerFactory emrunRunWorkerFactory{
+ makeEmrunWorker(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN}
+ };
};
static WebAssemblyPluginPrivate *dd = nullptr;
diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.cpp b/src/plugins/webassembly/webassemblyrunconfiguration.cpp
index a2b5a7fb500..6a1d98f8158 100644
--- a/src/plugins/webassembly/webassemblyrunconfiguration.cpp
+++ b/src/plugins/webassembly/webassemblyrunconfiguration.cpp
@@ -110,6 +110,10 @@ public:
PortsGatherer *m_portsGatherer;
};
+RunWorkerFactory::WorkerCreator makeEmrunWorker()
+{
+ return RunWorkerFactory::make<EmrunRunWorker>();
+}
// Factories
@@ -120,12 +124,5 @@ EmrunRunConfigurationFactory::EmrunRunConfigurationFactory()
addSupportedTargetDeviceType(Constants::WEBASSEMBLY_DEVICE_TYPE);
}
-EmrunRunWorkerFactory::EmrunRunWorkerFactory()
-{
- setProducer([](RunControl *rc) { return new EmrunRunWorker(rc); });
- addSupportedRunMode(ProjectExplorer::Constants::NORMAL_RUN_MODE);
- addSupportedRunConfiguration(Constants::WEBASSEMBLY_RUNCONFIGURATION_EMRUN);
-}
-
} // namespace Internal
} // namespace Webassembly
diff --git a/src/plugins/webassembly/webassemblyrunconfiguration.h b/src/plugins/webassembly/webassemblyrunconfiguration.h
index 68bc2ae6c25..af6af51e816 100644
--- a/src/plugins/webassembly/webassemblyrunconfiguration.h
+++ b/src/plugins/webassembly/webassemblyrunconfiguration.h
@@ -37,11 +37,7 @@ public:
EmrunRunConfigurationFactory();
};
-class EmrunRunWorkerFactory : public ProjectExplorer::RunWorkerFactory
-{
-public:
- EmrunRunWorkerFactory();
-};
+ProjectExplorer::RunWorkerFactory::WorkerCreator makeEmrunWorker();
} // namespace Internal
} // namespace Webassembly
diff --git a/src/plugins/winrt/winrtplugin.cpp b/src/plugins/winrt/winrtplugin.cpp
index 18293783dd0..c42cde7c172 100644
--- a/src/plugins/winrt/winrtplugin.cpp
+++ b/src/plugins/winrt/winrtplugin.cpp
@@ -56,6 +56,19 @@ public:
WinRtDeviceFactory localDeviceFactory{Constants::WINRT_DEVICE_TYPE_LOCAL};
WinRtDeviceFactory phoneDeviceFactory{Constants::WINRT_DEVICE_TYPE_PHONE};
WinRtDeviceFactory emulatorDeviceFactory{Constants::WINRT_DEVICE_TYPE_EMULATOR};
+
+ RunWorkerFactory runWorkerFactory{
+ RunWorkerFactory::make<WinRtRunner>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {runConfigFactory.id()}
+ };
+
+ RunWorkerFactory debugWorkerFactory{
+ RunWorkerFactory::make<WinRtDebugSupport>(),
+ {ProjectExplorer::Constants::DEBUG_RUN_MODE},
+ {runConfigFactory.id()},
+ {Internal::Constants::WINRT_DEVICE_TYPE_LOCAL}
+ };
};
WinRtPlugin::~WinRtPlugin()
@@ -70,27 +83,6 @@ bool WinRtPlugin::initialize(const QStringList &arguments, QString *errorMessage
d = new WinRtPluginPrivate;
- auto runConstraint = [](RunConfiguration *runConfig) {
- IDevice::ConstPtr device = DeviceKitAspect::device(runConfig->target()->kit());
- if (!device)
- return false;
- return qobject_cast<WinRtRunConfiguration *>(runConfig) != nullptr;
- };
-
- auto debugConstraint = [](RunConfiguration *runConfig) {
- IDevice::ConstPtr device = DeviceKitAspect::device(runConfig->target()->kit());
- if (!device)
- return false;
- if (device->type() != Internal::Constants::WINRT_DEVICE_TYPE_LOCAL)
- return false;
- return qobject_cast<WinRtRunConfiguration *>(runConfig) != nullptr;
- };
-
- RunControl::registerWorker<WinRtRunner>
- (ProjectExplorer::Constants::NORMAL_RUN_MODE, runConstraint);
- RunControl::registerWorker<WinRtDebugSupport>
- (ProjectExplorer::Constants::DEBUG_RUN_MODE, debugConstraint);
-
return true;
}