summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/common/api_bundle.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-25 17:02:03 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-30 12:10:06 +0200
commitb5a92a60035ea3731a96bbdc8bca18986b558a05 (patch)
tree088d85e95d929b31cf74afb1a922b34c4afa7138 /src/buildtool/execution_api/common/api_bundle.cpp
parentdeba068d8692bf6d265926885de5601d72f5d461 (diff)
downloadjustbuild-b5a92a60035ea3731a96bbdc8bca18986b558a05.tar.gz
Pass RemoteContext to ApiBundle
The CreateRemote method is also updated to receive all remote-related information as arguments, such that it does not have to rely on the ApiBundle internal fields which will eventually be removed.
Diffstat (limited to 'src/buildtool/execution_api/common/api_bundle.cpp')
-rw-r--r--src/buildtool/execution_api/common/api_bundle.cpp29
1 files changed, 15 insertions, 14 deletions
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);
}