forked from qt-creator/qt-creator
ToolChainManager: Refactor toolchain restoration
This should be simpler to follow now. Fix autodetection to return not only the newly detected toolchains, but also those that are re-detected (taking their definition from the alreadyKnown list passed to the autodetect method where possible). This avoids running lots of toolchains during start-up, but still enables us to fix QTCREATORBUG-12751 Task-number: QTCREATORBUG-12751 Change-Id: Ie74e7cffb2b014a6132cc8559db232397344f2f1 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -1233,21 +1233,15 @@ static bool equalKits(Kit *a, Kit *b)
|
||||
|
||||
void AndroidConfigurations::registerNewToolChains()
|
||||
{
|
||||
QList<ToolChain *> existingToolChains = ToolChainManager::toolChains();
|
||||
QList<ToolChain *> toolchains = AndroidToolChainFactory::createToolChainsForNdk(AndroidConfigurations::currentConfig().ndkLocation());
|
||||
foreach (ToolChain *tc, toolchains) {
|
||||
bool found = false;
|
||||
for (int i = 0; i < existingToolChains.count(); ++i) {
|
||||
if (*(existingToolChains.at(i)) == *tc) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
delete tc;
|
||||
else
|
||||
const QList<ToolChain *> existingAndroidToolChains
|
||||
= Utils::filtered(ToolChainManager::toolChains(),
|
||||
Utils::equal(&ToolChain::typeId, Core::Id(Constants::ANDROID_TOOLCHAIN_ID)));
|
||||
|
||||
const QList<ToolChain *> newToolchains
|
||||
= AndroidToolChainFactory::autodetectToolChainsForNdk(AndroidConfigurations::currentConfig().ndkLocation(),
|
||||
existingAndroidToolChains);
|
||||
foreach (ToolChain *tc, newToolchains)
|
||||
ToolChainManager::registerToolChain(tc);
|
||||
}
|
||||
}
|
||||
|
||||
void AndroidConfigurations::removeOldToolChains()
|
||||
|
Reference in New Issue
Block a user