From 1e1feab4007702a201cec57b2257e60bec070a27 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 14 Nov 2024 10:31:12 +0100 Subject: Materialize computed roots before top-level analysis Add a basic implementation of computed roots. So far we neither enforce nor make good use of the fact that the underlying target of a computed root has to be an export target of a content-fixed repository; instead, we always install the root to a temporary directory and pick it up from there. Still, the basic functionality is there, and it is minimally useful. --- src/buildtool/main/main.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/buildtool/main/main.cpp') diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index d14c429c..b1e3dbad 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include #include #include #include @@ -77,6 +79,7 @@ #include "fmt/core.h" #include "src/buildtool/auth/authentication.hpp" #include "src/buildtool/common/remote/retry_config.hpp" +#include "src/buildtool/computed_roots/evaluate.hpp" #include "src/buildtool/execution_api/common/api_bundle.hpp" #include "src/buildtool/execution_api/execution_service/server_implementation.hpp" #include "src/buildtool/execution_api/local/config.hpp" @@ -1003,11 +1006,14 @@ auto main(int argc, char* argv[]) -> int { .remote_context = &remote_context, .statistics = &stats, .progress = &progress}; + const GraphTraverser::CommandLineArguments traverse_args{ + jobs, + std::move(arguments.build), + std::move(stage_args), + std::move(rebuild_args)}; + GraphTraverser const traverser{ - {jobs, - std::move(arguments.build), - std::move(stage_args), - std::move(rebuild_args)}, + traverse_args, &exec_context, ProgressReporter::Reporter(&stats, &progress)}; @@ -1032,7 +1038,18 @@ auto main(int argc, char* argv[]) -> int { auto [main_repo, main_ws_root] = DetermineRoots(&repo_config, arguments.common, arguments.analysis); + std::size_t eval_root_jobs = + std::lround(std::ceil(std::sqrt(arguments.common.jobs))); #ifndef BOOTSTRAP_BUILD_TOOL + if (not EvaluateComputedRoots(&repo_config, + main_repo, + *storage_config, + traverse_args, + &exec_context, + eval_root_jobs)) { + return kExitFailure; + } + std::optional serve = ServeApi::Create( *serve_config, &local_context, &remote_context, &main_apis); #else -- cgit v1.2.3