McuSupport: support reading packages defaultValues depending on OS

default values can vary between windows and linux so when it is the
case a json object can be specified to describe the default values for
both.

Change-Id: Ifd3e4225ba0e1b1760f93ecea9cfafa4545c3404
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Yasser Grimes
2022-09-23 15:38:56 +03:00
parent b7ac02ab90
commit e38efabea9
3 changed files with 24 additions and 1 deletions

View File

@@ -629,12 +629,23 @@ static PackageDescription parsePackage(const QJsonObject &cmakeEntry)
[&](const QVariant &version) {
return version.toString();
});
//Parse the default value depending on the operating system
QString defaultPathString;
if (cmakeEntry["defaultValue"].isObject())
defaultPathString
= cmakeEntry["defaultValue"]
.toObject()[HostOsInfo::isWindowsHost() ? QString("windows") : QString("unix")]
.toString("");
else
defaultPathString = cmakeEntry["defaultValue"].toString();
return {cmakeEntry["label"].toString(),
cmakeEntry["envVar"].toString(),
cmakeEntry["cmakeVar"].toString(),
cmakeEntry["description"].toString(),
cmakeEntry["setting"].toString(),
FilePath::fromUserInput(cmakeEntry["defaultValue"].toString()),
FilePath::fromUserInput(defaultPathString),
FilePath::fromUserInput(cmakeEntry["validation"].toString()),
versions,
parseVersionDetection(cmakeEntry),