forked from qt-creator/qt-creator
McuSupport: Enable os-specific executable version detection
Currently version detection fails in either Linux or Windows based on
the content of versionDetection.filePattern in the json kit file.
This change enables os-specific filePattern fields:
"versionDetection": {
"filePattern": {
"windows": "bin/arm-none-eabi-g++.exe",
"linux": "bin/arm-none-eabi-g++"
}
"executableArgs": "--version",
"regex": "\\b(\\d+\\.\\d+\\.\\d+)\\b"
}
Simply appending the binary extension with withExecutableSuffix()
is less portable and does not reflect the validationPath field.
For McuPackageDirectoryEntriesVersionDetector and
McuPackageXmlVersionDetector to work correctly, they rely on
filePattern not having os-specific fields.
Also make getOsSpecificValue and parseVersionDetection static.
Change-Id: Ieacf376126043d732eeb5d5a2f4125963022ae76
Reviewed-by: Sivert Krøvel <sivert.krovel@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -608,19 +608,7 @@ static FilePaths targetDescriptionFiles(const FilePath &dir)
|
||||
return kitsPath(dir).dirEntries(Utils::FileFilter({"*.json"}, QDir::Files));
|
||||
}
|
||||
|
||||
VersionDetection parseVersionDetection(const QJsonObject &packageEntry)
|
||||
{
|
||||
const QJsonObject versioning = packageEntry.value("versionDetection").toObject();
|
||||
return {
|
||||
versioning["regex"].toString(),
|
||||
versioning["filePattern"].toString(),
|
||||
versioning["executableArgs"].toString(),
|
||||
versioning["xmlElement"].toString(),
|
||||
versioning["xmlAttribute"].toString(),
|
||||
};
|
||||
}
|
||||
|
||||
QString getOsSpecificValue(const QJsonValue &entry)
|
||||
static QString getOsSpecificValue(const QJsonValue &entry)
|
||||
{
|
||||
if (entry.isObject()) {
|
||||
//The json entry has os-specific values
|
||||
@@ -630,6 +618,19 @@ QString getOsSpecificValue(const QJsonValue &entry)
|
||||
return entry.toString();
|
||||
}
|
||||
|
||||
static VersionDetection parseVersionDetection(const QJsonObject &packageEntry)
|
||||
{
|
||||
const QJsonObject versioning = packageEntry.value("versionDetection").toObject();
|
||||
return {
|
||||
versioning["regex"].toString(),
|
||||
getOsSpecificValue(versioning["filePattern"]),
|
||||
versioning["executableArgs"].toString(),
|
||||
versioning["xmlElement"].toString(),
|
||||
versioning["xmlAttribute"].toString(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
static PackageDescription parsePackage(const QJsonObject &cmakeEntry)
|
||||
{
|
||||
const QVariantList versionsVariantList = cmakeEntry["versions"].toArray().toVariantList();
|
||||
|
||||
Reference in New Issue
Block a user