Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tools/projmgr/include/ProjMgrRunDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ class ProjMgrRunDebug {
const std::map<std::string, RteDeviceProperty*>& pnames);
void CollectDebugTopology(const ContextItem& context, std::vector<std::pair<const RteItem*, std::vector<std::string>>> debugs,
const std::map<std::string, RteDeviceProperty*>& pnames);
void CustomVecPushBack(std::vector<CustomItem>& vec, const CustomItem& value);
CustomItem& CustomMapFind(std::vector<std::pair<std::string, CustomItem>>& customMap, const std::string& key);
void MergeCustomItems(const CustomItem& src, CustomItem& dst);
};
Expand Down
15 changes: 2 additions & 13 deletions tools/projmgr/src/ProjMgrRunDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,15 +633,6 @@ bool ProjMgrRunDebug::GetDebugAdapter(const string& name, const DebugAdaptersIte
return false;
}

void ProjMgrRunDebug::CustomVecPushBack(vector<CustomItem>& vec, const CustomItem& value) {
for (const auto& item : vec) {
if (item.scalar == value.scalar) {
return;
}
}
vec.push_back(value);
}

CustomItem& ProjMgrRunDebug::CustomMapFind(vector<pair<string, CustomItem>>& customMap, const string& key) {
for (auto& [k, v] : customMap) {
if (key == k) {
Expand All @@ -657,13 +648,11 @@ void ProjMgrRunDebug::MergeCustomItems(const CustomItem& src, CustomItem& dst) {
dst.scalar = src.scalar;
}
else if (!src.vec.empty()) {
for (const auto& item : src.vec) {
CustomVecPushBack(dst.vec, item);
}
dst.vec = src.vec;
}
else if (!src.map.empty()) {
for (const auto& [k, v] : src.map) {
MergeCustomItems(v, CustomMapFind(dst.map, k));
CustomMapFind(dst.map, k) = v;
}
}
}
3 changes: 3 additions & 0 deletions tools/projmgr/test/data/TestRunDebug/custom.csolution.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ solution:
- value 2
custom-map:
key: value
custom-array-map:
- key: value 1
- key: value 2
images:
- project-context: custom

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ cbuild-run:
custom-adapter-key: custom adapter value
custom-key-overwrite: custom value overwrite
custom-map:
adapter-key: adapter value
key: value
custom-array:
- adapter item
- value 1
- value 2
custom-array-map:
- key: value 1
- key: value 2
custom-key: custom value
debug-vars:
vars: |
Expand Down
1 change: 1 addition & 0 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6736,6 +6736,7 @@ TEST_F(ProjMgrUnitTests, TestRunDebugCustom) {
testAdapter["defaults"]["custom-key-overwrite"] = "custom adapter key overwrite";
testAdapter["defaults"]["custom-map"]["adapter-key"] = "adapter value";
testAdapter["defaults"]["custom-array"][0] = "adapter item";
testAdapter["defaults"]["custom-array-map"][0]["adapter-key"] = "adapter value";
debugAdapters["debug-adapters"].push_back(testAdapter);
ofstream debugAdaptersFile;
debugAdaptersFile.open(debugAdaptersPath, fstream::trunc);
Expand Down
Loading