McuSupport: Ignore resetting QtMCUs package on target update

QtMCUs package is part of every target with the same pointer address across all
targets, when reseting the target packages to default this will cause
inconsistensy as the default path for QtMCUs package is the home directory.

Fixes: QTCREATORBUG-29960
Change-Id: I2fcc6b631355928bc883e9072b0f3f3c12737c37
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Karim Abdelrahman <karim.abdelrahman@qt.io>
This commit is contained in:
Yasser Grimes
2023-11-27 14:58:37 +02:00
parent 5460a0d5f6
commit 9a364811de
2 changed files with 4 additions and 3 deletions

View File

@@ -30,7 +30,6 @@
#include <utils/algorithm.h>
#include <QCoreApplication>
#include <QMessageBox>
#include <QPushButton>
#include <QRegularExpression>
@@ -433,7 +432,7 @@ QList<Kit *> existingKits(const McuTarget *mcuTarget)
using namespace Constants;
// some models have compatible name changes that refere to the same supported board across versions.
// name changes are tracked here to recognize the corresponding kits as upgradable.
static QMap<QString, QStringList> upgradable_to = {
static const QMap<QString, QStringList> upgradable_to = {
{"MIMXRT1170-EVK-FREERTOS", {"MIMXRT1170-EVKB-FREERTOS"}}};
return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
return kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION

View File

@@ -7,6 +7,7 @@
#include "mcusupport_global.h"
#include "mcusupportplugin.h"
#include "mcusupporttr.h"
#include "mcusupportconstants.h"
#include <utils/algorithm.h>
@@ -115,12 +116,13 @@ void McuTarget::handlePackageProblems(MessagesList &messages) const
void McuTarget::resetInvalidPathsToDefault()
{
for (McuPackagePtr package : std::as_const(m_packages)) {
if (!package)
continue;
if (package->isValidStatus())
continue;
if (package->settingsKey() == Constants::SETTINGS_KEY_PACKAGE_QT_FOR_MCUS_SDK)
continue;
package->setPath(package->defaultPath());
package->writeToSettings();
}