From b5a92a60035ea3731a96bbdc8bca18986b558a05 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 25 Jul 2024 17:02:03 +0200 Subject: 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. --- src/buildtool/execution_api/common/api_bundle.cpp | 29 ++++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/buildtool/execution_api/common/api_bundle.cpp') 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 const& local_context, - RepositoryConfig const* repo_config, - gsl::not_null const& authentication, - gsl::not_null const& retry_config, - gsl::not_null const& remote_exec_config) - : auth{*authentication}, - retry_config{*retry_config}, - remote_config{*remote_exec_config}, +ApiBundle::ApiBundle(gsl::not_null const& local_context, + gsl::not_null 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(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 const& address) const +auto ApiBundle::CreateRemote( + std::optional const& address, + gsl::not_null const& authentication, + gsl::not_null const& retry_config) const -> gsl::not_null { if (address) { ExecutionConfiguration config; @@ -40,8 +41,8 @@ auto ApiBundle::CreateRemote(std::optional const& address) const return std::make_shared("remote-execution", address->host, address->port, - &auth, - &retry_config, + authentication, + retry_config, config, hash_function); } -- cgit v1.2.3