summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/buildtool/execution_api/common/TARGETS1
-rw-r--r--src/buildtool/execution_api/common/api_bundle.cpp29
-rw-r--r--src/buildtool/execution_api/common/api_bundle.hpp20
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp4
-rw-r--r--src/buildtool/main/main.cpp34
-rw-r--r--src/buildtool/serve_api/serve_service/TARGETS1
-rw-r--r--src/buildtool/serve_api/serve_service/target.cpp19
-rw-r--r--src/other_tools/just_mr/TARGETS2
-rw-r--r--src/other_tools/just_mr/fetch.cpp42
-rw-r--r--src/other_tools/just_mr/setup.cpp42
-rw-r--r--test/buildtool/build_engine/target_map/TARGETS1
-rw-r--r--test/buildtool/build_engine/target_map/target_map.test.cpp175
-rw-r--r--test/buildtool/graph_traverser/TARGETS1
-rw-r--r--test/buildtool/graph_traverser/graph_traverser.test.hpp155
14 files changed, 350 insertions, 176 deletions
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS
index f5164662..88eddf05 100644
--- a/src/buildtool/execution_api/common/TARGETS
+++ b/src/buildtool/execution_api/common/TARGETS
@@ -48,6 +48,7 @@
, ["src/buildtool/common/remote", "retry_config"]
, ["src/buildtool/execution_api/local", "context"]
, ["src/buildtool/execution_api/remote", "config"]
+ , ["src/buildtool/execution_api/remote", "context"]
, ["src/buildtool/crypto", "hash_function"]
]
, "private-deps":
diff --git a/src/buildtool/execution_api/common/api_bundle.cpp b/src/buildtool/execution_api/common/api_bundle.cpp
index edb29970..f587a91b 100644
--- a/src/buildtool/execution_api/common/api_bundle.cpp
+++ b/src/buildtool/execution_api/common/api_bundle.cpp
@@ -14,25 +14,26 @@
#include "src/buildtool/execution_api/common/api_bundle.hpp"
-#include "src/buildtool/common/remote/retry_config.hpp"
#include "src/buildtool/execution_api/bazel_msg/bazel_common.hpp"
#include "src/buildtool/execution_api/local/local_api.hpp"
#include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp"
-ApiBundle::ApiBundle(
- gsl::not_null<LocalContext const*> const& local_context,
- RepositoryConfig const* repo_config,
- gsl::not_null<Auth const*> const& authentication,
- gsl::not_null<RetryConfig const*> const& retry_config,
- gsl::not_null<RemoteExecutionConfig const*> const& remote_exec_config)
- : auth{*authentication},
- retry_config{*retry_config},
- remote_config{*remote_exec_config},
+ApiBundle::ApiBundle(gsl::not_null<LocalContext const*> const& local_context,
+ gsl::not_null<RemoteContext const*> const& remote_context,
+ RepositoryConfig const* repo_config)
+ : auth{*remote_context->auth},
+ retry_config{*remote_context->retry_config},
+ remote_config{*remote_context->exec_config},
hash_function{local_context->storage_config->hash_function},
local{std::make_shared<LocalApi>(local_context, repo_config)},
- remote{CreateRemote(remote_exec_config->remote_address)} {}
+ remote{CreateRemote(remote_context->exec_config->remote_address,
+ remote_context->auth,
+ remote_context->retry_config)} {}
-auto ApiBundle::CreateRemote(std::optional<ServerAddress> const& address) const
+auto ApiBundle::CreateRemote(
+ std::optional<ServerAddress> const& address,
+ gsl::not_null<Auth const*> const& authentication,
+ gsl::not_null<RetryConfig const*> const& retry_config) const
-> gsl::not_null<IExecutionApi::Ptr> {
if (address) {
ExecutionConfiguration config;
@@ -40,8 +41,8 @@ auto ApiBundle::CreateRemote(std::optional<ServerAddress> const& address) const
return std::make_shared<BazelApi>("remote-execution",
address->host,
address->port,
- &auth,
- &retry_config,
+ authentication,
+ retry_config,
config,
hash_function);
}
diff --git a/src/buildtool/execution_api/common/api_bundle.hpp b/src/buildtool/execution_api/common/api_bundle.hpp
index d6cf4423..7d524b2e 100644
--- a/src/buildtool/execution_api/common/api_bundle.hpp
+++ b/src/buildtool/execution_api/common/api_bundle.hpp
@@ -27,6 +27,7 @@
#include "src/buildtool/execution_api/common/execution_api.hpp"
#include "src/buildtool/execution_api/local/context.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
+#include "src/buildtool/execution_api/remote/context.hpp"
/// \brief Utility structure for instantiation of local and remote apis at the
/// same time. If the remote api cannot be instantiated, it falls back to
@@ -34,13 +35,20 @@
struct ApiBundle final {
explicit ApiBundle(
gsl::not_null<LocalContext const*> const& local_context,
- RepositoryConfig const* repo_config,
- gsl::not_null<Auth const*> const& authentication,
- gsl::not_null<RetryConfig const*> const& retry_config,
- gsl::not_null<RemoteExecutionConfig const*> const& remote_exec_config);
+ gsl::not_null<RemoteContext const*> const& remote_context,
+ RepositoryConfig const* repo_config);
- [[nodiscard]] auto CreateRemote(std::optional<ServerAddress> const& address)
- const -> gsl::not_null<IExecutionApi::Ptr>;
+ /// \brief Create a Remote object based on the given arguments.
+ /// \param address The endpoint address.
+ /// \param authentication The remote authentication configuration.
+ /// \param retry_config The retry strategy configuration.
+ /// \returns A configured api: BazelApi if a remote address is given,
+ /// otherwise fall back to the already configured LocalApi instance.
+ [[nodiscard]] auto CreateRemote(
+ std::optional<ServerAddress> const& address,
+ gsl::not_null<Auth const*> const& authentication,
+ gsl::not_null<RetryConfig const*> const& retry_config) const
+ -> gsl::not_null<IExecutionApi::Ptr>;
// Needed to be set before creating the remote (via CreateRemote)
Auth const& auth;
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index b10427cd..fce9b7d4 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -391,7 +391,9 @@ class GraphTraverser {
DependencyGraph const& g,
std::vector<ArtifactIdentifier> const& artifact_ids) const -> bool {
// setup rebuilder with api for cache endpoint
- auto api_cached = apis_.CreateRemote(apis_.remote_config.cache_address);
+ auto api_cached = apis_.CreateRemote(apis_.remote_config.cache_address,
+ &apis_.auth,
+ &apis_.retry_config);
Rebuilder executor{repo_config_,
&*apis_.local,
&*apis_.remote,
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 1676cbb4..10fde879 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -75,6 +75,7 @@
#include "src/buildtool/execution_api/local/config.hpp"
#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/graph_traverser/graph_traverser.hpp"
#include "src/buildtool/main/describe.hpp"
#include "src/buildtool/main/retry.hpp"
@@ -815,12 +816,15 @@ auto main(int argc, char* argv[]) -> int {
.exec_config = &*local_exec_config,
.storage_config = &*storage_config,
.storage = &storage};
+ // pack the remote context instances to be passed as needed
+ RemoteContext const remote_context{
+ .auth = &*auth_config,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
ApiBundle const exec_apis{&local_context,
- /*repo_config=*/nullptr,
- &*auth_config,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
return execution_server->Run(&local_context,
exec_apis,
@@ -877,12 +881,15 @@ auto main(int argc, char* argv[]) -> int {
.exec_config = &*local_exec_config,
.storage_config = &*storage_config,
.storage = &storage};
+ // pack the remote context instances to be passed as needed
+ RemoteContext const remote_context{
+ .auth = &*auth_config,
+ .retry_config = &*retry_config,
+ .exec_config = &*remote_exec_config};
ApiBundle const serve_apis{&local_context,
- /*repo_config=*/nullptr,
- &*auth_config,
- &*retry_config,
- &*remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
auto serve =
ServeApi::Create(*serve_config, &storage, &serve_apis);
@@ -972,12 +979,13 @@ auto main(int argc, char* argv[]) -> int {
LocalContext const local_context{.exec_config = &*local_exec_config,
.storage_config = &*storage_config,
.storage = &storage};
+ // pack the remote context instances to be passed as needed
+ RemoteContext const remote_context{.auth = &*auth_config,
+ .retry_config = &*retry_config,
+ .exec_config = &*remote_exec_config};
- ApiBundle const main_apis{&local_context,
- &repo_config,
- &*auth_config,
- &*retry_config,
- &*remote_exec_config};
+ ApiBundle const main_apis{
+ &local_context, &remote_context, &repo_config};
GraphTraverser const traverser{
{jobs,
std::move(arguments.build),
diff --git a/src/buildtool/serve_api/serve_service/TARGETS b/src/buildtool/serve_api/serve_service/TARGETS
index 4374dafd..44ee4427 100644
--- a/src/buildtool/serve_api/serve_service/TARGETS
+++ b/src/buildtool/serve_api/serve_service/TARGETS
@@ -106,6 +106,7 @@
, ["src/buildtool/build_engine/target_map", "result_map"]
, ["src/buildtool/common/remote", "remote_common"]
, ["src/buildtool/common/remote", "retry_config"]
+ , ["src/buildtool/execution_api/remote", "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 001b9387..16cc37a4 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_api/remote/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"
@@ -493,13 +494,17 @@ auto TargetService::ServeTarget(
traverser_args.stage = std::nullopt;
traverser_args.rebuild = std::nullopt;
- // Use a new ApiBundle that knows about local repository config for
- // traversing.
- ApiBundle const local_apis{&local_context_,
- &repository_config,
- &apis_.auth,
- &apis_.retry_config,
- &(*remote_config)};
+ // pack the remote context instances to be passed as needed
+ RemoteContext const dispatch_context{
+ .auth = &apis_.auth,
+ .retry_config = &apis_.retry_config,
+ .exec_config = &(*remote_config)};
+
+ // Use a new ApiBundle that knows about local repository config and
+ // dispatch endpoint for traversing
+ ApiBundle const local_apis{
+ &local_context_, &dispatch_context, &repository_config};
+
GraphTraverser const traverser{
std::move(traverser_args),
&repository_config,
diff --git a/src/other_tools/just_mr/TARGETS b/src/other_tools/just_mr/TARGETS
index 619a664c..15478898 100644
--- a/src/other_tools/just_mr/TARGETS
+++ b/src/other_tools/just_mr/TARGETS
@@ -139,6 +139,7 @@
, ["src/buildtool/execution_api/local", "config"]
, ["src/buildtool/execution_api/local", "context"]
, ["src/buildtool/execution_api/remote", "config"]
+ , ["src/buildtool/execution_api/remote", "context"]
, ["src/buildtool/serve_api/remote", "config"]
, ["src/buildtool/serve_api/remote", "serve_api"]
]
@@ -211,6 +212,7 @@
, ["src/buildtool/execution_api/local", "config"]
, ["src/buildtool/execution_api/local", "context"]
, ["src/buildtool/execution_api/remote", "config"]
+ , ["src/buildtool/execution_api/remote", "context"]
, ["src/buildtool/serve_api/remote", "config"]
, ["src/buildtool/serve_api/remote", "serve_api"]
]
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp
index e7d1f775..8da3647b 100644
--- a/src/other_tools/just_mr/fetch.cpp
+++ b/src/other_tools/just_mr/fetch.cpp
@@ -27,6 +27,7 @@
#include "src/buildtool/execution_api/local/config.hpp"
#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/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
#include "src/buildtool/main/retry.hpp"
@@ -402,43 +403,46 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config,
Logger::Log(LogLevel::Info, "Found {} to fetch", fetchables);
}
- // setup remote execution config
- auto remote_exec_config = JustMR::Utils::CreateRemoteExecutionConfig(
- common_args.remote_execution_address, common_args.remote_serve_address);
- if (not remote_exec_config) {
+ // setup local execution config
+ auto local_exec_config =
+ JustMR::Utils::CreateLocalExecutionConfig(common_args);
+ if (not local_exec_config) {
return kExitConfigError;
}
+ // pack the local context instances to be passed to ApiBundle
+ LocalContext const local_context{.exec_config = &*local_exec_config,
+ .storage_config = &storage_config,
+ .storage = &storage};
+
// setup authentication config
auto auth_config = JustMR::Utils::CreateAuthConfig(auth_args);
if (not auth_config) {
return kExitConfigError;
}
- // setup local execution config
- auto local_exec_config =
- JustMR::Utils::CreateLocalExecutionConfig(common_args);
- if (not local_exec_config) {
- return kExitConfigError;
- }
-
// setup the retry config
auto retry_config = CreateRetryConfig(retry_args);
if (not retry_config) {
return kExitConfigError;
}
- // pack the local context instances to be passed to ApiBundle
- LocalContext const local_context{.exec_config = &*local_exec_config,
- .storage_config = &storage_config,
- .storage = &storage};
+ // setup remote execution config
+ auto remote_exec_config = JustMR::Utils::CreateRemoteExecutionConfig(
+ common_args.remote_execution_address, common_args.remote_serve_address);
+ if (not remote_exec_config) {
+ return kExitConfigError;
+ }
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &*auth_config,
+ .retry_config = &*retry_config,
+ .exec_config = &*remote_exec_config};
// setup the APIs for archive fetches; only happens if in native mode
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &*auth_config,
- &*retry_config,
- &*remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
bool const has_remote_api =
apis.local != apis.remote and not common_args.compatible;
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index 40607b00..88bd0ca5 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -29,6 +29,7 @@
#include "src/buildtool/execution_api/local/config.hpp"
#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/file_system/symlinks_map/resolve_symlinks_map.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
@@ -124,42 +125,45 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
"Found {} repositories to set up",
setup_repos->to_setup.size());
- // setup remote execution config
- auto remote_exec_config = JustMR::Utils::CreateRemoteExecutionConfig(
- common_args.remote_execution_address, common_args.remote_serve_address);
- if (not remote_exec_config) {
+ // setup local execution config
+ auto local_exec_config =
+ JustMR::Utils::CreateLocalExecutionConfig(common_args);
+ if (not local_exec_config) {
return std::nullopt;
}
+ // pack the local context instances to be passed to ApiBundle
+ LocalContext const local_context{.exec_config = &*local_exec_config,
+ .storage_config = &storage_config,
+ .storage = &storage};
+
// setup authentication config
auto auth_config = JustMR::Utils::CreateAuthConfig(auth_args);
if (not auth_config) {
return std::nullopt;
}
- // setup local execution config
- auto local_exec_config =
- JustMR::Utils::CreateLocalExecutionConfig(common_args);
- if (not local_exec_config) {
- return std::nullopt;
- }
-
// setup the retry config
auto retry_config = CreateRetryConfig(retry_args);
if (not retry_config) {
return std::nullopt;
}
- // pack the local context instances to be passed to ApiBundle
- LocalContext const local_context{.exec_config = &*local_exec_config,
- .storage_config = &storage_config,
- .storage = &storage};
+ // setup remote execution config
+ auto remote_exec_config = JustMR::Utils::CreateRemoteExecutionConfig(
+ common_args.remote_execution_address, common_args.remote_serve_address);
+ if (not remote_exec_config) {
+ return std::nullopt;
+ }
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &*auth_config,
+ .retry_config = &*retry_config,
+ .exec_config = &*remote_exec_config};
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &*auth_config,
- &*retry_config,
- &*remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
bool const has_remote_api =
apis.local != apis.remote and not common_args.compatible;
diff --git a/test/buildtool/build_engine/target_map/TARGETS b/test/buildtool/build_engine/target_map/TARGETS
index af1a400e..f87cc475 100644
--- a/test/buildtool/build_engine/target_map/TARGETS
+++ b/test/buildtool/build_engine/target_map/TARGETS
@@ -35,6 +35,7 @@
, ["@", "src", "src/buildtool/execution_api/local", "config"]
, ["@", "src", "src/buildtool/execution_api/local", "context"]
, ["@", "src", "src/buildtool/execution_api/remote", "config"]
+ , ["@", "src", "src/buildtool/execution_api/remote", "context"]
, ["@", "src", "src/buildtool/file_system", "file_root"]
, ["@", "src", "src/buildtool/progress_reporting", "progress"]
, ["@", "src", "src/buildtool/storage", "config"]
diff --git a/test/buildtool/build_engine/target_map/target_map.test.cpp b/test/buildtool/build_engine/target_map/target_map.test.cpp
index 4524d1b0..a305a8e8 100644
--- a/test/buildtool/build_engine/target_map/target_map.test.cpp
+++ b/test/buildtool/build_engine/target_map/target_map.test.cpp
@@ -34,6 +34,7 @@
#include "src/buildtool/execution_api/local/config.hpp"
#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/file_system/file_root.hpp"
#include "src/buildtool/main/analyse_context.hpp"
#include "src/buildtool/multithreading/async_map_consumer.hpp"
@@ -110,18 +111,24 @@ TEST_CASE("simple targets", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_config{};
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config.Get(),
.storage = &storage};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
@@ -566,19 +573,27 @@ TEST_CASE("configuration deduplication", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_config{};
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config.Get(),
.storage = &storage};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -667,19 +682,27 @@ TEST_CASE("generator functions in string arguments", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_config{};
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config.Get(),
.storage = &storage};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -780,19 +803,27 @@ TEST_CASE("built-in rules", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_config{};
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config.Get(),
.storage = &storage};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -1005,19 +1036,27 @@ TEST_CASE("target reference", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_config{};
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config.Get(),
.storage = &storage};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -1161,19 +1200,27 @@ TEST_CASE("trees", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_config{};
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config.Get(),
.storage = &storage};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -1281,19 +1328,27 @@ TEST_CASE("RESULT error reporting", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_config{};
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config.Get(),
.storage = &storage};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
@@ -1460,19 +1515,27 @@ TEST_CASE("wrong arguments", "[target_map]") {
REQUIRE(serve_config);
LocalExecutionConfig local_exec_config{};
- RemoteExecutionConfig remote_exec_config{};
- Auth auth{};
- RetryConfig retry_config{};
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config.Get(),
.storage = &storage};
+
+ Auth auth{};
+ RetryConfig retry_config{};
+ RemoteExecutionConfig remote_exec_config{};
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = &auth,
+ .retry_config = &retry_config,
+ .exec_config = &remote_exec_config};
+
ApiBundle const apis{&local_context,
- /*repo_config=*/nullptr,
- &auth,
- &retry_config,
- &remote_exec_config};
+ &remote_context,
+ /*repo_config=*/nullptr};
+
auto serve = ServeApi::Create(*serve_config, &storage, &apis);
+
AnalyseContext ctx{.repo_config = &repo_config,
.storage = &storage,
.statistics = &stats,
diff --git a/test/buildtool/graph_traverser/TARGETS b/test/buildtool/graph_traverser/TARGETS
index 189ad233..1035fbcd 100644
--- a/test/buildtool/graph_traverser/TARGETS
+++ b/test/buildtool/graph_traverser/TARGETS
@@ -11,6 +11,7 @@
, ["@", "src", "src/buildtool/execution_api/local", "config"]
, ["@", "src", "src/buildtool/execution_api/local", "context"]
, ["@", "src", "src/buildtool/execution_api/remote", "config"]
+ , ["@", "src", "src/buildtool/execution_api/remote", "context"]
, ["@", "src", "src/buildtool/file_system", "file_system_manager"]
, ["@", "src", "src/buildtool/file_system", "jsonfs"]
, ["@", "src", "src/buildtool/graph_traverser", "graph_traverser"]
diff --git a/test/buildtool/graph_traverser/graph_traverser.test.hpp b/test/buildtool/graph_traverser/graph_traverser.test.hpp
index c28f3a6c..0f3de2e6 100644
--- a/test/buildtool/graph_traverser/graph_traverser.test.hpp
+++ b/test/buildtool/graph_traverser/graph_traverser.test.hpp
@@ -35,6 +35,7 @@
#include "src/buildtool/execution_api/local/config.hpp"
#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/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/jsonfs.hpp"
#include "src/buildtool/graph_traverser/graph_traverser.hpp"
@@ -169,15 +170,24 @@ class TestProject {
auto const local_exec_config = CreateLocalExecConfig();
auto const clargs = p.CmdLineArgs();
+
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{
- &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+
GraphTraverser const gt{clargs.gtargs,
p.GetRepoConfig(),
remote_config->platform_properties,
@@ -204,12 +214,6 @@ class TestProject {
SECTION("Executable is retrieved as executable") {
auto const clargs_exec = p.CmdLineArgs("_entry_points_get_executable");
- RetryConfig retry_config{}; // default retry config
- ApiBundle const apis{&local_context,
- p.GetRepoConfig(),
- auth,
- &retry_config,
- remote_config};
GraphTraverser const gt_get_exec{clargs_exec.gtargs,
p.GetRepoConfig(),
remote_config->platform_properties,
@@ -246,15 +250,24 @@ class TestProject {
auto const local_exec_config = CreateLocalExecConfig();
auto const clargs = p.CmdLineArgs();
+
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{
- &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+
GraphTraverser const gt{clargs.gtargs,
p.GetRepoConfig(),
remote_config->platform_properties,
@@ -286,15 +299,24 @@ class TestProject {
auto const local_exec_config = CreateLocalExecConfig();
auto const clargs = p.CmdLineArgs();
+
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{
- &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+
GraphTraverser const gt{clargs.gtargs,
p.GetRepoConfig(),
remote_config->platform_properties,
@@ -346,18 +368,25 @@ class TestProject {
auto const local_exec_config = CreateLocalExecConfig();
auto const clargs_update_cpp =
full_hello_world.CmdLineArgs("_entry_points_upload_source");
+
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{&local_context,
- full_hello_world.GetRepoConfig(),
- auth,
- &retry_config,
- remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{
+ &local_context, &remote_context, full_hello_world.GetRepoConfig()};
+
GraphTraverser const gt_upload{clargs_update_cpp.gtargs,
full_hello_world.GetRepoConfig(),
remote_config->platform_properties,
@@ -414,16 +443,25 @@ static void TestBlobsUploadedAndUsed(
TestProject p("use_uploaded_blobs");
auto const clargs = p.CmdLineArgs();
- auto const local_exec_config = CreateLocalExecConfig();
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
+ auto const local_exec_config = CreateLocalExecConfig();
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{
- &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+
GraphTraverser gt{clargs.gtargs,
p.GetRepoConfig(),
remote_config->platform_properties,
@@ -462,16 +500,25 @@ static void TestEnvironmentVariablesSetAndUsed(
TestProject p("use_env_variables");
auto const clargs = p.CmdLineArgs();
- auto const local_exec_config = CreateLocalExecConfig();
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
+ auto const local_exec_config = CreateLocalExecConfig();
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{
- &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+
GraphTraverser gt{clargs.gtargs,
p.GetRepoConfig(),
remote_config->platform_properties,
@@ -510,16 +557,25 @@ static void TestTreesUsed(
TestProject p("use_trees");
auto const clargs = p.CmdLineArgs();
- auto const local_exec_config = CreateLocalExecConfig();
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
+ auto const local_exec_config = CreateLocalExecConfig();
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{
- &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+
GraphTraverser gt{clargs.gtargs,
p.GetRepoConfig(),
remote_config->platform_properties,
@@ -558,16 +614,25 @@ static void TestNestedTreesUsed(
TestProject p("use_nested_trees");
auto const clargs = p.CmdLineArgs();
- auto const local_exec_config = CreateLocalExecConfig();
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
+ auto const local_exec_config = CreateLocalExecConfig();
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{
- &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
+
GraphTraverser gt{clargs.gtargs,
p.GetRepoConfig(),
remote_config->platform_properties,
@@ -605,16 +670,24 @@ static void TestFlakyHelloWorldDetected(
bool /*is_hermetic*/ = true) {
TestProject p("flaky_hello_world");
- auto const local_exec_config = CreateLocalExecConfig();
Statistics stats{};
Progress progress{};
- RetryConfig retry_config{}; // default retry config
+
+ auto const local_exec_config = CreateLocalExecConfig();
+
// pack the local context instances to be passed to ApiBundle
LocalContext const local_context{.exec_config = &local_exec_config,
.storage_config = &storage_config,
.storage = &storage};
- ApiBundle const apis{
- &local_context, p.GetRepoConfig(), auth, &retry_config, remote_config};
+
+ RetryConfig retry_config{}; // default retry config
+
+ // pack the remote context instances to be passed to ApiBundle
+ RemoteContext const remote_context{.auth = auth,
+ .retry_config = &retry_config,
+ .exec_config = remote_config};
+
+ ApiBundle const apis{&local_context, &remote_context, p.GetRepoConfig()};
{
auto clargs = p.CmdLineArgs("_entry_points_ctimes");