From 027d8d010948c92abc67fd6410f5a88944973392 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 15 Mar 2024 10:36:31 +0100 Subject: Add local launcher to just-serve config As just serve can simultaneously act as remote-execution endpoint, it has to accept in its configuration all the necessary information, in particular, the local launcher. Add it. --- share/man/just-serve-config.5.md | 7 ++++++- src/buildtool/main/serve.cpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/share/man/just-serve-config.5.md b/share/man/just-serve-config.5.md index 5dd02d08..c4ac8dee 100644 --- a/share/man/just-serve-config.5.md +++ b/share/man/just-serve-config.5.md @@ -107,7 +107,12 @@ The configuration file is given by a JSON object. remote-execution endpoint. The value *`"disable"`* disables adding new entries to the target-level cache, which defeats the purpose of typical set up to share target-level computations - between clients. + between clients. + For the subkey *`"local launcher"`*, if given, the value has + to be a list. This list is used as local launcher for the + build in the case the serve process acts simultaneously as + remote-execution endpoint. If unset (or `null`), the value + `["env", "--"]` will be taken as default. See also diff --git a/src/buildtool/main/serve.cpp b/src/buildtool/main/serve.cpp index e2b6635e..cebbd247 100644 --- a/src/buildtool/main/serve.cpp +++ b/src/buildtool/main/serve.cpp @@ -524,6 +524,35 @@ void ReadJustServeConfig(gsl::not_null const& clargs) { } clargs->tc.target_cache_write_strategy = *s_value; } + + auto launcher = build_args->Get("local launcher", Expression::none_t{}); + if (launcher.IsNotNull()) { + if (not launcher->IsList()) { + Logger::Log( + LogLevel::Error, + "In serve service config file {}:\nValue for build key " + "\"local launcher\" has to be a list, but found {}", + clargs->serve.config.string(), + launcher->ToString()); + std::exit(kExitFailure); + } + std::vector launcher_list{}; + for (auto const& entry : launcher->List()) { + if (not entry->IsString()) { + Logger::Log(LogLevel::Error, + "In serve service config file {}:\nValue for " + "build key \"local launcher\" has to be a list " + "of string, but found {} with entry {}", + clargs->serve.config.string(), + launcher->ToString(), + entry->ToString()); + + std::exit(kExitFailure); + } + launcher_list.emplace_back(entry->String()); + } + clargs->build.local_launcher = launcher_list; + } } } -- cgit v1.2.3