forked from qt-creator/qt-creator
Android: Clean up messed up kits that were created by Android plugin
No idea how to reproduce, but it can happen [1] that stale Android kits appear in Qt Creator, which have broken combinations of Qt version and toolchains. The Android plugin updates the Android kits at startup, but only updates known "correct" kits, or creates new ones. Additionally remove any previously auto-created Android kits that were not recognized to be still usable. [1]: probably after switching between a working Android setup and a broken one, with broken toolchains/debuggers brought into the mix Change-Id: I709f52df62f8998647e4d68bdfe76015e8941ab8 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -1290,9 +1290,6 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
Utils::Id deviceTypeId = DeviceTypeKitAspect::deviceTypeId(k);
|
||||
if (k->isAutoDetected() && !k->isSdkProvided()
|
||||
&& deviceTypeId == Utils::Id(Constants::ANDROID_DEVICE_TYPE)) {
|
||||
if (!QtSupport::QtKitAspect::qtVersion(k))
|
||||
KitManager::deregisterKit(k); // Remove autoDetected kits without Qt.
|
||||
else
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1327,6 +1324,7 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
&& tc->isValid()
|
||||
&& tc->typeId() == Constants::ANDROID_TOOLCHAIN_TYPEID;
|
||||
});
|
||||
QList<Kit *> unhandledKits = existingKits;
|
||||
for (ToolChain *tc : toolchains) {
|
||||
if (tc->language() != Utils::Id(ProjectExplorer::Constants::CXX_LANGUAGE_ID))
|
||||
continue;
|
||||
@@ -1381,12 +1379,18 @@ void AndroidConfigurations::updateAutomaticKitList()
|
||||
k->setValueSilently(Constants::ANDROID_KIT_SDK, currentConfig().sdkLocation().toString());
|
||||
};
|
||||
|
||||
if (existingKit)
|
||||
if (existingKit) {
|
||||
initializeKit(existingKit); // Update the existing kit with new data.
|
||||
else
|
||||
unhandledKits.removeOne(existingKit);
|
||||
} else {
|
||||
KitManager::registerKit(initializeKit);
|
||||
}
|
||||
}
|
||||
}
|
||||
// cleanup any mess that might have existed before, by removing all Android kits that
|
||||
// existed before, but weren't re-used
|
||||
for (Kit *k : unhandledKits)
|
||||
KitManager::deregisterKit(k);
|
||||
}
|
||||
|
||||
bool AndroidConfigurations::force32bitEmulator()
|
||||
|
Reference in New Issue
Block a user