diff --git a/tools/projmgr/src/ProjMgrWorker.cpp b/tools/projmgr/src/ProjMgrWorker.cpp index 95b8ad034..9cb993d9a 100644 --- a/tools/projmgr/src/ProjMgrWorker.cpp +++ b/tools/projmgr/src/ProjMgrWorker.cpp @@ -2237,27 +2237,33 @@ bool ProjMgrWorker::ProcessComponentFiles(ContextItem& context) { } } } - // all filtered files from packs except bootstrap and config files - const bool bootstrap = rteComponent->GetGenerator() && !rteComponent->IsGenerated(); - if (!bootstrap) { - const set& filteredfilesSet = context.rteActiveTarget->GetFilteredFiles(rteComponent); - auto cmp = [](RteFile* a, RteFile* b) { return a->GetName() < b->GetName(); }; - set filteredfiles(cmp); - filteredfiles.insert(filteredfilesSet.begin(), filteredfilesSet.end()); - for (const auto& componentFile : filteredfiles) { - const auto& attr = componentFile->GetAttribute("attr"); - if (attr == "config") { - continue; - } - const auto& category = componentFile->GetAttribute("category"); - const auto& name = category == "doc" ? componentFile->GetDocFile() : - rteComponent->GetPackage()->GetAbsolutePackagePath() + componentFile->GetAttribute("name"); - const auto& scope = componentFile->GetAttribute("scope"); - const auto& language = componentFile->GetAttribute("language"); - const auto& select = componentFile->GetAttribute("select"); - const auto& version = componentFile->GetVersionString(); - context.componentFiles[componentId].push_back({ name, attr, category, language, scope, version, select }); + // all filtered files from packs except gen and config files + const set& filteredfilesSet = context.rteActiveTarget->GetFilteredFiles(rteComponent); + auto cmp = [](RteFile* a, RteFile* b) { return a->GetName() < b->GetName(); }; + set filteredfiles(cmp); + filteredfiles.insert(filteredfilesSet.begin(), filteredfilesSet.end()); + for (const auto& componentFile : filteredfiles) { + const auto& attr = componentFile->GetAttribute("attr"); + if (attr == "config") { + continue; } + const auto& category = componentFile->GetAttribute("category"); + const auto& name = category == "doc" ? componentFile->GetDocFile() : + rteComponent->GetPackage()->GetAbsolutePackagePath() + componentFile->GetAttribute("name"); + const auto& scope = componentFile->GetAttribute("scope"); + const auto& language = componentFile->GetAttribute("language"); + const auto& select = componentFile->GetAttribute("select"); + const auto& version = componentFile->GetVersionString(); + switch (RteFile::CategoryFromString(category)) { + case RteFile::Category::GEN_SOURCE: + case RteFile::Category::GEN_HEADER: + case RteFile::Category::GEN_PARAMS: + case RteFile::Category::GEN_ASSET: + continue; // ignore gen files + default: + break; + }; + context.componentFiles[componentId].push_back({ name, attr, category, language, scope, version, select }); } // config files map configFilePaths; @@ -2552,6 +2558,14 @@ bool ProjMgrWorker::ProcessGpdsc(ContextItem& context) { components = gpdscComponent->GetChildren(); } for (const auto component : components) { + if (bootstrap.instance->GetComponentID(false) == component->GetComponentID(false)) { + if (VersionCmp::Compare(bootstrap.instance->GetVersionString(), component->GetVersionString()) > 0) { + // bootstrap has greater version, do not replace it + continue; + } else { + context.components.erase(bootstrap.instance->GetComponentID(true)); + } + } const auto& componentId = component->GetComponentID(true); RteComponentInstance* componentInstance = new RteComponentInstance(component); componentInstance->InitInstance(component); diff --git a/tools/projmgr/test/data/TestGenerator/ref/test-gpdsc-project-files.Debug+CM0.cbuild.yml b/tools/projmgr/test/data/TestGenerator/ref/test-gpdsc-project-files.Debug+CM0.cbuild.yml index f3f294f01..a3c4a089e 100644 --- a/tools/projmgr/test/data/TestGenerator/ref/test-gpdsc-project-files.Debug+CM0.cbuild.yml +++ b/tools/projmgr/test/data/TestGenerator/ref/test-gpdsc-project-files.Debug+CM0.cbuild.yml @@ -35,6 +35,10 @@ build: condition: RteDevice from-pack: ARM::RteTestGenerator@0.1.0 selected-by: Device:RteTest Generated Component:RteTest + files: + - file: ${CMSIS_PACK_ROOT}/ARM/RteTestGenerator/0.1.0/Templates/RteTest.gpdsc.template + category: other + version: 1.0.0 generator: id: RteTestGeneratorIdentifier from-pack: ARM::RteTestGenerator@0.1.0 diff --git a/tools/projmgr/test/data/TestSolution/ref/TestProject3_1.Debug+TypeA.cbuild-gen.yml b/tools/projmgr/test/data/TestSolution/ref/TestProject3_1.Debug+TypeA.cbuild-gen.yml index 9c3e523a6..d0f689011 100644 --- a/tools/projmgr/test/data/TestSolution/ref/TestProject3_1.Debug+TypeA.cbuild-gen.yml +++ b/tools/projmgr/test/data/TestSolution/ref/TestProject3_1.Debug+TypeA.cbuild-gen.yml @@ -39,6 +39,10 @@ build-gen: - component: ARM::Device:RteTest Generated Component:RteTestGenFiles@1.1.0 from-pack: ARM::RteTestGenerator@0.1.0 selected-by: Device:RteTest Generated Component:RteTestGenFiles + files: + - file: ${DEVTOOLS(packs)}/ARM/RteTestGenerator/0.1.0/Include/RteTestInc.h + category: header + version: 1.0.0 generator: id: RteTestGeneratorIdentifier from-pack: ARM::RteTestGenerator@0.1.0