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.hpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/buildtool/execution_api/common/api_bundle.hpp') 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 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); + gsl::not_null const& remote_context, + RepositoryConfig const* repo_config); - [[nodiscard]] auto CreateRemote(std::optional const& address) - const -> gsl::not_null; + /// \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 const& address, + gsl::not_null const& authentication, + gsl::not_null const& retry_config) const + -> gsl::not_null; // Needed to be set before creating the remote (via CreateRemote) Auth const& auth; -- cgit v1.2.3