Skip to content

Commit b583731

Browse files
[projmgr] Emit api nodes in a deterministic order
1 parent d02ebf4 commit b583731

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

tools/projmgr/include/ProjMgrWorker.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ struct ContextItem {
330330
std::map<std::string, std::string> targetAttributes;
331331
std::map<std::string, RtePackage*> packages;
332332
std::map<std::string, SelectedComponentItem> components;
333-
std::map<RteApi*, std::vector<std::string>> apis;
333+
std::map<std::string, std::pair<RteApi*, std::vector<std::string>>> apis;
334334
std::map<std::string, SelectedComponentItem> bootstrapComponents;
335335
StrMap bootstrapMap;
336336
std::vector<std::tuple<RteItem::ConditionResult, std::string, std::set<std::string>, std::set<std::string>>> validationResults;

tools/projmgr/src/ProjMgrCbuild.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,10 @@ void ProjMgrCbuild::SetComponentFilesNode(YAML::Node node, const ContextItem* co
203203
}
204204

205205
void ProjMgrCbuild::SetApisNode(YAML::Node node, const ContextItem* context) {
206-
for (const auto& [api, componentIds] : context->apis) {
206+
for (const auto& [apiId, item] : context->apis) {
207207
YAML::Node apiNode;
208-
const auto& apiId = api->ConstructComponentID(true);
208+
const auto& api = item.first;
209+
const auto& componentIds = item.second;
209210
SetNodeValue(apiNode[YAML_API], apiId);
210211
SetNodeValue(apiNode[YAML_CONDITION], api->GetConditionID());
211212
SetNodeValue(apiNode[YAML_FROM_PACK], api->GetPackageID());

tools/projmgr/src/ProjMgrWorker.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,9 +2217,10 @@ bool ProjMgrWorker::ProcessComponentFiles(ContextItem& context) {
22172217
// component based API files
22182218
const auto& api = rteComponent->GetApi(context.rteActiveTarget, true);
22192219
if (api) {
2220-
context.apis[api].push_back(componentId);
2221-
if (context.apis[api].size() == 1) {
2222-
const auto& apiId = api->ConstructComponentID(true);
2220+
const auto& apiId = api->ConstructComponentID(true);
2221+
context.apis[apiId].first = api;
2222+
context.apis[apiId].second.push_back(componentId);
2223+
if (context.apis[apiId].second.size() == 1) {
22232224
const auto& apiFiles = api->GetFileContainer() ? api->GetFileContainer()->GetChildren() : Collection<RteItem*>();
22242225
for (const auto& apiFile : apiFiles) {
22252226
const auto& attr = apiFile->GetAttribute("attr");

0 commit comments

Comments
 (0)