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 <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2019-08-12 18:27:49 +02:00
parent 583cf69391
commit ff277923d9
2 changed files with 33 additions and 0 deletions

View File

@@ -73,6 +73,9 @@ namespace ProjectExplorer {
static QList<RunWorkerFactory *> g_runWorkerFactories;
static QSet<Core::Id> g_runModes;
static QSet<Core::Id> g_runConfigs;
RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer,
const QList<Core::Id> &runModes,
const QList<Core::Id> &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<Core::Id> 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.