summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-08 12:53:16 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2025-04-08 13:05:58 +0200
commitc4bfa359365152674608aaab29d10ae18e7d8236 (patch)
tree14167713964fe2fcf87c4d957d29da24f09795c5
parent29a296143913d12ff6a5b8a10e5904cd2c58cc29 (diff)
downloadjustbuild-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.hpp19
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