McuSupport: Store the source location of the JSON file

This allows to mention the file name the configuration was created from in
error messages.

Change-Id: Id8e3d4a754cf5c1f0a12c6b21af1158713c68690
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Rainer Keller
2022-10-14 09:25:29 +02:00
committed by Rainer Keller
parent d42214e556
commit 6326ccfe30
4 changed files with 9 additions and 9 deletions

View File

@@ -22,7 +22,6 @@
#include <projectexplorer/toolchainmanager.h>
#include <utils/algorithm.h>
#include <utils/environment.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
#include <QDir>
@@ -658,7 +657,7 @@ static QList<PackageDescription> parsePackages(const QJsonArray &cmakeEntries)
return result;
}
McuTargetDescription parseDescriptionJson(const QByteArray &data)
McuTargetDescription parseDescriptionJson(const QByteArray &data, const Utils::FilePath &sourceFile)
{
const QJsonDocument document = QJsonDocument::fromJson(data);
const QJsonObject target = document.object();
@@ -692,7 +691,8 @@ McuTargetDescription parseDescriptionJson(const QByteArray &data)
});
const QString platformName = platform.value("platformName").toString();
return {qulVersion,
return {sourceFile,
qulVersion,
compatVersion,
{platform.value("id").toString(),
platformName,
@@ -754,7 +754,8 @@ McuSdkRepository targetsAndPackages(const McuPackagePtr &qtForMCUsPackage,
if (!filePath.isReadableFile())
continue;
const McuTargetDescription desc = parseDescriptionJson(
filePath.fileContents().value_or(QByteArray()));
filePath.fileContents().value_or(QByteArray()),
filePath);
bool ok = false;
const int compatVersion = desc.compatVersion.toInt(&ok);
if (!desc.compatVersion.isEmpty() && ok && compatVersion > MAX_COMPATIBILITY_VERSION) {