McuSupport: Add flag in JSON for adding a package path to system path

An entry called "addToSystemPath" was added to JSON files to signal
whether the corresponding path should also be added to the system path.

Task-number: UL-6409
Change-Id: I2d7ba38b3905d67475a3c482692e4f8e21d4141e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: hjk <hjk@qt.io>
(cherry picked from commit fb643db088)
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Sivert Krøvel
2022-09-27 12:10:23 +02:00
parent 93dfa93b7d
commit 531e1a572e
32 changed files with 77 additions and 30 deletions

View File

@@ -649,7 +649,7 @@ static PackageDescription parsePackage(const QJsonObject &cmakeEntry)
FilePath::fromUserInput(cmakeEntry["validation"].toString()), FilePath::fromUserInput(cmakeEntry["validation"].toString()),
versions, versions,
parseVersionDetection(cmakeEntry), parseVersionDetection(cmakeEntry),
false}; cmakeEntry["addToSystemPath"].toBool()};
} }
static QList<PackageDescription> parsePackages(const QJsonArray &cmakeEntries) static QList<PackageDescription> parsePackages(const QJsonArray &cmakeEntries)

View File

@@ -140,7 +140,8 @@ McuPackagePtr McuTargetFactory::createPackage(const PackageDescription &pkgDesc)
pkgDesc.envVar, pkgDesc.envVar,
pkgDesc.versions, pkgDesc.versions,
{}, {},
createVersionDetection(pkgDesc.versionDetection)}}; createVersionDetection(pkgDesc.versionDetection),
pkgDesc.shouldAddToSystemPath}};
} }
McuToolChainPackage *McuTargetFactory::createToolchain( McuToolChainPackage *McuTargetFactory::createToolchain(

View File

@@ -24,7 +24,8 @@ constexpr auto armgcc_ek_ra6m3g_baremetal_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink", "windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink",
"unix": "/opt/SEGGER/JLink" "unix": "/opt/SEGGER/JLink"
}, },
"optional": true "optional": true,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -24,7 +24,8 @@ constexpr auto armgcc_ek_ra6m3g_freertos_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink", "windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink",
"unix": "/opt/SEGGER/JLink" "unix": "/opt/SEGGER/JLink"
}, },
"optional": true "optional": true,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto armgcc_mimxrt1050_evk_baremetal_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto armgcc_mimxrt1050_evk_freertos_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -23,7 +23,8 @@ constexpr auto armgcc_mimxrt1060_evk_baremetal_json = R"(
"windows": "%{Env:ROOT}/nxp/MCUXpressoIDE*", "windows": "%{Env:ROOT}/nxp/MCUXpressoIDE*",
"unix": "/usr/local/mcuxpressoide/" "unix": "/usr/local/mcuxpressoide/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto armgcc_mimxrt1064_evk_baremetal_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto armgcc_mimxrt1064_evk_freertos_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto armgcc_mimxrt1170_evk_freertos_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -22,7 +22,8 @@ constexpr auto armgcc_stm32f469i_discovery_baremetal_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/", "windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" "unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -23,7 +23,8 @@ constexpr auto armgcc_stm32f769i_discovery_baremetal_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/", "windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" "unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -23,7 +23,8 @@ constexpr auto armgcc_stm32f769i_discovery_freertos_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/", "windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" "unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -23,7 +23,8 @@ constexpr auto armgcc_stm32h750b_discovery_baremetal_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/", "windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" "unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -25,7 +25,8 @@ constexpr auto ghs_rh850_d1m1a_baremetal_json = R"(
"unix": "%{Env:HOME}" "unix": "%{Env:HOME}"
}, },
"envVar": "RenesasFlashProgrammer_PATH", "envVar": "RenesasFlashProgrammer_PATH",
"optional": true "optional": true,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -19,7 +19,8 @@ constexpr auto ghs_tviic2d4m_baremetal_json = R"(
"label": "Cypress Auto Flash Utility", "label": "Cypress Auto Flash Utility",
"type": "path", "type": "path",
"cmakeVar": "INFINEON_AUTO_FLASH_UTILITY_DIR", "cmakeVar": "INFINEON_AUTO_FLASH_UTILITY_DIR",
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -19,7 +19,8 @@ constexpr auto ghs_tviic2d6m_baremetal_json = R"(
"label": "Cypress Auto Flash Utility", "label": "Cypress Auto Flash Utility",
"type": "path", "type": "path",
"cmakeVar": "INFINEON_AUTO_FLASH_UTILITY_DIR", "cmakeVar": "INFINEON_AUTO_FLASH_UTILITY_DIR",
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -24,7 +24,8 @@ constexpr auto iar_ek_ra6m3g_baremetal_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink", "windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink",
"unix": "/opt/SEGGER/JLink" "unix": "/opt/SEGGER/JLink"
}, },
"optional": true "optional": true,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -24,7 +24,8 @@ constexpr auto iar_ek_ra6m3g_freertos_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink", "windows": "%{Env:PROGRAMSANDFILES}/SEGGER/JLink",
"unix": "/opt/SEGGER/JLink" "unix": "/opt/SEGGER/JLink"
}, },
"optional": true "optional": true,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto iar_mimxrt1050_evk_baremetal_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto iar_mimxrt1050_evk_freertos_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto iar_mimxrt1060_evk_baremetal_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto iar_mimxrt1064_evk_baremetal_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto iar_mimxrt1064_evk_freertos_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -27,7 +27,8 @@ constexpr auto iar_mimxrt1170_evk_freertos_json = R"(
"versionDetection": { "versionDetection": {
"filePattern": "ide/binaries/crt_emu_cm_redlink" "filePattern": "ide/binaries/crt_emu_cm_redlink"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -22,7 +22,8 @@ constexpr auto iar_stm32f469i_discovery_baremetal_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/", "windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" "unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -23,7 +23,8 @@ constexpr auto iar_stm32f769i_discovery_baremetal_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/", "windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" "unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -23,7 +23,8 @@ constexpr auto iar_stm32f769i_discovery_freertos_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/", "windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" "unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -23,7 +23,8 @@ constexpr auto iar_stm32h750b_discovery_baremetal_json = R"(
"windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/", "windows": "%{Env:PROGRAMSANDFILES}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/",
"unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/" "unix": "%{Env:HOME}/STMicroelectronics/STM32Cube/STM32CubeProgrammer/"
}, },
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -19,7 +19,8 @@ constexpr auto iar_tviic2d6m_baremetal_json = R"(
"label": "Cypress Auto Flash Utility", "label": "Cypress Auto Flash Utility",
"type": "path", "type": "path",
"cmakeVar": "INFINEON_AUTO_FLASH_UTILITY_DIR", "cmakeVar": "INFINEON_AUTO_FLASH_UTILITY_DIR",
"optional": false "optional": false,
"addToSystemPath": true
} }
] ]
}, },

View File

@@ -1454,4 +1454,21 @@ void McuSupportTest::test_defaultValueForEachOperationSystem()
else else
QCOMPARE(QString("/usr/local/mcuxpressoide"), default_path_entry); QCOMPARE(QString("/usr/local/mcuxpressoide"), default_path_entry);
}; };
void McuSupportTest::test_addToSystemPathFlag()
{
const auto targetDescription = parseDescriptionJson(armgcc_stm32f769i_discovery_freertos_json);
const auto programmerPackage = targetDescription.platform.entries[0];
const auto compilerPackage = targetDescription.toolchain.compiler;
const auto toolchainFilePackage = targetDescription.toolchain.file;
const auto boardSdkPackage = targetDescription.boardSdk;
const auto freeRtosPackage = targetDescription.freeRTOS.package;
QCOMPARE(programmerPackage.shouldAddToSystemPath, true);
QCOMPARE(compilerPackage.shouldAddToSystemPath, false);
QCOMPARE(toolchainFilePackage.shouldAddToSystemPath, false);
QCOMPARE(boardSdkPackage.shouldAddToSystemPath, false);
QCOMPARE(freeRtosPackage.shouldAddToSystemPath, false);
}
} // namespace McuSupport::Internal::Test } // namespace McuSupport::Internal::Test

View File

@@ -96,6 +96,7 @@ private slots:
void test_legacy_createThirdPartyPackage(); void test_legacy_createThirdPartyPackage();
void test_defaultValueForEachOperationSystem(); void test_defaultValueForEachOperationSystem();
void test_addToSystemPathFlag();
private: private:
QVersionNumber currentQulVersion{2, 0}; QVersionNumber currentQulVersion{2, 0};