summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/execution_api/common/TARGETS4
-rw-r--r--src/buildtool/execution_api/common/api_bundle.cpp12
-rw-r--r--src/buildtool/execution_api/common/api_bundle.hpp8
-rw-r--r--src/buildtool/main/TARGETS1
-rw-r--r--src/buildtool/main/main.cpp35
-rw-r--r--src/buildtool/serve_api/serve_service/TARGETS1
-rw-r--r--src/buildtool/serve_api/serve_service/target.cpp8
-rw-r--r--src/other_tools/just_mr/TARGETS2
-rw-r--r--src/other_tools/just_mr/fetch.cpp10
-rw-r--r--src/other_tools/just_mr/setup.cpp10
10 files changed, 54 insertions, 37 deletions
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS
index c2599e3e..f5164662 100644
--- a/src/buildtool/execution_api/common/TARGETS
+++ b/src/buildtool/execution_api/common/TARGETS
@@ -46,10 +46,8 @@
, ["src/buildtool/common", "config"]
, ["src/buildtool/common/remote", "remote_common"]
, ["src/buildtool/common/remote", "retry_config"]
- , ["src/buildtool/execution_api/local", "config"]
+ , ["src/buildtool/execution_api/local", "context"]
, ["src/buildtool/execution_api/remote", "config"]
- , ["src/buildtool/storage", "config"]
- , ["src/buildtool/storage", "storage"]
, ["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 6dea80ce..96b24376 100644
--- a/src/buildtool/execution_api/common/api_bundle.cpp
+++ b/src/buildtool/execution_api/common/api_bundle.cpp
@@ -20,9 +20,7 @@
#include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp"
ApiBundle::ApiBundle(
- gsl::not_null<StorageConfig const*> const& storage_config,
- gsl::not_null<Storage const*> const& storage,
- gsl::not_null<LocalExecutionConfig const*> const& local_exec_config,
+ 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,
@@ -30,10 +28,10 @@ ApiBundle::ApiBundle(
: auth{*authentication},
retry_config{*retry_config},
remote_config{*remote_exec_config},
- hash_function{storage_config->hash_function},
- local{std::make_shared<LocalApi>(storage_config,
- storage,
- local_exec_config,
+ hash_function{local_context->storage_config->hash_function},
+ local{std::make_shared<LocalApi>(local_context->storage_config,
+ local_context->storage,
+ local_context->exec_config,
repo_config)},
remote{CreateRemote(remote_exec_config->remote_address)} {}
diff --git a/src/buildtool/execution_api/common/api_bundle.hpp b/src/buildtool/execution_api/common/api_bundle.hpp
index baa4594b..d6cf4423 100644
--- a/src/buildtool/execution_api/common/api_bundle.hpp
+++ b/src/buildtool/execution_api/common/api_bundle.hpp
@@ -25,19 +25,15 @@
#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
-#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/storage/config.hpp"
-#include "src/buildtool/storage/storage.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
/// exactly the same instance that local api is (&*remote == & *local).
struct ApiBundle final {
explicit ApiBundle(
- gsl::not_null<StorageConfig const*> const& storage_config,
- gsl::not_null<Storage const*> const& storage,
- gsl::not_null<LocalExecutionConfig const*> const& local_exec_config,
+ 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,
diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS
index 7f39d28f..5ff6bcbd 100644
--- a/src/buildtool/main/TARGETS
+++ b/src/buildtool/main/TARGETS
@@ -27,6 +27,7 @@
, "server_implementation"
]
, ["src/buildtool/execution_api/local", "config"]
+ , ["src/buildtool/execution_api/local", "context"]
, ["src/buildtool/execution_api/remote", "config"]
, ["src/buildtool/file_system", "file_root"]
, ["src/buildtool/serve_api/remote", "config"]
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index b4cc3566..774f1356 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -39,7 +39,6 @@
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
-#include "src/buildtool/execution_api/local/config.hpp"
#include "src/buildtool/file_system/file_root.hpp"
#include "src/buildtool/logging/log_config.hpp"
#include "src/buildtool/logging/log_level.hpp"
@@ -73,6 +72,8 @@
#include "src/buildtool/common/remote/retry_config.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"
+#include "src/buildtool/execution_api/local/context.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/graph_traverser/graph_traverser.hpp"
#include "src/buildtool/main/describe.hpp"
@@ -794,6 +795,8 @@ auto main(int argc, char* argv[]) -> int {
arguments.service.pid_file);
if (execution_server) {
+ RetryConfig
+ retry_config{}; // default is enough, as remote is not used
// Use default remote configuration.
RemoteExecutionConfig remote_exec_config{};
@@ -807,12 +810,13 @@ auto main(int argc, char* argv[]) -> int {
StoreTargetCacheShard(
*storage_config, storage, remote_exec_config);
- RetryConfig
- retry_config{}; // default is enough, as remote is not used
+ // pack the local context instances to be passed as needed
+ LocalContext const local_context{
+ .exec_config = &*local_exec_config,
+ .storage_config = &*storage_config,
+ .storage = &storage};
- ApiBundle const exec_apis{&*storage_config,
- &storage,
- &*local_exec_config,
+ ApiBundle const exec_apis{&local_context,
/*repo_config=*/nullptr,
&*auth_config,
&retry_config,
@@ -869,9 +873,13 @@ auto main(int argc, char* argv[]) -> int {
StoreTargetCacheShard(
*storage_config, storage, *remote_exec_config);
- ApiBundle const serve_apis{&*storage_config,
- &storage,
- &*local_exec_config,
+ // pack the local context instances to be passed as needed
+ LocalContext const local_context{
+ .exec_config = &*local_exec_config,
+ .storage_config = &*storage_config,
+ .storage = &storage};
+
+ ApiBundle const serve_apis{&local_context,
/*repo_config=*/nullptr,
&*auth_config,
&*retry_config,
@@ -963,9 +971,12 @@ auto main(int argc, char* argv[]) -> int {
Progress progress{};
#ifndef BOOTSTRAP_BUILD_TOOL
- ApiBundle const main_apis{&*storage_config,
- &storage,
- &*local_exec_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 main_apis{&local_context,
&repo_config,
&*auth_config,
&*retry_config,
diff --git a/src/buildtool/serve_api/serve_service/TARGETS b/src/buildtool/serve_api/serve_service/TARGETS
index ecdb353b..8e59ccd8 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_api/local", "context"]
, ["src/buildtool/execution_api/remote", "config"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/graph_traverser", "graph_traverser"]
diff --git a/src/buildtool/serve_api/serve_service/target.cpp b/src/buildtool/serve_api/serve_service/target.cpp
index c2dd3344..1d27baf1 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/local/context.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/object_type.hpp"
@@ -483,9 +484,10 @@ auto TargetService::ServeTarget(
// Use a new ApiBundle that knows about local repository config for
// traversing.
- ApiBundle const local_apis{&storage_config_,
- &storage_,
- &local_exec_config_,
+ LocalContext const local_context{.exec_config = &local_exec_config_,
+ .storage_config = &storage_config_,
+ .storage = &storage_};
+ ApiBundle const local_apis{&local_context,
&repository_config,
&apis_.auth,
&apis_.retry_config,
diff --git a/src/other_tools/just_mr/TARGETS b/src/other_tools/just_mr/TARGETS
index bd6d1ae6..619a664c 100644
--- a/src/other_tools/just_mr/TARGETS
+++ b/src/other_tools/just_mr/TARGETS
@@ -137,6 +137,7 @@
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/common", "api_bundle"]
, ["src/buildtool/execution_api/local", "config"]
+ , ["src/buildtool/execution_api/local", "context"]
, ["src/buildtool/execution_api/remote", "config"]
, ["src/buildtool/serve_api/remote", "config"]
, ["src/buildtool/serve_api/remote", "serve_api"]
@@ -208,6 +209,7 @@
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/common", "api_bundle"]
, ["src/buildtool/execution_api/local", "config"]
+ , ["src/buildtool/execution_api/local", "context"]
, ["src/buildtool/execution_api/remote", "config"]
, ["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 b6495a6f..e7d1f775 100644
--- a/src/other_tools/just_mr/fetch.cpp
+++ b/src/other_tools/just_mr/fetch.cpp
@@ -25,6 +25,7 @@
#include "src/buildtool/execution_api/common/api_bundle.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
#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/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
@@ -427,10 +428,13 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& 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 the APIs for archive fetches; only happens if in native mode
- ApiBundle const apis{&storage_config,
- &storage,
- &*local_exec_config,
+ ApiBundle const apis{&local_context,
/*repo_config=*/nullptr,
&*auth_config,
&*retry_config,
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index 14d678c9..40607b00 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -27,6 +27,7 @@
#include "src/buildtool/execution_api/common/api_bundle.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
#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/file_system/symlinks_map/resolve_symlinks_map.hpp"
#include "src/buildtool/logging/log_level.hpp"
@@ -149,9 +150,12 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
return std::nullopt;
}
- ApiBundle const apis{&storage_config,
- &storage,
- &*local_exec_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,
/*repo_config=*/nullptr,
&*auth_config,
&*retry_config,