forked from qt-creator/qt-creator
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:
committed by
Rainer Keller
parent
d42214e556
commit
6326ccfe30
@@ -22,7 +22,6 @@
|
|||||||
#include <projectexplorer/toolchainmanager.h>
|
#include <projectexplorer/toolchainmanager.h>
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/fileutils.h>
|
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -658,7 +657,7 @@ static QList<PackageDescription> parsePackages(const QJsonArray &cmakeEntries)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
McuTargetDescription parseDescriptionJson(const QByteArray &data)
|
McuTargetDescription parseDescriptionJson(const QByteArray &data, const Utils::FilePath &sourceFile)
|
||||||
{
|
{
|
||||||
const QJsonDocument document = QJsonDocument::fromJson(data);
|
const QJsonDocument document = QJsonDocument::fromJson(data);
|
||||||
const QJsonObject target = document.object();
|
const QJsonObject target = document.object();
|
||||||
@@ -692,7 +691,8 @@ McuTargetDescription parseDescriptionJson(const QByteArray &data)
|
|||||||
});
|
});
|
||||||
const QString platformName = platform.value("platformName").toString();
|
const QString platformName = platform.value("platformName").toString();
|
||||||
|
|
||||||
return {qulVersion,
|
return {sourceFile,
|
||||||
|
qulVersion,
|
||||||
compatVersion,
|
compatVersion,
|
||||||
{platform.value("id").toString(),
|
{platform.value("id").toString(),
|
||||||
platformName,
|
platformName,
|
||||||
@@ -754,7 +754,8 @@ McuSdkRepository targetsAndPackages(const McuPackagePtr &qtForMCUsPackage,
|
|||||||
if (!filePath.isReadableFile())
|
if (!filePath.isReadableFile())
|
||||||
continue;
|
continue;
|
||||||
const McuTargetDescription desc = parseDescriptionJson(
|
const McuTargetDescription desc = parseDescriptionJson(
|
||||||
filePath.fileContents().value_or(QByteArray()));
|
filePath.fileContents().value_or(QByteArray()),
|
||||||
|
filePath);
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const int compatVersion = desc.compatVersion.toInt(&ok);
|
const int compatVersion = desc.compatVersion.toInt(&ok);
|
||||||
if (!desc.compatVersion.isEmpty() && ok && compatVersion > MAX_COMPATIBILITY_VERSION) {
|
if (!desc.compatVersion.isEmpty() && ok && compatVersion > MAX_COMPATIBILITY_VERSION) {
|
||||||
|
@@ -5,10 +5,7 @@
|
|||||||
|
|
||||||
#include "mcusupport_global.h"
|
#include "mcusupport_global.h"
|
||||||
#include "settingshandler.h"
|
#include "settingshandler.h"
|
||||||
|
#include <utils/fileutils.h>
|
||||||
namespace Utils {
|
|
||||||
class FilePath;
|
|
||||||
} // namespace Utils
|
|
||||||
|
|
||||||
namespace McuSupport::Internal {
|
namespace McuSupport::Internal {
|
||||||
|
|
||||||
@@ -28,7 +25,7 @@ bool checkDeprecatedSdkError(const Utils::FilePath &qulDir, QString &message);
|
|||||||
McuSdkRepository targetsAndPackages(const McuPackagePtr &qtForMCUsPackage,
|
McuSdkRepository targetsAndPackages(const McuPackagePtr &qtForMCUsPackage,
|
||||||
const SettingsHandler::Ptr &);
|
const SettingsHandler::Ptr &);
|
||||||
|
|
||||||
McuTargetDescription parseDescriptionJson(const QByteArray &);
|
McuTargetDescription parseDescriptionJson(const QByteArray &, const Utils::FilePath &sourceFile = Utils::FilePath());
|
||||||
McuSdkRepository targetsFromDescriptions(const QList<McuTargetDescription> &,
|
McuSdkRepository targetsFromDescriptions(const QList<McuTargetDescription> &,
|
||||||
const SettingsHandler::Ptr &,
|
const SettingsHandler::Ptr &,
|
||||||
const McuPackagePtr &qtForMCUsPackage,
|
const McuPackagePtr &qtForMCUsPackage,
|
||||||
|
@@ -39,6 +39,7 @@ struct McuTargetDescription
|
|||||||
{
|
{
|
||||||
enum class TargetType { MCU, Desktop };
|
enum class TargetType { MCU, Desktop };
|
||||||
|
|
||||||
|
Utils::FilePath sourceFile;
|
||||||
QString qulVersion;
|
QString qulVersion;
|
||||||
QString compatVersion;
|
QString compatVersion;
|
||||||
struct Platform
|
struct Platform
|
||||||
|
@@ -352,6 +352,7 @@ McuSupportTest::McuSupportTest()
|
|||||||
, compilerDescription{armGccLabel, armGccEnvVar, TOOLCHAIN_DIR_CMAKE_VARIABLE, armGccLabel, armGccDirectorySetting, {}, {}, {}, {}, false}
|
, compilerDescription{armGccLabel, armGccEnvVar, TOOLCHAIN_DIR_CMAKE_VARIABLE, armGccLabel, armGccDirectorySetting, {}, {}, {}, {}, false}
|
||||||
, toochainFileDescription{armGccLabel, armGccEnvVar, TOOLCHAIN_FILE_CMAKE_VARIABLE, armGccLabel, armGccDirectorySetting, {}, {}, {}, {}, false}
|
, toochainFileDescription{armGccLabel, armGccEnvVar, TOOLCHAIN_FILE_CMAKE_VARIABLE, armGccLabel, armGccDirectorySetting, {}, {}, {}, {}, false}
|
||||||
, targetDescription {
|
, targetDescription {
|
||||||
|
"autotest-sourceFile",
|
||||||
"2.0.1",
|
"2.0.1",
|
||||||
"2",
|
"2",
|
||||||
platformDescription,
|
platformDescription,
|
||||||
|
Reference in New Issue
Block a user