diff options
author | Alberto Sartori <alberto.sartori@huawei.com> | 2023-11-16 10:06:14 +0100 |
---|---|---|
committer | Alberto Sartori <alberto.sartori@huawei.com> | 2023-11-16 10:54:03 +0100 |
commit | a22da1c7831b389809d085ff6867febba4dc95bc (patch) | |
tree | 77184aaca5231e02334f37349403e3d3d17d882a /src/buildtool/main/main.cpp | |
parent | a170c330955206e7df9d5ce7da1d196f24e283d8 (diff) | |
download | justbuild-a22da1c7831b389809d085ff6867febba4dc95bc.tar.gz |
remote-execution-endpoint: fall back to remote-serve-endpoint
If only the `--remote-serve-endpoint` option is specified on the
command line, the `--remote-execution-endpoint` is also set to the
given value.
This makes the spawning and usage of just-execute consistent. When
just-serve is started, if no remote execution endpoint is provided,
the same process will also act as a just-execute instance. With the
current patch, the client can thus only write, on command line, the
remote serve address, avoiding the repetition of the same address for
two different options.
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r-- | src/buildtool/main/main.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index d6b06471..25458ef4 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -135,17 +135,32 @@ void SetupExecutionConfig(EndpointArguments const& eargs, } void SetupServeConfig(ServeArguments const& srvargs) { - using RemoteConfig = RemoteServeConfig; if (srvargs.remote_serve_address) { - if (not RemoteConfig::SetRemoteAddress(*srvargs.remote_serve_address)) { + if (not RemoteServeConfig::SetRemoteAddress( + *srvargs.remote_serve_address)) { Logger::Log(LogLevel::Error, "setting serve service address '{}' failed.", *srvargs.remote_serve_address); std::exit(kExitFailure); } + // if the user has not provided the --remote-execution-address, we fall + // back to the --remote-serve-address + if (auto client_remote_address = RemoteExecutionConfig::RemoteAddress(); + !client_remote_address) { + if (!RemoteExecutionConfig::SetRemoteAddress( + *srvargs.remote_serve_address)) { + Logger::Log(LogLevel::Error, + "setting remote execution address '{}' failed.", + *srvargs.remote_serve_address); + std::exit(kExitFailure); + } + Logger::Log(LogLevel::Info, + "Using '{}' as the remote execution endpoint.", + *srvargs.remote_serve_address); + } } if (not srvargs.repositories.empty() and - not RemoteConfig::SetKnownRepositories(srvargs.repositories)) { + not RemoteServeConfig::SetKnownRepositories(srvargs.repositories)) { Logger::Log(LogLevel::Error, "setting serve service repositories failed."); std::exit(kExitFailure); |