From ff277923d9484f91b6a27eb30ab1398589948313 Mon Sep 17 00:00:00 2001 From: hjk Date: Mon, 12 Aug 2019 18:27:49 +0200 Subject: [PATCH] ProjectExplorer: Add a facility to dump supported run worker setups Essentially walking the RunModes x RunConfigs x Devices cubes. Information is just the factory pointer, or null, some name would be nicer, but for now it turned out to be sufficient. Change-Id: Ifdf92b2353cb5c0346ee4566beb7d78a00645aed Reviewed-by: Christian Stenger Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/runcontrol.cpp | 30 ++++++++++++++++++++++ src/plugins/projectexplorer/runcontrol.h | 3 +++ 2 files changed, 33 insertions(+) diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index c7039fd78f0..0afc1a93d34 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -73,6 +73,9 @@ namespace ProjectExplorer { static QList g_runWorkerFactories; +static QSet g_runModes; +static QSet g_runConfigs; + RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer, const QList &runModes, const QList &runConfigs, @@ -83,6 +86,12 @@ RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer, m_supportedDeviceTypes(deviceTypes) { g_runWorkerFactories.append(this); + + // Debugging only. + for (Core::Id runMode : runModes) + g_runModes.insert(runMode); + for (Core::Id runConfig : runConfigs) + g_runConfigs.insert(runConfig); } RunWorkerFactory::~RunWorkerFactory() @@ -119,6 +128,27 @@ bool RunWorkerFactory::canRun(Core::Id runMode, return true; } +void RunWorkerFactory::dumpAll() +{ + const QList devices = + Utils::transform(IDeviceFactory::allDeviceFactories(), &IDeviceFactory::deviceType); + + for (Core::Id runMode : qAsConst(g_runModes)) { + qDebug() << ""; + for (Core::Id device : devices) { + for (Core::Id runConfig : qAsConst(g_runConfigs)) { + const auto check = std::bind(&RunWorkerFactory::canRun, + std::placeholders::_1, + runMode, + device, + runConfig.toString()); + const auto factory = Utils::findOrDefault(g_runWorkerFactories, check); + qDebug() << "MODE:" << runMode << device << runConfig << factory; + } + } + } +} + /*! \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 09abfac3535..1d8ead5fa7e 100644 --- a/src/plugins/projectexplorer/runcontrol.h +++ b/src/plugins/projectexplorer/runcontrol.h @@ -160,6 +160,9 @@ public: return [](RunControl *runControl) { return new Worker(runControl); }; } + // For debugging only. + static void dumpAll(); + private: WorkerCreator m_producer; QList m_supportedRunModes;