diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-12-10 11:39:01 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-12-10 16:25:00 +0100 |
commit | fe6939e9ef24ab52eb57c745eb106204c1acc576 (patch) | |
tree | 4649433005c1355c81ad83889ae244bad698f81c /src | |
parent | d2c178ddb14fb0ba0a9518e39fafbdcad19715ed (diff) | |
download | justbuild-fe6939e9ef24ab52eb57c745eb106204c1acc576.tar.gz |
Computed Roots: be aware of the serve end point
... as the base repository of a computed root might be absent.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/computed_roots/TARGETS | 1 | ||||
-rw-r--r-- | src/buildtool/computed_roots/evaluate.cpp | 10 | ||||
-rw-r--r-- | src/buildtool/computed_roots/evaluate.hpp | 2 | ||||
-rw-r--r-- | src/buildtool/main/main.cpp | 6 |
4 files changed, 15 insertions, 4 deletions
diff --git a/src/buildtool/computed_roots/TARGETS b/src/buildtool/computed_roots/TARGETS index 768bf15b..876aee03 100644 --- a/src/buildtool/computed_roots/TARGETS +++ b/src/buildtool/computed_roots/TARGETS @@ -57,6 +57,7 @@ , ["src/buildtool/common", "config"] , ["src/buildtool/execution_engine/executor", "context"] , ["src/buildtool/graph_traverser", "graph_traverser"] + , ["src/buildtool/serve_api/remote", "serve_api"] , ["src/buildtool/storage", "config"] ] , "private-deps": diff --git a/src/buildtool/computed_roots/evaluate.cpp b/src/buildtool/computed_roots/evaluate.cpp index 4325fb48..6bb40ee8 100644 --- a/src/buildtool/computed_roots/evaluate.cpp +++ b/src/buildtool/computed_roots/evaluate.cpp @@ -266,6 +266,7 @@ void ComputeAndFill( gsl::not_null<RepositoryConfig*> const& repository_config, gsl::not_null<const GraphTraverser::CommandLineArguments*> const& traverser_args, + ServeApi const* serve, gsl::not_null<const ExecutionContext*> const& context, gsl::not_null<const StorageConfig*> const& storage_config, gsl::not_null<std::optional<RehashUtils::Rehasher>*> const& rehash, @@ -292,7 +293,8 @@ void ComputeAndFill( AnalyseContext analyse_context{.repo_config = repository_config, .storage = &storage, .statistics = &statistics, - .progress = &progress}; + .progress = &progress, + .serve = serve}; Logger build_logger = Logger( target.ToString(), std::vector<LogSinkFactory>{LogSinkFile::CreateFactory(log_file)}); @@ -411,6 +413,7 @@ auto FillRoots( gsl::not_null<const GraphTraverser::CommandLineArguments*> const& traverser_args, gsl::not_null<const ExecutionContext*> const& context, + ServeApi const* serve, gsl::not_null<const StorageConfig*> const& storage_config, gsl::not_null<std::optional<RehashUtils::Rehasher>*> const& rehash, gsl::not_null<std::shared_mutex*> const& config_lock, @@ -419,6 +422,7 @@ auto FillRoots( rehash, repository_config, traverser_args, + serve, context, config_lock, git_lock, @@ -440,6 +444,7 @@ auto FillRoots( repository_config, traverser_args, context, + serve, storage_config, config_lock, rehash, @@ -450,6 +455,7 @@ auto FillRoots( ComputeAndFill(key, repository_config, traverser_args, + serve, context, storage_config, rehash, @@ -469,6 +475,7 @@ auto FillRoots( auto EvaluateComputedRoots( gsl::not_null<RepositoryConfig*> const& repository_config, std::string const& main_repo, + ServeApi const* serve, StorageConfig const& storage_config, std::optional<StorageConfig> const& git_storage_config, GraphTraverser::CommandLineArguments const& traverser_args, @@ -516,6 +523,7 @@ auto EvaluateComputedRoots( repository_config, &traverser_args, context, + serve, &storage_config, &rehash, &repo_config_access, diff --git a/src/buildtool/computed_roots/evaluate.hpp b/src/buildtool/computed_roots/evaluate.hpp index 873e2904..8f726fcd 100644 --- a/src/buildtool/computed_roots/evaluate.hpp +++ b/src/buildtool/computed_roots/evaluate.hpp @@ -23,11 +23,13 @@ #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/execution_engine/executor/context.hpp" #include "src/buildtool/graph_traverser/graph_traverser.hpp" +#include "src/buildtool/serve_api/remote/serve_api.hpp" #include "src/buildtool/storage/config.hpp" auto EvaluateComputedRoots( gsl::not_null<RepositoryConfig*> const& repository_config, std::string const& main_repo, + ServeApi const* serve, StorageConfig const& storage_config, std::optional<StorageConfig> const& git_storage_config, GraphTraverser::CommandLineArguments const& traverser_args, diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 629d2d78..9a05769a 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -1048,8 +1048,11 @@ auto main(int argc, char* argv[]) -> int { if (need_rehash and (not git_storage_config)) { return kExitFailure; } + std::optional<ServeApi> serve = ServeApi::Create( + *serve_config, &local_context, &remote_context, &main_apis); if (not EvaluateComputedRoots(&repo_config, main_repo, + serve ? &*serve : nullptr, *storage_config, git_storage_config, traverse_args, @@ -1057,9 +1060,6 @@ auto main(int argc, char* argv[]) -> int { eval_root_jobs)) { return kExitFailure; } - - std::optional<ServeApi> serve = ServeApi::Create( - *serve_config, &local_context, &remote_context, &main_apis); #else std::optional<ServeApi> serve; #endif // BOOTSTRAP_BUILD_TOOL |