forked from qt-creator/qt-creator
ProjectExplorer: Remove replacement kits
... for which the original kit has turned up again. Otherwise we'd have more than one kit with the same id. Fixes: QTCREATORBUG-24589 Change-Id: I7ce16615694d3d2c5a5441f676ecb7dc85c2239c Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -736,4 +736,17 @@ void Kit::kitUpdated()
|
||||
d->m_mustNotify = false;
|
||||
}
|
||||
|
||||
|
||||
static Id replacementKey() { return "IsReplacementKit"; }
|
||||
|
||||
void ProjectExplorer::Kit::makeReplacementKit()
|
||||
{
|
||||
setValueSilently(replacementKey(), true);
|
||||
}
|
||||
|
||||
bool Kit::isReplacementKit() const
|
||||
{
|
||||
return value(replacementKey()).toBool();
|
||||
}
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
@@ -132,6 +132,9 @@ public:
|
||||
void setMutable(Utils::Id id, bool b);
|
||||
bool isMutable(Utils::Id id) const;
|
||||
|
||||
void makeReplacementKit();
|
||||
bool isReplacementKit() const;
|
||||
|
||||
void setIrrelevantAspects(const QSet<Utils::Id> &irrelevant);
|
||||
QSet<Utils::Id> irrelevantAspects() const;
|
||||
|
||||
|
@@ -235,6 +235,13 @@ void KitManager::restoreKits()
|
||||
// Delete all loaded autodetected kits that were not rediscovered:
|
||||
kitsToCheck.clear();
|
||||
|
||||
// Remove replacement kits for which the original kit has turned up again.
|
||||
erase(resultList, [&resultList](const std::unique_ptr<Kit> &k) {
|
||||
return k->isReplacementKit() && contains(resultList, [&k](const std::unique_ptr<Kit> &other) {
|
||||
return other->id() == k->id() && other != k;
|
||||
});
|
||||
});
|
||||
|
||||
static const auto kitMatchesAbiList = [](const Kit *kit, const Abis &abis) {
|
||||
const QList<ToolChain *> toolchains = ToolChainKitAspect::toolChains(kit);
|
||||
for (const ToolChain * const tc : toolchains) {
|
||||
|
@@ -776,6 +776,7 @@ void Project::createTargetFromMap(const QVariantMap &map, int index)
|
||||
Utils::transform(KitManager::kits(), &Kit::unexpandedDisplayName));
|
||||
kit->setUnexpandedDisplayName(tempKitName);
|
||||
DeviceTypeKitAspect::setDeviceTypeId(kit, deviceTypeId);
|
||||
kit->makeReplacementKit();
|
||||
kit->setup();
|
||||
}, id);
|
||||
TaskHub::addTask(BuildSystemTask(Task::Warning, tr("Project \"%1\" was configured for "
|
||||
|
Reference in New Issue
Block a user