diff options
Diffstat (limited to 'src')
3 files changed, 19 insertions, 22 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 65daa0d8..ad1447be 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -146,21 +146,6 @@ void SetupServeConfig(ServeArguments const& srvargs, *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 RemoteServeConfig::SetKnownRepositories(srvargs.repositories)) { @@ -863,6 +848,22 @@ auto main(int argc, char* argv[]) -> int { } return kExitSuccess; } + + // If no execution endpoint was given, the client should default to the + // serve endpoint, if given + if (not RemoteExecutionConfig::RemoteAddress() and + arguments.serve.remote_serve_address) { + if (!RemoteExecutionConfig::SetRemoteAddress( + *arguments.serve.remote_serve_address)) { + Logger::Log(LogLevel::Error, + "Setting remote execution address '{}' failed.", + *arguments.serve.remote_serve_address); + std::exit(kExitFailure); + } + Logger::Log(LogLevel::Info, + "Using '{}' as the remote execution endpoint.", + *arguments.serve.remote_serve_address); + } #endif // BOOTSTRAP_BUILD_TOOL auto jobs = arguments.build.build_jobs > 0 ? arguments.build.build_jobs diff --git a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp index 16aa6466..1c0453e5 100644 --- a/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp +++ b/src/buildtool/serve_api/serve_service/serve_server_implementation.cpp @@ -121,13 +121,6 @@ auto ServeServerImpl::Run(bool with_execute) -> bool { return false; } - if (with_execute and !RemoteExecutionConfig::SetRemoteAddress( - fmt::format("{}:{}", interface_, port_))) { - Logger::Log(LogLevel::Error, - "Internal error: cannot set the remote address"); - return false; - } - auto pid = getpid(); nlohmann::json const& info = { diff --git a/src/buildtool/serve_api/serve_service/serve_server_implementation.hpp b/src/buildtool/serve_api/serve_service/serve_server_implementation.hpp index 494165ed..1bf1a1cc 100644 --- a/src/buildtool/serve_api/serve_service/serve_server_implementation.hpp +++ b/src/buildtool/serve_api/serve_service/serve_server_implementation.hpp @@ -47,6 +47,9 @@ class ServeServerImpl { ServeServerImpl(ServeServerImpl&&) noexcept = delete; auto operator=(ServeServerImpl&&) noexcept -> ServeServerImpl& = delete; + /// \brief Start the serve service. + /// \param with_execute Flag specifying if just serve should act also as + /// just execute (i.e., start remote execution services with same interface) auto Run(bool with_execute) -> bool; ~ServeServerImpl() = default; |