forked from qt-creator/qt-creator
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:
@@ -73,6 +73,9 @@ namespace ProjectExplorer {
|
|||||||
|
|
||||||
static QList<RunWorkerFactory *> g_runWorkerFactories;
|
static QList<RunWorkerFactory *> g_runWorkerFactories;
|
||||||
|
|
||||||
|
static QSet<Core::Id> g_runModes;
|
||||||
|
static QSet<Core::Id> g_runConfigs;
|
||||||
|
|
||||||
RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer,
|
RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer,
|
||||||
const QList<Core::Id> &runModes,
|
const QList<Core::Id> &runModes,
|
||||||
const QList<Core::Id> &runConfigs,
|
const QList<Core::Id> &runConfigs,
|
||||||
@@ -83,6 +86,12 @@ RunWorkerFactory::RunWorkerFactory(const WorkerCreator &producer,
|
|||||||
m_supportedDeviceTypes(deviceTypes)
|
m_supportedDeviceTypes(deviceTypes)
|
||||||
{
|
{
|
||||||
g_runWorkerFactories.append(this);
|
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()
|
RunWorkerFactory::~RunWorkerFactory()
|
||||||
@@ -119,6 +128,27 @@ bool RunWorkerFactory::canRun(Core::Id runMode,
|
|||||||
return true;
|
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
|
\class ProjectExplorer::RunControl
|
||||||
\brief The RunControl class instances represent one item that is run.
|
\brief The RunControl class instances represent one item that is run.
|
||||||
|
|||||||
@@ -160,6 +160,9 @@ public:
|
|||||||
return [](RunControl *runControl) { return new Worker(runControl); };
|
return [](RunControl *runControl) { return new Worker(runControl); };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For debugging only.
|
||||||
|
static void dumpAll();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WorkerCreator m_producer;
|
WorkerCreator m_producer;
|
||||||
QList<Core::Id> m_supportedRunModes;
|
QList<Core::Id> m_supportedRunModes;
|
||||||
|
|||||||
Reference in New Issue
Block a user