Skip to content

Commit 95d04e4

Browse files
authored
[projmgr] Skip cbuild-run generation when target-set has only lib contexts
1 parent b74b833 commit 95d04e4

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

tools/projmgr/include/ProjMgrWorker.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,13 @@ class ProjMgrWorker {
10341034
* @return vector of template items
10351035
*/
10361036
std::vector<TemplateItem> CollectTemplates(const ContextItem& context);
1037+
1038+
/**
1039+
* @brief check if all selected contexts have lib output
1040+
* @param reference to processed contexts
1041+
* @return true if it's lib only
1042+
*/
1043+
bool IsLibOnly(const std::vector<ContextItem*>& contexts);
10371044

10381045
/**
10391046
* @brief clear worker members for reloading a solution

tools/projmgr/src/ProjMgr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ bool ProjMgr::GenerateYMLConfigurationFiles(bool previousResult) {
579579
}
580580

581581
// Generate cbuild-run file
582-
if (previousResult && !m_processedContexts.empty() &&
582+
if (previousResult && !m_processedContexts.empty() && !m_worker.IsLibOnly(m_processedContexts) &&
583583
(m_contextSet || m_activeTargetSet.has_value())) {
584584
const auto& debugAdapters = GetDebugAdaptersFile();
585585
if (!debugAdapters.empty()) {

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5775,3 +5775,12 @@ bool ProjMgrWorker::PopulateActiveTargetSet(const string& activeTargetSet) {
57755775
}
57765776
return true;
57775777
}
5778+
5779+
bool ProjMgrWorker::IsLibOnly(const std::vector<ContextItem*>& contexts) {
5780+
for (auto& context : contexts) {
5781+
if (!context->outputTypes.lib.on) {
5782+
return false;
5783+
}
5784+
}
5785+
return true;
5786+
}

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4641,8 +4641,8 @@ TEST_F(ProjMgrUnitTests, RunProjMgr_StandardLibrary) {
46414641
const string& csolution = testinput_folder + "/TestSolution/StandardLibrary/library.csolution.yml";
46424642
argv[1] = (char*)"convert";
46434643
argv[2] = (char*)csolution.c_str();
4644-
argv[3] = (char*)"-c";
4645-
argv[4] = (char*)"library.Debug+RteTest_ARMCM3";
4644+
argv[3] = (char*)"-a";
4645+
argv[4] = (char*)"";
46464646
argv[5] = (char*)"-o";
46474647
argv[6] = (char*)testoutput_folder.c_str();
46484648
argv[7] = (char*)"--cbuildgen";
@@ -4655,6 +4655,10 @@ TEST_F(ProjMgrUnitTests, RunProjMgr_StandardLibrary) {
46554655
// Check generated cbuild YMLs
46564656
ProjMgrTestEnv::CompareFile(testoutput_folder + "/library.Debug+RteTest_ARMCM3.cbuild.yml",
46574657
testinput_folder + "/TestSolution/StandardLibrary/ref/library.Debug+RteTest_ARMCM3.cbuild.yml");
4658+
4659+
// Check there is no cbuild-run (target-set has only lib contexts)
4660+
const YAML::Node& cbuildIdx = YAML::LoadFile(testoutput_folder + "/library.cbuild-idx.yml");
4661+
EXPECT_FALSE(cbuildIdx["build-idx"]["cbuild-run"].IsDefined());
46584662
}
46594663

46604664
TEST_F(ProjMgrUnitTests, RunProjMgr_MultipleProject_SameFolder) {

0 commit comments

Comments
 (0)