summaryrefslogtreecommitdiff
path: root/src/buildtool/main/main.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-06-13 10:16:29 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-06-18 12:05:10 +0200
commitdc9a7b8499da9ce7a90546afecd048d0bfb31f38 (patch)
treeefc036d485bb8418ffbf77957be2d5f2252a9306 /src/buildtool/main/main.cpp
parentd08e6f1af5a96818c9e7c2c9e0a6288470489822 (diff)
downloadjustbuild-dc9a7b8499da9ce7a90546afecd048d0bfb31f38.tar.gz
Make ServeApi a general class, not a singleton
...and adjust interfaces.
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r--src/buildtool/main/main.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 0063e9bd..bdd1bed5 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -867,11 +867,7 @@ auto main(int argc, char* argv[]) -> int {
if (arguments.cmd == SubCommand::kServe) {
SetupServeServiceConfig(arguments.service);
- std::optional<gsl::not_null<const ServeApi*>> serve;
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- serve = &ServeApi::Instance();
- }
-
+ auto serve = ServeApi::Create(RemoteServeConfig::Instance());
if (!ServeServerImpl::Instance().Run(
RemoteServeConfig::Instance(),
serve,
@@ -956,12 +952,10 @@ auto main(int argc, char* argv[]) -> int {
DetermineRoots(&repo_config, arguments.common, arguments.analysis);
#ifndef BOOTSTRAP_BUILD_TOOL
- std::optional<gsl::not_null<const ServeApi*>> serve;
- if (RemoteServeConfig::Instance().RemoteAddress()) {
- serve = &ServeApi::Instance();
- }
+ std::optional<ServeApi> serve =
+ ServeApi::Create(RemoteServeConfig::Instance());
#else
- std::optional<gsl::not_null<const ServeApi*>> serve;
+ std::optional<ServeApi> serve;
#endif // BOOTSTRAP_BUILD_TOOL
#ifndef BOOTSTRAP_BUILD_TOOL