forked from qt-creator/qt-creator
McuSupport: 2.2 does not use legacy implementation
Change-Id: I77ba78f8997f1727de5b39cc49811e1def4287d5 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -46,8 +46,9 @@ using McuPackagePtr = QSharedPointer<McuAbstractPackage>;
|
|||||||
using McuToolChainPackagePtr = QSharedPointer<McuToolChainPackage>;
|
using McuToolChainPackagePtr = QSharedPointer<McuToolChainPackage>;
|
||||||
using McuTargetPtr = QSharedPointer<McuTarget>;
|
using McuTargetPtr = QSharedPointer<McuTarget>;
|
||||||
|
|
||||||
|
static const QVersionNumber minimalVersion{2, 0, 0};
|
||||||
|
static const QVersionNumber newVersion{2, 2};
|
||||||
using Targets = QList<McuTargetPtr>;
|
using Targets = QList<McuTargetPtr>;
|
||||||
using Packages = QSet<McuPackagePtr>;
|
using Packages = QSet<McuPackagePtr>;
|
||||||
static const QVersionNumber legacyVersion{2, 0, 0};
|
|
||||||
|
|
||||||
} // namespace McuSupport::Internal
|
} // namespace McuSupport::Internal
|
||||||
|
@@ -114,7 +114,12 @@ void McuSupportOptions::registerExamples()
|
|||||||
|
|
||||||
const QVersionNumber &McuSupportOptions::minimalQulVersion()
|
const QVersionNumber &McuSupportOptions::minimalQulVersion()
|
||||||
{
|
{
|
||||||
return legacyVersion;
|
return minimalVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool McuSupportOptions::isLegacyVersion(const QVersionNumber &version)
|
||||||
|
{
|
||||||
|
return version < newVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void McuSupportOptions::setQulDir(const FilePath &dir)
|
void McuSupportOptions::setQulDir(const FilePath &dir)
|
||||||
|
@@ -76,6 +76,7 @@ public:
|
|||||||
static void registerExamples();
|
static void registerExamples();
|
||||||
|
|
||||||
static const QVersionNumber &minimalQulVersion();
|
static const QVersionNumber &minimalQulVersion();
|
||||||
|
static bool isLegacyVersion(const QVersionNumber &version);
|
||||||
|
|
||||||
void checkUpgradeableKits();
|
void checkUpgradeableKits();
|
||||||
void populatePackagesAndTargets();
|
void populatePackagesAndTargets();
|
||||||
|
@@ -589,8 +589,7 @@ bool checkDeprecatedSdkError(const Utils::FilePath &qulDir, QString &message)
|
|||||||
McuSdkRepository targetsAndPackages(const Utils::FilePath &dir)
|
McuSdkRepository targetsAndPackages(const Utils::FilePath &dir)
|
||||||
{
|
{
|
||||||
QList<McuTargetDescription> descriptions;
|
QList<McuTargetDescription> descriptions;
|
||||||
|
bool isLegacy{false};
|
||||||
bool isLegacy = false;
|
|
||||||
|
|
||||||
auto descriptionFiles = targetDescriptionFiles(dir);
|
auto descriptionFiles = targetDescriptionFiles(dir);
|
||||||
for (const QFileInfo &fileInfo : descriptionFiles) {
|
for (const QFileInfo &fileInfo : descriptionFiles) {
|
||||||
@@ -610,8 +609,7 @@ McuSdkRepository targetsAndPackages(const Utils::FilePath &dir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto qulVersion{QVersionNumber::fromString(desc.qulVersion)};
|
const auto qulVersion{QVersionNumber::fromString(desc.qulVersion)};
|
||||||
if (qulVersion == McuSupportOptions::minimalQulVersion())
|
isLegacy = McuSupportOptions::isLegacyVersion(qulVersion);
|
||||||
isLegacy = true;
|
|
||||||
|
|
||||||
if (qulVersion < McuSupportOptions::minimalQulVersion()) {
|
if (qulVersion < McuSupportOptions::minimalQulVersion()) {
|
||||||
const QString legacyVersion = legacySupportVersionFor(desc.qulVersion);
|
const QString legacyVersion = legacySupportVersionFor(desc.qulVersion);
|
||||||
|
@@ -316,4 +316,14 @@ void McuSupportTest::test_removeRtosSuffix()
|
|||||||
QCOMPARE(removeRtosSuffix(freeRtosEnvVar), expectedEnvVarWithoutSuffix);
|
QCOMPARE(removeRtosSuffix(freeRtosEnvVar), expectedEnvVarWithoutSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void McuSupportTest::test_2dot1UsesLegacyImplementation()
|
||||||
|
{
|
||||||
|
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 1}), true);
|
||||||
|
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 0}), true);
|
||||||
|
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 0, 0}), true);
|
||||||
|
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 0, 1}), true);
|
||||||
|
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 2, 0}), false);
|
||||||
|
QCOMPARE(McuSupportOptions::isLegacyVersion({2, 2, 1}), false);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace McuSupport::Internal::Test
|
} // namespace McuSupport::Internal::Test
|
||||||
|
@@ -62,10 +62,10 @@ private slots:
|
|||||||
void test_parseCmakeEntries();
|
void test_parseCmakeEntries();
|
||||||
void test_removeRtosSuffix_data();
|
void test_removeRtosSuffix_data();
|
||||||
void test_removeRtosSuffix();
|
void test_removeRtosSuffix();
|
||||||
|
void test_2dot1UsesLegacyImplementation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVersionNumber currentQulVersion{2, 0};
|
QVersionNumber currentQulVersion{2, 0};
|
||||||
|
|
||||||
const QString id{"target_id"};
|
const QString id{"target_id"};
|
||||||
const QString name{"target_name"};
|
const QString name{"target_name"};
|
||||||
const QString vendor{"target_vendor"};
|
const QString vendor{"target_vendor"};
|
||||||
|
Reference in New Issue
Block a user