Skip to content

Commit 8422a81

Browse files
[projmgr] Fix classic generator's bootstrap content reporting
1 parent 94f8dfe commit 8422a81

File tree

3 files changed

+42
-20
lines changed

3 files changed

+42
-20
lines changed

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,27 +2237,33 @@ bool ProjMgrWorker::ProcessComponentFiles(ContextItem& context) {
22372237
}
22382238
}
22392239
}
2240-
// all filtered files from packs except bootstrap and config files
2241-
const bool bootstrap = rteComponent->GetGenerator() && !rteComponent->IsGenerated();
2242-
if (!bootstrap) {
2243-
const set<RteFile*>& filteredfilesSet = context.rteActiveTarget->GetFilteredFiles(rteComponent);
2244-
auto cmp = [](RteFile* a, RteFile* b) { return a->GetName() < b->GetName(); };
2245-
set<RteFile*, decltype(cmp)> filteredfiles(cmp);
2246-
filteredfiles.insert(filteredfilesSet.begin(), filteredfilesSet.end());
2247-
for (const auto& componentFile : filteredfiles) {
2248-
const auto& attr = componentFile->GetAttribute("attr");
2249-
if (attr == "config") {
2250-
continue;
2251-
}
2252-
const auto& category = componentFile->GetAttribute("category");
2253-
const auto& name = category == "doc" ? componentFile->GetDocFile() :
2254-
rteComponent->GetPackage()->GetAbsolutePackagePath() + componentFile->GetAttribute("name");
2255-
const auto& scope = componentFile->GetAttribute("scope");
2256-
const auto& language = componentFile->GetAttribute("language");
2257-
const auto& select = componentFile->GetAttribute("select");
2258-
const auto& version = componentFile->GetVersionString();
2259-
context.componentFiles[componentId].push_back({ name, attr, category, language, scope, version, select });
2240+
// all filtered files from packs except gen and config files
2241+
const set<RteFile*>& filteredfilesSet = context.rteActiveTarget->GetFilteredFiles(rteComponent);
2242+
auto cmp = [](RteFile* a, RteFile* b) { return a->GetName() < b->GetName(); };
2243+
set<RteFile*, decltype(cmp)> filteredfiles(cmp);
2244+
filteredfiles.insert(filteredfilesSet.begin(), filteredfilesSet.end());
2245+
for (const auto& componentFile : filteredfiles) {
2246+
const auto& attr = componentFile->GetAttribute("attr");
2247+
if (attr == "config") {
2248+
continue;
22602249
}
2250+
const auto& category = componentFile->GetAttribute("category");
2251+
const auto& name = category == "doc" ? componentFile->GetDocFile() :
2252+
rteComponent->GetPackage()->GetAbsolutePackagePath() + componentFile->GetAttribute("name");
2253+
const auto& scope = componentFile->GetAttribute("scope");
2254+
const auto& language = componentFile->GetAttribute("language");
2255+
const auto& select = componentFile->GetAttribute("select");
2256+
const auto& version = componentFile->GetVersionString();
2257+
switch (RteFile::CategoryFromString(category)) {
2258+
case RteFile::Category::GEN_SOURCE:
2259+
case RteFile::Category::GEN_HEADER:
2260+
case RteFile::Category::GEN_PARAMS:
2261+
case RteFile::Category::GEN_ASSET:
2262+
continue; // ignore gen files
2263+
default:
2264+
break;
2265+
};
2266+
context.componentFiles[componentId].push_back({ name, attr, category, language, scope, version, select });
22612267
}
22622268
// config files
22632269
map<const RteItem*, string> configFilePaths;
@@ -2552,6 +2558,14 @@ bool ProjMgrWorker::ProcessGpdsc(ContextItem& context) {
25522558
components = gpdscComponent->GetChildren();
25532559
}
25542560
for (const auto component : components) {
2561+
if (bootstrap.instance->GetComponentID(false) == component->GetComponentID(false)) {
2562+
if (VersionCmp::Compare(bootstrap.instance->GetVersionString(), component->GetVersionString()) > 0) {
2563+
// bootstrap has greater version, do not replace it
2564+
continue;
2565+
} else {
2566+
context.components.erase(bootstrap.instance->GetComponentID(true));
2567+
}
2568+
}
25552569
const auto& componentId = component->GetComponentID(true);
25562570
RteComponentInstance* componentInstance = new RteComponentInstance(component);
25572571
componentInstance->InitInstance(component);

tools/projmgr/test/data/TestGenerator/ref/test-gpdsc-project-files.Debug+CM0.cbuild.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ build:
3535
condition: RteDevice
3636
from-pack: ARM::[email protected]
3737
selected-by: Device:RteTest Generated Component:RteTest
38+
files:
39+
- file: ${CMSIS_PACK_ROOT}/ARM/RteTestGenerator/0.1.0/Templates/RteTest.gpdsc.template
40+
category: other
41+
version: 1.0.0
3842
generator:
3943
id: RteTestGeneratorIdentifier
4044
from-pack: ARM::[email protected]

tools/projmgr/test/data/TestSolution/ref/TestProject3_1.Debug+TypeA.cbuild-gen.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ build-gen:
3939
- component: ARM::Device:RteTest Generated Component:[email protected]
4040
from-pack: ARM::[email protected]
4141
selected-by: Device:RteTest Generated Component:RteTestGenFiles
42+
files:
43+
- file: ${DEVTOOLS(packs)}/ARM/RteTestGenerator/0.1.0/Include/RteTestInc.h
44+
category: header
45+
version: 1.0.0
4246
generator:
4347
id: RteTestGeneratorIdentifier
4448
from-pack: ARM::[email protected]

0 commit comments

Comments
 (0)