Skip to content

Commit

Permalink
[projmgr] Emit api nodes in a deterministic order
Browse files Browse the repository at this point in the history
  • Loading branch information
spcaipers-arm authored Dec 16, 2024
1 parent d02ebf4 commit b583731
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ struct ContextItem {
std::map<std::string, std::string> targetAttributes;
std::map<std::string, RtePackage*> packages;
std::map<std::string, SelectedComponentItem> components;
std::map<RteApi*, std::vector<std::string>> apis;
std::map<std::string, std::pair<RteApi*, std::vector<std::string>>> apis;
std::map<std::string, SelectedComponentItem> bootstrapComponents;
StrMap bootstrapMap;
std::vector<std::tuple<RteItem::ConditionResult, std::string, std::set<std::string>, std::set<std::string>>> validationResults;
Expand Down
5 changes: 3 additions & 2 deletions tools/projmgr/src/ProjMgrCbuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ void ProjMgrCbuild::SetComponentFilesNode(YAML::Node node, const ContextItem* co
}

void ProjMgrCbuild::SetApisNode(YAML::Node node, const ContextItem* context) {
for (const auto& [api, componentIds] : context->apis) {
for (const auto& [apiId, item] : context->apis) {
YAML::Node apiNode;
const auto& apiId = api->ConstructComponentID(true);
const auto& api = item.first;
const auto& componentIds = item.second;
SetNodeValue(apiNode[YAML_API], apiId);
SetNodeValue(apiNode[YAML_CONDITION], api->GetConditionID());
SetNodeValue(apiNode[YAML_FROM_PACK], api->GetPackageID());
Expand Down
7 changes: 4 additions & 3 deletions tools/projmgr/src/ProjMgrWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2217,9 +2217,10 @@ bool ProjMgrWorker::ProcessComponentFiles(ContextItem& context) {
// component based API files
const auto& api = rteComponent->GetApi(context.rteActiveTarget, true);
if (api) {
context.apis[api].push_back(componentId);
if (context.apis[api].size() == 1) {
const auto& apiId = api->ConstructComponentID(true);
const auto& apiId = api->ConstructComponentID(true);
context.apis[apiId].first = api;
context.apis[apiId].second.push_back(componentId);
if (context.apis[apiId].second.size() == 1) {
const auto& apiFiles = api->GetFileContainer() ? api->GetFileContainer()->GetChildren() : Collection<RteItem*>();
for (const auto& apiFile : apiFiles) {
const auto& attr = apiFile->GetAttribute("attr");
Expand Down

0 comments on commit b583731

Please sign in to comment.