Skip to content

Commit f3ba232

Browse files
authored
[projmgr] Rework debugger custom properties default handling
1 parent 4b696fb commit f3ba232

File tree

5 files changed

+9
-16
lines changed

5 files changed

+9
-16
lines changed

tools/projmgr/include/ProjMgrRunDebug.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ class ProjMgrRunDebug {
225225
const std::map<std::string, RteDeviceProperty*>& pnames);
226226
void CollectDebugTopology(const ContextItem& context, std::vector<std::pair<const RteItem*, std::vector<std::string>>> debugs,
227227
const std::map<std::string, RteDeviceProperty*>& pnames);
228-
void CustomVecPushBack(std::vector<CustomItem>& vec, const CustomItem& value);
229228
CustomItem& CustomMapFind(std::vector<std::pair<std::string, CustomItem>>& customMap, const std::string& key);
230229
void MergeCustomItems(const CustomItem& src, CustomItem& dst);
231230
};

tools/projmgr/src/ProjMgrRunDebug.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -633,15 +633,6 @@ bool ProjMgrRunDebug::GetDebugAdapter(const string& name, const DebugAdaptersIte
633633
return false;
634634
}
635635

636-
void ProjMgrRunDebug::CustomVecPushBack(vector<CustomItem>& vec, const CustomItem& value) {
637-
for (const auto& item : vec) {
638-
if (item.scalar == value.scalar) {
639-
return;
640-
}
641-
}
642-
vec.push_back(value);
643-
}
644-
645636
CustomItem& ProjMgrRunDebug::CustomMapFind(vector<pair<string, CustomItem>>& customMap, const string& key) {
646637
for (auto& [k, v] : customMap) {
647638
if (key == k) {
@@ -657,13 +648,11 @@ void ProjMgrRunDebug::MergeCustomItems(const CustomItem& src, CustomItem& dst) {
657648
dst.scalar = src.scalar;
658649
}
659650
else if (!src.vec.empty()) {
660-
for (const auto& item : src.vec) {
661-
CustomVecPushBack(dst.vec, item);
662-
}
651+
dst.vec = src.vec;
663652
}
664653
else if (!src.map.empty()) {
665654
for (const auto& [k, v] : src.map) {
666-
MergeCustomItems(v, CustomMapFind(dst.map, k));
655+
CustomMapFind(dst.map, k) = v;
667656
}
668657
}
669658
}

tools/projmgr/test/data/TestRunDebug/custom.csolution.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ solution:
1818
- value 2
1919
custom-map:
2020
key: value
21+
custom-array-map:
22+
- key: value 1
23+
- key: value 2
2124
images:
2225
- project-context: custom
2326

tools/projmgr/test/data/TestRunDebug/ref/custom+TestHW.cbuild-run.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ cbuild-run:
3434
custom-adapter-key: custom adapter value
3535
custom-key-overwrite: custom value overwrite
3636
custom-map:
37-
adapter-key: adapter value
3837
key: value
3938
custom-array:
40-
- adapter item
4139
- value 1
4240
- value 2
41+
custom-array-map:
42+
- key: value 1
43+
- key: value 2
4344
custom-key: custom value
4445
debug-vars:
4546
vars: |

tools/projmgr/test/src/ProjMgrUnitTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6736,6 +6736,7 @@ TEST_F(ProjMgrUnitTests, TestRunDebugCustom) {
67366736
testAdapter["defaults"]["custom-key-overwrite"] = "custom adapter key overwrite";
67376737
testAdapter["defaults"]["custom-map"]["adapter-key"] = "adapter value";
67386738
testAdapter["defaults"]["custom-array"][0] = "adapter item";
6739+
testAdapter["defaults"]["custom-array-map"][0]["adapter-key"] = "adapter value";
67396740
debugAdapters["debug-adapters"].push_back(testAdapter);
67406741
ofstream debugAdaptersFile;
67416742
debugAdaptersFile.open(debugAdaptersPath, fstream::trunc);

0 commit comments

Comments
 (0)