From 18092e2ff2d33f9f7c25eec995ffb4ac824fe96c Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Thu, 20 Jun 2024 09:36:36 +0200 Subject: Use ApiBundle for creation of APIs in just-mr --- src/other_tools/just_mr/setup_utils.cpp | 37 +++++++++++++-------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'src/other_tools/just_mr/setup_utils.cpp') diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index 7c09b580..4ed6f94d 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -21,8 +21,6 @@ #include "nlohmann/json.hpp" #include "src/buildtool/auth/authentication.hpp" #include "src/buildtool/build_engine/expression/expression.hpp" -#include "src/buildtool/execution_api/bazel_msg/bazel_common.hpp" -#include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" @@ -236,30 +234,25 @@ auto ReadConfiguration( } } -auto GetRemoteApi(std::optional const& remote_exec_addr, - std::optional const& remote_serve_addr, - MultiRepoRemoteAuthArguments const& auth) noexcept - -> IExecutionApi::Ptr { +void SetupRemoteConfig(std::optional const& remote_exec_addr, + std::optional const& remote_serve_addr, + MultiRepoRemoteAuthArguments const& auth) noexcept { // if only a serve endpoint address is given, we assume it is one that acts // also as remote-execution auto remote_addr = remote_exec_addr ? remote_exec_addr : remote_serve_addr; - if (remote_addr) { - // setup authentication - SetupAuthConfig(auth); - // setup remote - if (not RemoteExecutionConfig::SetRemoteAddress(*remote_addr)) { - Logger::Log(LogLevel::Error, - "setting remote execution address '{}' failed.", - *remote_addr); - std::exit(kExitConfigError); - } - auto address = RemoteExecutionConfig::RemoteAddress(); - ExecutionConfiguration config; - config.skip_cache_lookup = false; - return std::make_unique( - "remote-execution", address->host, address->port, config); + if (not remote_addr) { + return; + } + + // setup authentication + SetupAuthConfig(auth); + // setup remote + if (not RemoteExecutionConfig::SetRemoteAddress(*remote_addr)) { + Logger::Log(LogLevel::Error, + "setting remote execution address '{}' failed.", + *remote_addr); + std::exit(kExitConfigError); } - return nullptr; } auto CreateServeConfig(std::optional const& remote_serve_addr, -- cgit v1.2.3