From 60a056f0b01515ad70ff99d08dd3d2b7475c6c37 Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Tue, 11 Jun 2024 13:19:38 +0200 Subject: Pass ServeApi as a field of context to the analysis ...instead of using singleton calls. --- src/buildtool/main/main.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/buildtool/main/main.cpp') diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 92f64891..7ae42622 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -56,6 +56,7 @@ #include "src/buildtool/multithreading/async_map_consumer.hpp" #include "src/buildtool/multithreading/task_system.hpp" #include "src/buildtool/progress_reporting/progress.hpp" +#include "src/buildtool/serve_api/remote/serve_api.hpp" #include "src/buildtool/storage/config.hpp" #include "src/buildtool/storage/file_chunker.hpp" #include "src/buildtool/storage/garbage_collector.hpp" @@ -947,6 +948,15 @@ auto main(int argc, char* argv[]) -> int { auto [main_repo, main_ws_root] = DetermineRoots(&repo_config, arguments.common, arguments.analysis); +#ifndef BOOTSTRAP_BUILD_TOOL + std::optional> serve; + if (RemoteServeConfig::Instance().RemoteAddress()) { + serve = &ServeApi::Instance(); + } +#else + std::optional> serve; +#endif // BOOTSTRAP_BUILD_TOOL + #ifndef BOOTSTRAP_BUILD_TOOL auto lock = GarbageCollector::SharedLock(); if (not lock) { @@ -1019,7 +1029,9 @@ auto main(int argc, char* argv[]) -> int { .repo_config = &repo_config, .target_cache = Storage::Instance().TargetCache(), .statistics = &stats, - .progress = &exports_progress}; + .progress = &exports_progress, + .serve = serve}; + auto result = AnalyseTarget(&analyse_ctx, id, &result_map, -- cgit v1.2.3