ProjectExplorer: Pass device to ToolChain::autodetect

Currently unused, will be useful to detect toolchains in docker
containers.

Change-Id: I0fd7643969ab02c05839332a436147ffb242635d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-04-27 16:06:50 +02:00
parent c8f8513c8d
commit 509f40825a
23 changed files with 101 additions and 49 deletions

View File

@@ -67,11 +67,12 @@ struct ToolChainOperations
QList<ToolChain *> toDelete;
};
static QList<ToolChain *> autoDetectToolChains(const QList<ToolChain *> alreadyKnownTcs)
static QList<ToolChain *> autoDetectToolChains(const QList<ToolChain *> alreadyKnownTcs,
const IDevice::Ptr &device)
{
QList<ToolChain *> result;
for (ToolChainFactory *f : ToolChainFactory::allToolChainFactories())
result.append(f->autoDetect(alreadyKnownTcs));
result.append(f->autoDetect(alreadyKnownTcs, device));
// Remove invalid toolchains that might have sneaked in.
return Utils::filtered(result, [](const ToolChain *tc) { return tc->isValid(); });
@@ -203,7 +204,8 @@ QList<ToolChain *> ToolChainSettingsAccessor::restoreToolChains(QWidget *parent)
// Autodetect: Pass autodetected toolchains from user file so the information can be reused:
const QList<ToolChain *> autodetectedUserFileTcs
= Utils::filtered(userFileTcs, &ToolChain::isAutoDetected);
const QList<ToolChain *> autodetectedTcs = autoDetectToolChains(autodetectedUserFileTcs);
// FIXME: Use real device?
const QList<ToolChain *> autodetectedTcs = autoDetectToolChains(autodetectedUserFileTcs, {});
// merge tool chains and register those that we need to keep:
const ToolChainOperations ops = mergeToolChainLists(systemFileTcs, userFileTcs, autodetectedTcs);