diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-09-08 18:15:01 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2023-09-13 16:14:43 +0200 |
commit | 669d1d8714b258ffd19f1610028374233a143f4b (patch) | |
tree | ef3774508075f028637844fac2095a5dc2cbce08 /src/other_tools/just_mr/setup_utils.cpp | |
parent | f48e1ebe7f08159004bf9a88d5a9e474ff32dbb1 (diff) | |
download | justbuild-669d1d8714b258ffd19f1610028374233a143f4b.tar.gz |
just-mr: Implement 'absent' roots
...via an 'absent' pragma in repository descriptions.
For 'git'-type repositories, first interrogates a 'just serve'
remote, if given, before reverting to fetching from the network.
Diffstat (limited to 'src/other_tools/just_mr/setup_utils.cpp')
-rw-r--r-- | src/other_tools/just_mr/setup_utils.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index 28355e89..b325a71d 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -15,6 +15,9 @@ #include "src/other_tools/just_mr/setup_utils.hpp" #include <fstream> +#include <memory> +#include <optional> +#include <string> #include <unordered_set> #include "nlohmann/json.hpp" @@ -24,6 +27,7 @@ #include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/logging/logger.hpp" +#include "src/buildtool/serve_api/remote/config.hpp" #include "src/other_tools/just_mr/exit_codes.hpp" namespace { @@ -202,4 +206,22 @@ auto SetupRemoteApi(std::optional<std::string> const& remote_exec_addr, return nullptr; } +auto SetupServeApi(std::optional<std::string> const& remote_serve_addr, + MultiRepoRemoteAuthArguments const& auth) -> ServeApi::Ptr { + if (remote_serve_addr) { + // setup authentication + SetupAuthConfig(auth); + // setup remote + if (not RemoteServeConfig::SetRemoteAddress(*remote_serve_addr)) { + Logger::Log(LogLevel::Error, + "setting remote serve service address '{}' failed.", + *remote_serve_addr); + std::exit(kExitConfigError); + } + auto address = RemoteServeConfig::RemoteAddress(); + return std::make_unique<ServeApi>(address->host, address->port); + } + return nullptr; +} + } // namespace JustMR::Utils |