From 87eb89d8d3b28d7e9da26199654ec3be8ee59565 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 11 Mar 2024 16:52:52 +0100 Subject: just serve: Improve progress reporting During analysis it is useful to track and report the progress for all export targets. This is not exclusively linked to a serve endpoint being present, despite most of the time being expected to be spent in export targets being served from the remote endpoint. This commit refactors the current implementation to give proper feedback to the user on the progress of the analysis phase. --- .../build_engine/target_map/target_map.cpp | 38 +++++++++++++--------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'src/buildtool/build_engine/target_map/target_map.cpp') diff --git a/src/buildtool/build_engine/target_map/target_map.cpp b/src/buildtool/build_engine/target_map/target_map.cpp index d1812d92..02a28acd 100644 --- a/src/buildtool/build_engine/target_map/target_map.cpp +++ b/src/buildtool/build_engine/target_map/target_map.cpp @@ -30,7 +30,6 @@ #include "src/buildtool/build_engine/expression/function_map.hpp" #include "src/buildtool/build_engine/target_map/built_in_rules.hpp" #include "src/buildtool/build_engine/target_map/utils.hpp" -#include "src/buildtool/common/statistics.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/utils/cpp/gsl.hpp" #include "src/utils/cpp/path.hpp" @@ -1239,6 +1238,7 @@ void withTargetsFile( const gsl::not_null& repo_config, const ActiveTargetCache& target_cache, const gsl::not_null& stats, + const gsl::not_null& exports_progress, const nlohmann::json& targets_file, const gsl::not_null& source_target, const gsl::not_null& rule_map, @@ -1273,16 +1273,18 @@ void withTargetsFile( return; } // Handle built-in rule, if it is - auto handled_as_builtin = BuildMaps::Target::HandleBuiltin(*rule_it, - desc, - key, - repo_config, - target_cache, - stats, - subcaller, - setter, - logger, - result_map); + auto handled_as_builtin = + BuildMaps::Target::HandleBuiltin(*rule_it, + desc, + key, + repo_config, + target_cache, + stats, + exports_progress, + subcaller, + setter, + logger, + result_map); if (handled_as_builtin) { return; } @@ -1664,6 +1666,7 @@ auto CreateTargetMap( const gsl::not_null& repo_config, const ActiveTargetCache& target_cache, const gsl::not_null& stats, + const gsl::not_null& exports_progress, std::size_t jobs) -> TargetMap { auto target_reader = [source_target_map, targets_file_map, @@ -1673,11 +1676,12 @@ auto CreateTargetMap( result_map, repo_config, target_cache, - stats](auto ts, - auto setter, - auto logger, - auto subcaller, - auto key) { + stats, + exports_progress](auto ts, + auto setter, + auto logger, + auto subcaller, + auto key) { if (key.target.IsAnonymousTarget()) { withTargetNode(key, repo_config, @@ -1815,6 +1819,7 @@ auto CreateTargetMap( repo_config, target_cache, stats, + exports_progress, source_target_map, rule_map, ts, @@ -1826,6 +1831,7 @@ auto CreateTargetMap( repo_config, target_cache, stats, + exports_progress, *values[0], source_target_map, rule_map, -- cgit v1.2.3