Skip to content

Commit

Permalink
Merge branch 'main' into support-for-tiarmclang-toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Hermann-Core authored Dec 8, 2024
2 parents 9ae3bd9 + 085d48e commit 0975203
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tools/projmgr/include/ProjMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ enum ErrorCode
{
SUCCESS = 0,
ERROR = 1,
VARIABLE_NOT_DEFINED
VARIABLE_NOT_DEFINED = 2,
COMPILER_NOT_DEFINED = 3,
};

/**
Expand Down
6 changes: 6 additions & 0 deletions tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,12 @@ class ProjMgrWorker {
*/
bool HasVarDefineError();

/**
* @brief check whether compiler is not defined and there are selectable ones
* @return true if error is set
*/
bool HasCompilerDefineError();

/**
* @brief get list of detected undefined layer variables
* @return list of undefined layer variables
Expand Down
4 changes: 4 additions & 0 deletions tools/projmgr/src/ProjMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@ int ProjMgr::ProcessCommands() {
if (m_worker.HasVarDefineError()) {
return ErrorCode::VARIABLE_NOT_DEFINED;
}
// Check if compiler not defined and there are selectable ones
if (m_worker.HasCompilerDefineError()) {
return ErrorCode::COMPILER_NOT_DEFINED;
}
if (!convSuccess) {
return ErrorCode::ERROR;
}
Expand Down
4 changes: 4 additions & 0 deletions tools/projmgr/src/ProjMgrWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5030,6 +5030,10 @@ bool ProjMgrWorker::HasVarDefineError() {
return (m_undefLayerVars.size() > 0 ? true : false);
}

bool ProjMgrWorker::HasCompilerDefineError() {
return (m_undefCompiler && !m_selectableCompilers.empty());
}

const set<string>& ProjMgrWorker::GetUndefLayerVars() {
return m_undefLayerVars;
}
Expand Down
2 changes: 1 addition & 1 deletion tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6188,7 +6188,7 @@ TEST_F(ProjMgrUnitTests, SelectableToolchains) {
argv[3] = (char*)"-o";
argv[4] = (char*)testoutput_folder.c_str();
argv[5] = (char*)"--cbuildgen";
EXPECT_EQ(1, RunProjMgr(6, argv, m_envp));
EXPECT_EQ(ErrorCode::COMPILER_NOT_DEFINED, RunProjMgr(6, argv, m_envp));
const string err = streamRedirect.GetErrorString();
const string expectedErr = \
"error csolution: compiler undefined, use '--toolchain' option or add 'compiler: <value>' to yml input, selectable values can be found in cbuild-idx.yml";
Expand Down

0 comments on commit 0975203

Please sign in to comment.