Skip to content

Commit 501f31d

Browse files
authored
Skip parsing copied-from to avoid redefinition
1 parent ffa6e92 commit 501f31d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tools/projmgr/src/ProjMgrYamlParser.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,15 @@ void ProjMgrYamlParser::ParseVectorOfStringPairs(const YAML::Node& parent, const
486486
if (item.IsMap()) {
487487
const auto& elements = item.as<map<string, string>>();
488488
for (auto element : elements) {
489-
if (YAML::IsNullString(element.second)) {
490-
element.second = "";
489+
// skip parsing variable named "copied-from"
490+
// This is a special case used by the CMSIS csolution extension
491+
// and may involve redefinitions
492+
if (element.first != "copied-from") {
493+
if (YAML::IsNullString(element.second)) {
494+
element.second = "";
495+
}
496+
value.push_back(element);
491497
}
492-
value.push_back(element);
493498
}
494499
} else {
495500
value.push_back(make_pair(item.as<string>(), ""));

tools/projmgr/test/data/TestLayers/variables-redefinition.csolution.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ solution:
77
compiler: AC6
88
variables:
99
- VariableName: FirstValue
10+
- copied-from: /buildtype/test.yml
1011

1112
target-types:
1213
- type: TargetType
1314
device: RteTest_ARMCM0
1415
variables:
1516
- VariableName: SecondValue
17+
- copied-from: /targettype/test.yml
1618

1719
projects:
1820
- project: variables-redefinition.cproject.yml

0 commit comments

Comments
 (0)