McuSupport: Change version checking from exact == to >= minimum

So far, one Qt Creator version supported exactly one Qt for MCUs
version, mainly because of incompatibilities in-between Qt for MCUs
versions.

The compatibility of 1.2 with 1.3 and further is now deemed stable
enough to loosen the version checking.

This change replaces the exact versions comparison (between Qt for MCUs
SDK version and what Qt Creator supports) to a minimum version check of
what Qt Creator supports.

One limitation that remains is that you can only have one kit per target,
across the supported Qt for MCUs versions. To mend this, UI changes are
required (in a separate commit).
Workaround for now: If you want e.g. Desktop Kits for different Qt for
MCUs versions at the same time, you need to work with kit clones.

Task-number: QTCREATORBUG-24293
Change-Id: Ifd31cd2eadbc1d7fa02415e1928d0047cf007f7c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2020-06-30 17:09:03 +02:00
parent 6fec04d6de
commit dd505ef413
3 changed files with 29 additions and 18 deletions

View File

@@ -336,10 +336,12 @@ QVariant McuToolChainPackage::debuggerId() const
return debuggerId;
}
McuTarget::McuTarget(const QString &vendor, const QString &platform, OS os,
McuTarget::McuTarget(const QVersionNumber &qulVersion, const QString &vendor,
const QString &platform, OS os,
const QVector<McuPackage *> &packages,
const McuToolChainPackage *toolChainPackage)
: m_vendor(vendor)
: m_qulVersion(qulVersion)
, m_vendor(vendor)
, m_qulPlatform(platform)
, m_os(os)
, m_packages(packages)
@@ -379,6 +381,11 @@ bool McuTarget::isValid() const
});
}
QVersionNumber McuTarget::qulVersion() const
{
return m_qulVersion;
}
int McuTarget::colorDepth() const
{
return m_colorDepth;
@@ -455,7 +462,7 @@ void McuSupportOptions::deletePackagesAndTargets()
mcuTargets.clear();
}
const QVersionNumber &McuSupportOptions::supportedQulVersion()
const QVersionNumber &McuSupportOptions::minimalQulVersion()
{
static const QVersionNumber v({1, 3});
return v;
@@ -498,7 +505,7 @@ static void setKitProperties(const QString &kitName, ProjectExplorer::Kit *k,
k->setValue(KIT_MCUTARGET_VENDOR_KEY, mcuTarget->vendor());
k->setValue(KIT_MCUTARGET_MODEL_KEY, mcuTarget->qulPlatform());
k->setValue(KIT_MCUTARGET_COLORDEPTH_KEY, mcuTarget->colorDepth());
k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, McuSupportOptions::supportedQulVersion().toString());
k->setValue(KIT_MCUTARGET_SDKVERSION_KEY, mcuTarget->qulVersion().toString());
k->setValue(KIT_MCUTARGET_KITVERSION_KEY, KIT_VERSION);
k->setValue(KIT_MCUTARGET_OS_KEY, static_cast<int>(mcuTarget->os()));
k->setAutoDetected(true);
@@ -631,7 +638,7 @@ QString McuSupportOptions::kitName(const McuTarget *mcuTarget)
? "Desktop"
: mcuTarget->qulPlatform();
return QString::fromLatin1("Qt for MCUs %1 - %2%3%4")
.arg(supportedQulVersion().toString(), targetName, os, colorDepth);
.arg(mcuTarget->qulVersion().toString(), targetName, os, colorDepth);
}
QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *mcuTarget)
@@ -641,8 +648,6 @@ QList<ProjectExplorer::Kit *> McuSupportOptions::existingKits(const McuTarget *m
return Utils::filtered(KitManager::kits(), [mcuTarget](Kit *kit) {
return kit->isAutoDetected()
&& kit->value(KIT_MCUTARGET_KITVERSION_KEY) == KIT_VERSION
&& kit->value(KIT_MCUTARGET_SDKVERSION_KEY) ==
McuSupportOptions::supportedQulVersion().toString()
&& (!mcuTarget || (
kit->value(KIT_MCUTARGET_VENDOR_KEY) == mcuTarget->vendor()
&& kit->value(KIT_MCUTARGET_MODEL_KEY) == mcuTarget->qulPlatform()