Skip to content

Commit

Permalink
Merge branch 'main' into outbound/seqFix
Browse files Browse the repository at this point in the history
  • Loading branch information
edriouk authored Sep 27, 2023
2 parents 7188776 + 6624b95 commit 75cf617
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
17 changes: 10 additions & 7 deletions tools/projmgr/src/ProjMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,15 @@ bool ProjMgr::RunConfigure(bool printConfig) {
if (!m_worker.InitializeModel()) {
return false;
}
vector<ContextItem*> allContexts;
vector<string> orderedContexts;
m_worker.GetYmlOrderedContexts(orderedContexts);
// Process contexts
bool error = false;
m_processedContexts.clear();
for (auto& contextName : orderedContexts) {
auto& contextItem = (*contexts)[contextName];
allContexts.push_back(&contextItem);
if (!m_worker.IsContextSelected(contextName)) {
continue;
}
Expand All @@ -481,6 +483,14 @@ bool ProjMgr::RunConfigure(bool printConfig) {
ProjMgrLogger::Info(infoMsg);
}
}

// Generate cbuild index
if (!allContexts.empty()) {
if (!m_emitter.GenerateCbuildIndex(m_parser, allContexts, m_outputDir)) {
return false;
}
}

return !error;
}

Expand Down Expand Up @@ -516,13 +526,6 @@ bool ProjMgr::RunConvert(void) {
return false;
}
}

// Generate cbuild index
if (!m_processedContexts.empty()) {
if (!m_emitter.GenerateCbuildIndex(m_parser, m_processedContexts, m_outputDir)) {
return false;
}
}
return !error;
}

Expand Down
3 changes: 3 additions & 0 deletions tools/projmgr/src/ProjMgrYamlEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,9 @@ bool ProjMgrYamlEmitter::GenerateCbuildIndex(ProjMgrParser& parser, const vector
ProjMgrYamlCbuild cbuild(rootNode[YAML_BUILD_IDX], contexts, parser, directory);

if (!cbuild.CompareFile(filename, rootNode)) {
if (!RteFsUtils::Exists(directory)) {
RteFsUtils::CreateDirectories(directory);
}
ofstream fileStream(filename);
if (!fileStream) {
ProjMgrLogger::Error(filename, "file cannot be written");
Expand Down
8 changes: 6 additions & 2 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3420,7 +3420,9 @@ TEST_F(ProjMgrUnitTests, RunProjMgr_UpdateRte) {
const string rteDir = testinput_folder + "/TestSolution/TestProject1/RTE/";
const string configFile = rteDir + "Device/RteTest_ARMCM0/startup_ARMCM0.c";
const string baseFile = configFile + "[email protected]";
const string& testdir = testoutput_folder + "/OutputDir";
RteFsUtils::RemoveDir(rteDir);
RteFsUtils::RemoveDir(testdir);
RteFsUtils::CreateFile(configFile, "// config file");
RteFsUtils::CreateFile(baseFile, "// config file@base");

Expand All @@ -3433,7 +3435,7 @@ TEST_F(ProjMgrUnitTests, RunProjMgr_UpdateRte) {
argv[3] = (char*)"-c";
argv[4] = (char*)"test1.Debug+CM0";
argv[5] = (char*)"-o";
argv[6] = (char*)testoutput_folder.c_str();
argv[6] = (char*)testdir.c_str();
argv[7] = (char*)"-v";
EXPECT_EQ(0, RunProjMgr(8, argv, 0));
EXPECT_TRUE(RteFsUtils::Exists(rteDir + "/_Debug_CM0/RTE_Components.h"));
Expand All @@ -3445,10 +3447,12 @@ info csolution: config files for each component:\n\
- .*/TestSolution/TestProject1/RTE/Device/RteTest_ARMCM0/ARMCM0_ac6.sct \\([email protected]\\)\n\
- .*/TestSolution/TestProject1/RTE/Device/RteTest_ARMCM0/startup_ARMCM0.c \\([email protected]\\) \\([email protected]\\)\n\
- .*/TestSolution/TestProject1/RTE/Device/RteTest_ARMCM0/system_ARMCM0.c \\([email protected]\\)\n\
.*/test.cbuild-idx.yml - info csolution: file generated successfully\n\
";

auto outStr = streamRedirect.GetOutString();
EXPECT_TRUE(regex_match(outStr, regex(expected)));
EXPECT_TRUE(regex_match(outStr, regex(expected))) <<
"Expected regex: \n" << expected << "\nActual:\n" << outStr;

streamRedirect.ClearStringStreams();
argv[1] = (char*)"list";
Expand Down

0 comments on commit 75cf617

Please sign in to comment.