summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_engine/executor/TARGETS5
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp163
-rw-r--r--src/buildtool/graph_traverser/TARGETS3
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp80
-rw-r--r--src/buildtool/main/TARGETS1
-rw-r--r--src/buildtool/main/main.cpp12
-rw-r--r--src/buildtool/serve_api/serve_service/TARGETS1
-rw-r--r--src/buildtool/serve_api/serve_service/target.cpp12
8 files changed, 119 insertions, 158 deletions
diff --git a/src/buildtool/execution_engine/executor/TARGETS b/src/buildtool/execution_engine/executor/TARGETS
index 3af6b46b..bac83670 100644
--- a/src/buildtool/execution_engine/executor/TARGETS
+++ b/src/buildtool/execution_engine/executor/TARGETS
@@ -3,14 +3,15 @@
, "name": ["executor"]
, "hdrs": ["executor.hpp"]
, "deps":
- [ ["src/buildtool/logging", "log_level"]
+ [ "context"
+ , ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
, ["src/buildtool/common", "common"]
- , ["src/buildtool/common", "config"]
, ["src/buildtool/common", "tree"]
, ["src/buildtool/compatibility", "compatibility"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/execution_engine/dag", "dag"]
+ , ["src/buildtool/execution_api/common", "api_bundle"]
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/common", "common_api"]
, ["src/buildtool/execution_api/remote", "config"]
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index 9b3a5f86..6541fe24 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -29,12 +29,10 @@
#include "gsl/gsl"
#include "src/buildtool/common/artifact_digest.hpp"
-#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/common/tree.hpp"
#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
-#include "src/buildtool/execution_api/common/api_bundle.hpp"
#include "src/buildtool/execution_api/common/artifact_blob_container.hpp"
#include "src/buildtool/execution_api/common/common_api.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
@@ -42,6 +40,7 @@
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/remote/context.hpp"
#include "src/buildtool/execution_engine/dag/dag.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
@@ -173,8 +172,7 @@ class ExecutorImpl {
Logger const& logger,
gsl::not_null<DependencyGraph::ArtifactNode const*> const& artifact,
gsl::not_null<const RepositoryConfig*> const& repo_config,
- ApiBundle const& apis,
- HashFunction hash_function) noexcept -> bool {
+ ApiBundle const& apis) noexcept -> bool {
auto const object_info_opt = artifact->Content().Info();
auto const file_path_opt = artifact->Content().FilePath();
// If there is no object info and no file path, the artifact can not be
@@ -233,8 +231,11 @@ class ExecutorImpl {
return oss.str();
});
auto repo = artifact->Content().Repository();
- auto new_info = UploadFile(
- *apis.remote, hash_function, repo, repo_config, *file_path_opt);
+ auto new_info = UploadFile(*apis.remote,
+ apis.hash_function,
+ repo,
+ repo_config,
+ *file_path_opt);
if (not new_info) {
Logger::Log(LogLevel::Error,
"artifact in {} could not be uploaded to CAS.",
@@ -710,23 +711,17 @@ class Executor {
using CF = IExecutionAction::CacheFlag;
public:
+ /// \brief Create rebuilder for action comparision of two endpoints.
+ /// \param context Execution context. References all the required
+ /// information needed to execute actions on a specified remote endpoint.
+ /// \param logger Overwrite the default logger. Useful for orchestrated
+ /// builds, i.e., triggered by just serve.
+ /// \param timeout Timeout for action execution.
explicit Executor(
- gsl::not_null<const RepositoryConfig*> const& repo_config,
- gsl::not_null<ApiBundle const*> const& apis,
- gsl::not_null<RemoteContext const*> const& remote_context,
- HashFunction hash_function,
- gsl::not_null<Statistics*> const& stats,
- gsl::not_null<Progress*> const& progress,
+ gsl::not_null<ExecutionContext const*> const& context,
Logger const* logger = nullptr, // log in caller logger, if given
std::chrono::milliseconds timeout = IExecutionAction::kDefaultTimeout)
- : repo_config_{repo_config},
- apis_{*apis},
- remote_context_{*remote_context},
- hash_function_{hash_function},
- stats_{stats},
- progress_{progress},
- logger_{logger},
- timeout_{timeout} {}
+ : context_{*context}, logger_{logger}, timeout_{timeout} {}
/// \brief Run an action in a blocking manner
/// This method must be thread-safe as it could be called in parallel
@@ -741,20 +736,22 @@ class Executor {
auto const response = Impl::ExecuteAction(
*logger_,
action,
- *apis_.remote,
+ *context_.apis->remote,
Impl::MergeProperties(
- remote_context_.exec_config->platform_properties,
+ context_.remote_context->exec_config->platform_properties,
action->ExecutionProperties()),
- &remote_context_,
- hash_function_,
+ context_.remote_context,
+ context_.apis->hash_function,
Impl::ScaleTime(timeout_, action->TimeoutScale()),
action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput,
- stats_,
- progress_);
+ context_.statistics,
+ context_.progress);
// check response and save digests of results
- return not response or
- Impl::ParseResponse(
- *logger_, *response, action, stats_, progress_);
+ return not response or Impl::ParseResponse(*logger_,
+ *response,
+ action,
+ context_.statistics,
+ context_.progress);
}
Logger logger("action:" + action->Content().Id());
@@ -762,21 +759,23 @@ class Executor {
auto const response = Impl::ExecuteAction(
logger,
action,
- *apis_.remote,
+ *context_.apis->remote,
Impl::MergeProperties(
- remote_context_.exec_config->platform_properties,
+ context_.remote_context->exec_config->platform_properties,
action->ExecutionProperties()),
- &remote_context_,
- hash_function_,
+ context_.remote_context,
+ context_.apis->hash_function,
Impl::ScaleTime(timeout_, action->TimeoutScale()),
action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput,
- stats_,
- progress_);
+ context_.statistics,
+ context_.progress);
// check response and save digests of results
- return not response or
- Impl::ParseResponse(
- logger, *response, action, stats_, progress_);
+ return not response or Impl::ParseResponse(logger,
+ *response,
+ action,
+ context_.statistics,
+ context_.progress);
}
/// \brief Check artifact is available to the CAS or upload it.
@@ -790,21 +789,16 @@ class Executor {
// non-copyable and non-movable object, we need some code duplication
if (logger_ != nullptr) {
return Impl::VerifyOrUploadArtifact(
- *logger_, artifact, repo_config_, apis_, hash_function_);
+ *logger_, artifact, context_.repo_config, *context_.apis);
}
Logger logger("artifact:" + ToHexString(artifact->Content().Id()));
return Impl::VerifyOrUploadArtifact(
- logger, artifact, repo_config_, apis_, hash_function_);
+ logger, artifact, context_.repo_config, *context_.apis);
}
private:
- gsl::not_null<const RepositoryConfig*> repo_config_;
- ApiBundle const& apis_;
- RemoteContext const& remote_context_;
- HashFunction const hash_function_;
- gsl::not_null<Statistics*> stats_;
- gsl::not_null<Progress*> progress_;
+ ExecutionContext const& context_;
Logger const* logger_;
std::chrono::milliseconds timeout_;
};
@@ -816,28 +810,19 @@ class Rebuilder {
public:
/// \brief Create rebuilder for action comparision of two endpoints.
- /// \param api Rebuild endpoint, executes without action cache.
- /// \param api_cached Reference endpoint, serves everything from cache.
- /// \param properties Platform properties for execution.
- /// \param timeout Timeout for action execution.
- Rebuilder(
- gsl::not_null<const RepositoryConfig*> const& repo_config,
- gsl::not_null<ApiBundle const*> const& apis,
- gsl::not_null<RemoteContext const*> const& remote_context,
- HashFunction hash_function,
- gsl::not_null<Statistics*> const& stats,
- gsl::not_null<Progress*> const& progress,
+ /// \param context Execution context. References all the required
+ /// information needed to perform a rebuild, during which the results of
+ /// executing actions on the regular remote endpoint and the cache endpoint
+ /// are compared.
+ /// \param timeout Timeout for action execution.
+ explicit Rebuilder(
+ gsl::not_null<ExecutionContext const*> const& context,
std::chrono::milliseconds timeout = IExecutionAction::kDefaultTimeout)
- : repo_config_{repo_config},
- apis_{*apis},
- api_cached_{
- apis->MakeRemote(remote_context->exec_config->cache_address,
- remote_context->auth,
- remote_context->retry_config)},
- remote_context_{*remote_context},
- hash_function_{hash_function},
- stats_{stats},
- progress_{progress},
+ : context_{*context},
+ api_cached_{context_.apis->MakeRemote(
+ context_.remote_context->exec_config->cache_address,
+ context_.remote_context->auth,
+ context_.remote_context->retry_config)},
timeout_{timeout} {}
[[nodiscard]] auto Process(
@@ -848,16 +833,16 @@ class Rebuilder {
auto response = Impl::ExecuteAction(
logger,
action,
- *apis_.remote,
+ *context_.apis->remote,
Impl::MergeProperties(
- remote_context_.exec_config->platform_properties,
+ context_.remote_context->exec_config->platform_properties,
action->ExecutionProperties()),
- &remote_context_,
- hash_function_,
+ context_.remote_context,
+ context_.apis->hash_function,
Impl::ScaleTime(timeout_, action->TimeoutScale()),
CF::PretendCached,
- stats_,
- progress_);
+ context_.statistics,
+ context_.progress);
if (not response) {
return true; // action without response (e.g., tree action)
@@ -869,14 +854,14 @@ class Rebuilder {
action,
*api_cached_,
Impl::MergeProperties(
- remote_context_.exec_config->platform_properties,
+ context_.remote_context->exec_config->platform_properties,
action->ExecutionProperties()),
- &remote_context_,
- hash_function_,
+ context_.remote_context,
+ context_.apis->hash_function,
Impl::ScaleTime(timeout_, action->TimeoutScale()),
CF::FromCacheOnly,
- stats_,
- progress_);
+ context_.statistics,
+ context_.progress);
if (not response_cached) {
logger_cached.Emit(LogLevel::Error,
@@ -888,8 +873,8 @@ class Rebuilder {
return Impl::ParseResponse(logger,
*response,
action,
- stats_,
- progress_,
+ context_.statistics,
+ context_.progress,
/*count_as_executed=*/true);
}
@@ -898,7 +883,7 @@ class Rebuilder {
const noexcept -> bool {
Logger logger("artifact:" + ToHexString(artifact->Content().Id()));
return Impl::VerifyOrUploadArtifact(
- logger, artifact, repo_config_, apis_, hash_function_);
+ logger, artifact, context_.repo_config, *context_.apis);
}
[[nodiscard]] auto DumpFlakyActions() const noexcept -> nlohmann::json {
@@ -914,13 +899,8 @@ class Rebuilder {
}
private:
- gsl::not_null<const RepositoryConfig*> repo_config_;
- ApiBundle const& apis_;
+ ExecutionContext const& context_;
gsl::not_null<IExecutionApi::Ptr> const api_cached_;
- RemoteContext const& remote_context_;
- HashFunction const hash_function_;
- gsl::not_null<Statistics*> stats_;
- gsl::not_null<Progress*> progress_;
std::chrono::milliseconds timeout_;
mutable std::mutex m_;
mutable std::vector<std::string> cache_misses_{};
@@ -934,9 +914,10 @@ class Rebuilder {
void DetectFlakyAction(IExecutionResponse::Ptr const& response,
IExecutionResponse::Ptr const& response_cached,
Action const& action) const noexcept {
+ auto& stats = *context_.statistics;
if (response and response_cached and
response_cached->ActionDigest() == response->ActionDigest()) {
- stats_->IncrementRebuiltActionComparedCounter();
+ stats.IncrementRebuiltActionComparedCounter();
auto artifacts = response->Artifacts();
auto artifacts_cached = response_cached->Artifacts();
std::ostringstream msg{};
@@ -947,10 +928,10 @@ class Rebuilder {
}
}
if (msg.tellp() > 0) {
- stats_->IncrementActionsFlakyCounter();
+ stats.IncrementActionsFlakyCounter();
bool tainted = action.MayFail() or action.NoCache();
if (tainted) {
- stats_->IncrementActionsFlakyTaintedCounter();
+ stats.IncrementActionsFlakyTaintedCounter();
}
Logger::Log(tainted ? LogLevel::Debug : LogLevel::Warning,
"{}",
@@ -958,7 +939,7 @@ class Rebuilder {
}
}
else {
- stats_->IncrementRebuiltActionMissingCounter();
+ stats.IncrementRebuiltActionMissingCounter();
std::unique_lock lock{m_};
cache_misses_.emplace_back(action.Id());
}
diff --git a/src/buildtool/graph_traverser/TARGETS b/src/buildtool/graph_traverser/TARGETS
index b216943c..3c64489b 100644
--- a/src/buildtool/graph_traverser/TARGETS
+++ b/src/buildtool/graph_traverser/TARGETS
@@ -5,14 +5,13 @@
, "deps":
[ ["src/buildtool/common", "cli"]
, ["src/buildtool/common", "common"]
- , ["src/buildtool/common", "config"]
, ["src/buildtool/common", "tree"]
, ["src/buildtool/execution_engine/dag", "dag"]
+ , ["src/buildtool/execution_engine/executor", "context"]
, ["src/buildtool/execution_engine/executor", "executor"]
, ["src/buildtool/execution_engine/traverser", "traverser"]
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/common", "common_api"]
- , ["src/buildtool/execution_api/common", "api_bundle"]
, ["src/buildtool/execution_api/remote", "config"]
, ["src/buildtool/execution_api/utils", "subobject"]
, ["src/buildtool/file_system", "file_system_manager"]
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index 50eb95c5..24d3997e 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -33,16 +33,14 @@
#include "gsl/gsl"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/common/cli.hpp"
-#include "src/buildtool/common/repository_config.hpp"
-#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/common/tree.hpp"
-#include "src/buildtool/execution_api/common/api_bundle.hpp"
#include "src/buildtool/execution_api/common/artifact_blob_container.hpp"
#include "src/buildtool/execution_api/common/common_api.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/utils/subobject.hpp"
#include "src/buildtool/execution_engine/dag/dag.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/execution_engine/executor/executor.hpp"
#include "src/buildtool/execution_engine/traverser/traverser.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
@@ -74,19 +72,11 @@ class GraphTraverser {
explicit GraphTraverser(
CommandLineArguments clargs,
- gsl::not_null<const RepositoryConfig*> const& repo_config,
- gsl::not_null<RemoteContext const*> const& remote_context,
- gsl::not_null<Statistics*> const& stats,
- gsl::not_null<Progress*> const& progress,
- gsl::not_null<ApiBundle const*> const& apis,
+ gsl::not_null<const ExecutionContext*> const& context,
progress_reporter_t reporter,
Logger const* logger = nullptr)
: clargs_{std::move(clargs)},
- repo_config_{repo_config},
- remote_context_{*remote_context},
- stats_{stats},
- progress_{progress},
- apis_{*apis},
+ context_{*context},
reporter_{std::move(reporter)},
logger_{logger} {}
@@ -152,8 +142,8 @@ class GraphTraverser {
}
if (clargs_.stage->remember) {
- if (not apis_.remote->ParallelRetrieveToCas(
- *object_infos, *apis_.local, clargs_.jobs, true)) {
+ if (not context_.apis->remote->ParallelRetrieveToCas(
+ *object_infos, *context_.apis->local, clargs_.jobs, true)) {
Logger::Log(logger_,
LogLevel::Warning,
"Failed to copy objects to CAS");
@@ -222,11 +212,7 @@ class GraphTraverser {
private:
CommandLineArguments const clargs_;
- gsl::not_null<const RepositoryConfig*> repo_config_;
- RemoteContext const& remote_context_;
- gsl::not_null<Statistics*> stats_;
- gsl::not_null<Progress*> progress_;
- ApiBundle const& apis_;
+ ExecutionContext const& context_;
progress_reporter_t reporter_;
Logger const* logger_{nullptr};
@@ -289,7 +275,7 @@ class GraphTraverser {
ArtifactBlobContainer container;
for (auto const& blob : blobs) {
auto digest = ArtifactDigest::Create<ObjectType::File>(
- apis_.hash_function, blob);
+ context_.apis->hash_function, blob);
Logger::Log(logger_, LogLevel::Trace, [&]() {
return fmt::format(
"Uploaded blob {}, its digest has id {} and size {}.",
@@ -303,7 +289,8 @@ class GraphTraverser {
&container,
ArtifactBlob{std::move(digest), blob, /*is_exec=*/false},
/*exception_is_fatal=*/true,
- [&api = apis_.remote](ArtifactBlobContainer&& blobs) {
+ [&api =
+ context_.apis->remote](ArtifactBlobContainer&& blobs) {
return api->Upload(std::move(blobs));
},
logger_)) {
@@ -311,7 +298,7 @@ class GraphTraverser {
}
}
// Upload remaining blobs.
- return apis_.remote->Upload(std::move(container));
+ return context_.apis->remote->Upload(std::move(container));
}
/// \brief Adds the artifacts to be retrieved to the graph
@@ -354,14 +341,7 @@ class GraphTraverser {
[[nodiscard]] auto Traverse(
DependencyGraph const& g,
std::vector<ArtifactIdentifier> const& artifact_ids) const -> bool {
- Executor executor{repo_config_,
- &apis_,
- &remote_context_,
- apis_.hash_function,
- stats_,
- progress_,
- logger_,
- clargs_.build.timeout};
+ Executor executor{&context_, logger_, clargs_.build.timeout};
bool traversing{};
std::atomic<bool> done = false;
std::atomic<bool> failed = false;
@@ -382,13 +362,7 @@ class GraphTraverser {
[[nodiscard]] auto TraverseRebuild(
DependencyGraph const& g,
std::vector<ArtifactIdentifier> const& artifact_ids) const -> bool {
- Rebuilder executor{repo_config_,
- &apis_,
- &remote_context_,
- apis_.hash_function,
- stats_,
- progress_,
- clargs_.build.timeout};
+ Rebuilder executor{&context_, clargs_.build.timeout};
bool traversing{false};
std::atomic<bool> done = false;
std::atomic<bool> failed = false;
@@ -436,19 +410,20 @@ class GraphTraverser {
}
void LogStatistics() const noexcept {
+ auto& stats = *context_.statistics;
if (clargs_.rebuild) {
std::stringstream ss{};
- ss << stats_->RebuiltActionComparedCounter()
+ ss << stats.RebuiltActionComparedCounter()
<< " actions compared with cache";
- if (stats_->ActionsFlakyCounter() > 0) {
- ss << ", " << stats_->ActionsFlakyCounter()
+ if (stats.ActionsFlakyCounter() > 0) {
+ ss << ", " << stats.ActionsFlakyCounter()
<< " flaky actions found";
- ss << " (" << stats_->ActionsFlakyTaintedCounter()
+ ss << " (" << stats.ActionsFlakyTaintedCounter()
<< " of which tainted)";
}
- if (stats_->RebuiltActionMissingCounter() > 0) {
+ if (stats.RebuiltActionMissingCounter() > 0) {
ss << ", no cache entry found for "
- << stats_->RebuiltActionMissingCounter() << " actions";
+ << stats.RebuiltActionMissingCounter() << " actions";
}
ss << ".";
Logger::Log(logger_, LogLevel::Info, ss.str());
@@ -457,8 +432,8 @@ class GraphTraverser {
Logger::Log(logger_,
LogLevel::Info,
"Processed {} actions, {} cache hits.",
- stats_->ActionsQueuedCounter(),
- stats_->ActionsCachedCounter());
+ stats.ActionsQueuedCounter(),
+ stats.ActionsCachedCounter());
}
}
@@ -586,8 +561,8 @@ class GraphTraverser {
auto output_paths = PrepareOutputPaths(rel_paths);
if (not output_paths or
- not apis_.remote->RetrieveToPaths(
- object_infos, *output_paths, &*apis_.local)) {
+ not context_.apis->remote->RetrieveToPaths(
+ object_infos, *output_paths, &*context_.apis->local)) {
Logger::Log(
logger_, LogLevel::Error, "Could not retrieve outputs.");
return std::nullopt;
@@ -662,14 +637,14 @@ class GraphTraverser {
std::vector<DependencyGraph::ArtifactNode const*> const& artifacts)
const {
if (clargs_.build.print_to_stdout) {
+ auto const& remote = *context_.apis->remote;
for (std::size_t i = 0; i < paths.size(); i++) {
if (paths[i] == *(clargs_.build.print_to_stdout)) {
auto info = artifacts[i]->Content().Info();
if (info) {
- if (not apis_.remote->RetrieveToFds(
- {*info},
- {dup(fileno(stdout))},
- /*raw_tree=*/false)) {
+ if (not remote.RetrieveToFds({*info},
+ {dup(fileno(stdout))},
+ /*raw_tree=*/false)) {
Logger::Log(logger_,
LogLevel::Error,
"Failed to retrieve {}",
@@ -691,7 +666,6 @@ class GraphTraverser {
auto target_path = ToNormalPath(std::filesystem::path{
*clargs_.build.print_to_stdout})
.relative_path();
- auto const& remote = *apis_.remote;
for (std::size_t i = 0; i < paths.size(); i++) {
auto const& path = paths[i];
auto relpath = target_path.lexically_relative(path);
diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS
index 5e4bf519..b3c89391 100644
--- a/src/buildtool/main/TARGETS
+++ b/src/buildtool/main/TARGETS
@@ -23,6 +23,7 @@
, ["src/utils/cpp", "concepts"]
, ["src/utils/cpp", "json"]
, ["src/buildtool/auth", "auth"]
+ , ["src/buildtool/execution_engine/executor", "context"]
, [ "src/buildtool/execution_api/execution_service"
, "server_implementation"
]
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index e97b5a27..8f66e0d6 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -76,6 +76,7 @@
#include "src/buildtool/execution_api/local/context.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/remote/context.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/graph_traverser/graph_traverser.hpp"
#include "src/buildtool/main/describe.hpp"
#include "src/buildtool/main/retry.hpp"
@@ -992,16 +993,17 @@ auto main(int argc, char* argv[]) -> int {
auto const main_apis =
ApiBundle::Create(&local_context, &remote_context, &repo_config);
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &main_apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
GraphTraverser const traverser{
{jobs,
std::move(arguments.build),
std::move(stage_args),
std::move(rebuild_args)},
- &repo_config,
- &remote_context,
- &stats,
- &progress,
- &main_apis,
+ &exec_context,
ProgressReporter::Reporter(&stats, &progress)};
if (arguments.cmd == SubCommand::kInstallCas) {
diff --git a/src/buildtool/serve_api/serve_service/TARGETS b/src/buildtool/serve_api/serve_service/TARGETS
index 71f4c574..1a080b66 100644
--- a/src/buildtool/serve_api/serve_service/TARGETS
+++ b/src/buildtool/serve_api/serve_service/TARGETS
@@ -108,6 +108,7 @@
, ["src/buildtool/build_engine/target_map", "result_map"]
, ["src/buildtool/common/remote", "remote_common"]
, ["src/buildtool/common/remote", "retry_config"]
+ , ["src/buildtool/execution_engine/executor", "context"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/graph_traverser", "graph_traverser"]
, ["src/buildtool/logging", "log_level"]
diff --git a/src/buildtool/serve_api/serve_service/target.cpp b/src/buildtool/serve_api/serve_service/target.cpp
index 9ad1520b..a0289cc0 100644
--- a/src/buildtool/serve_api/serve_service/target.cpp
+++ b/src/buildtool/serve_api/serve_service/target.cpp
@@ -28,6 +28,7 @@
#include "src/buildtool/common/remote/retry_config.hpp"
#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/common/statistics.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/graph_traverser/graph_traverser.hpp"
@@ -503,14 +504,15 @@ auto TargetService::ServeTarget(
// dispatch endpoint for traversing
auto const local_apis = ApiBundle::Create(
&local_context_, &dispatch_context, &repository_config);
+ ExecutionContext const exec_context{.repo_config = &repository_config,
+ .apis = &local_apis,
+ .remote_context = &dispatch_context,
+ .statistics = &stats,
+ .progress = &progress};
GraphTraverser const traverser{
std::move(traverser_args),
- &repository_config,
- &dispatch_context,
- &stats,
- &progress,
- &local_apis,
+ &exec_context,
ProgressReporter::Reporter(&stats, &progress, &logger),
&logger};