diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-12 16:09:28 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-16 17:51:12 +0200 |
commit | 62d204ff4cc94c12c1635f189255710901682825 (patch) | |
tree | 0c5cdc5faf98d28ddf74721280756804a6decf83 /src/other_tools/just_mr/setup_utils.cpp | |
parent | de3ef374983d987d8ffd8e8516a4877fe68b3e4e (diff) | |
download | justbuild-62d204ff4cc94c12c1635f189255710901682825.tar.gz |
Remove the RemoteExecutionConfig singleton
...and replace it with passed instances created early via a builder
pattern.
Tests are also updated accordingly.
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, 11 insertions, 11 deletions
diff --git a/src/other_tools/just_mr/setup_utils.cpp b/src/other_tools/just_mr/setup_utils.cpp index ae6f5a28..4e5e5ad3 100644 --- a/src/other_tools/just_mr/setup_utils.cpp +++ b/src/other_tools/just_mr/setup_utils.cpp @@ -233,23 +233,23 @@ auto CreateLocalExecutionConfig(MultiRepoCommonArguments const& cargs) noexcept return std::nullopt; } -void SetupRemoteConfig( +auto CreateRemoteExecutionConfig( std::optional<std::string> const& remote_exec_addr, - std::optional<std::string> const& remote_serve_addr) noexcept { + std::optional<std::string> const& remote_serve_addr) noexcept + -> std::optional<RemoteExecutionConfig> { // 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 (not remote_addr) { - return; - } - // setup remote - if (not RemoteExecutionConfig::SetRemoteAddress(*remote_addr)) { - Logger::Log(LogLevel::Error, - "setting remote execution address '{}' failed.", - *remote_addr); - std::exit(kExitConfigError); + RemoteExecutionConfig::Builder builder; + auto config = builder.SetRemoteAddress(remote_addr).Build(); + + if (config) { + return *std::move(config); } + + Logger::Log(LogLevel::Error, config.error()); + return std::nullopt; } auto CreateServeConfig( |