Skip to content

Commit 76133e2

Browse files
authored
[projmgr] Fix for-compiler check and error message
1 parent 3908cdb commit 76133e2

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

tools/projmgr/include/ProjMgrWorker.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,7 @@ class ProjMgrWorker {
11431143
m_missingFiles.clear();
11441144
m_types = {};
11451145
m_activeTargetType.clear();
1146+
m_missingToolchains.clear();
11461147
m_undefCompiler = false;
11471148
m_isSetupCommand = false;
11481149
};
@@ -1303,6 +1304,7 @@ class ProjMgrWorker {
13031304
template<class T> bool CheckFilter(const std::string& filter, const T& item);
13041305
void ResolvePackRequirement(ContextItem& context, const PackItem& packEntry, bool ignoreCBuildPack);
13051306
void FormatResolvedPackIds();
1307+
void RetrieveToolchainConfigFiles();
13061308
};
13071309

13081310
#endif // PROJMGRWORKER_H

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,6 +1835,7 @@ void ProjMgrWorker::ResolvePackRequirement(ContextItem& context, const PackItem&
18351835
}
18361836

18371837
bool ProjMgrWorker::ProcessToolchain(ContextItem& context) {
1838+
RetrieveToolchainConfigFiles();
18381839
if (context.compiler.empty()) {
18391840
// Use the default compiler if available
18401841
if (context.cdefault && !context.cdefault->compiler.empty()) {
@@ -3939,7 +3940,7 @@ void ProjMgrWorker::PrintMissingFilters(void) {
39393940
(misspelled ? ", did you mean '." + type + "'?" : ""));
39403941
}
39413942
for (const auto& toolchain : m_missingToolchains) {
3942-
ProjMgrLogger::Get().Warn("compiler '" + toolchain + "' is not supported");
3943+
ProjMgrLogger::Get().Warn("'for-compiler: " + toolchain + "' is not supported");
39433944
}
39443945
}
39453946

@@ -5152,17 +5153,20 @@ bool ProjMgrWorker::GetLatestToolchain(ToolchainItem& toolchain) {
51525153
return found;
51535154
}
51545155

5155-
bool ProjMgrWorker::GetToolchainConfig(const string& toolchainName, const string& toolchainVersion, string& configPath, string& selectedConfigVersion) {
5156-
const string& compilerRoot = GetCompilerRoot();
5156+
void ProjMgrWorker::RetrieveToolchainConfigFiles(void) {
51575157
// get toolchain configuration files
51585158
if (m_toolchainConfigFiles.empty()) {
51595159
// get *.cmake files from compiler root (not recursively)
5160-
auto cmakeFiles = RteFsUtils::GrepFiles(compilerRoot, "*.cmake");
5160+
auto cmakeFiles = RteFsUtils::GrepFiles(GetCompilerRoot(), "*.cmake");
51615161
std::transform(cmakeFiles.begin(), cmakeFiles.end(), std::back_inserter(m_toolchainConfigFiles),
51625162
[](const std::filesystem::path& item) {
51635163
return item.generic_string();
5164-
});
5164+
});
51655165
}
5166+
}
5167+
5168+
bool ProjMgrWorker::GetToolchainConfig(const string& toolchainName, const string& toolchainVersion, string& configPath, string& selectedConfigVersion) {
5169+
RetrieveToolchainConfigFiles();
51665170
// find greatest compatible file
51675171
bool found = false;
51685172
static const regex regEx = regex("(\\w+)\\.(\\d+\\.\\d+\\.\\d+)");
@@ -5189,7 +5193,7 @@ bool ProjMgrWorker::GetToolchainConfig(const string& toolchainName, const string
51895193
}
51905194
}
51915195
if (!found) {
5192-
m_toolchainErrors[MessageType::Error].insert("no toolchain cmake files found for '" + toolchainName + "' in '" + compilerRoot + "' directory");
5196+
m_toolchainErrors[MessageType::Error].insert("no toolchain cmake files found for '" + toolchainName + "' in '" + GetCompilerRoot() + "' directory");
51935197
}
51945198
return found;
51955199
}

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5221,7 +5221,7 @@ warning csolution: build-type '.UnknownBuild' does not exist in solution\n\
52215221
warning csolution: target-type '+Debug' does not exist in solution, did you mean '.Debug'?\n\
52225222
warning csolution: target-type '+MappedDebug' does not exist in solution, did you mean '.MappedDebug'?\n\
52235223
warning csolution: target-type '+UnknownTarget' does not exist in solution\n\
5224-
warning csolution: compiler 'Ac6' is not supported\n\
5224+
warning csolution: 'for-compiler: Ac6' is not supported\n\
52255225
";
52265226
auto errStr = streamRedirect.GetErrorString();
52275227
EXPECT_TRUE(errStr.find(expected) != string::npos);

0 commit comments

Comments
 (0)