diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-04-08 12:53:16 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-04-08 13:05:58 +0200 |
commit | c4bfa359365152674608aaab29d10ae18e7d8236 (patch) | |
tree | 14167713964fe2fcf87c4d957d29da24f09795c5 | |
parent | 29a296143913d12ff6a5b8a10e5904cd2c58cc29 (diff) | |
download | justbuild-c4bfa359365152674608aaab29d10ae18e7d8236.tar.gz |
Result map: include tree-overlay actions to the origin map
Now that we generate tree-overlay action identifiers that are disjoint
from identifiers of regular actions, having a joint origin map
does not cause any confusion. Concerning the numbering of subtasks,
we always see tree-overlay actions following the regular actions,
even if defined in a different order. In this way, the identifiers
for the regular actions don't change. Including tree-overlay
actions in the origin map also has the advantage that the origin
is properly reported in case of failure (e.g., non-disjointness of
the obtained trees).
-rw-r--r-- | src/buildtool/build_engine/target_map/result_map.hpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/buildtool/build_engine/target_map/result_map.hpp b/src/buildtool/build_engine/target_map/result_map.hpp index d38a1d7a..449d8c92 100644 --- a/src/buildtool/build_engine/target_map/result_map.hpp +++ b/src/buildtool/build_engine/target_map/result_map.hpp @@ -204,7 +204,7 @@ class ResultTargetMap { auto& origin_map = progress->OriginMap(); origin_map.clear(); - origin_map.reserve(na); + origin_map.reserve(na + nto); for (const auto& target : targets_) { std::for_each(target.begin(), target.end(), [&](auto const& el) { auto const& actions = el.second->Actions(); @@ -225,6 +225,23 @@ class ResultTargetMap { origin}; } }); + auto const& tree_overlays = el.second->TreeOverlays(); + std::for_each( + tree_overlays.begin(), + tree_overlays.end(), + [&origin_map, &pos, &el](auto const& overlay) { + std::pair<ConfiguredTarget, std::size_t> origin{ + el.first, pos++}; + auto id = overlay->Id(); + if (origin_map.contains(id)) { + origin_map[id].push_back(origin); + } + else { + origin_map[id] = std::vector< + std::pair<ConfiguredTarget, std::size_t>>{ + origin}; + } + }); }); // Sort origins to get a reproducible order. We don't expect many // origins for a single action, so the cost of comparison is not |