diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-15 10:36:31 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-20 14:36:35 +0100 |
commit | 027d8d010948c92abc67fd6410f5a88944973392 (patch) | |
tree | 30c95a948c159fcdfc48667f22a1bb3a8e10a322 | |
parent | 5ee4bc12a33f235b68732dee715de8f754620eda (diff) | |
download | justbuild-027d8d010948c92abc67fd6410f5a88944973392.tar.gz |
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.
-rw-r--r-- | share/man/just-serve-config.5.md | 7 | ||||
-rw-r--r-- | src/buildtool/main/serve.cpp | 29 |
2 files changed, 35 insertions, 1 deletions
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<CommandLineArguments*> 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<std::string> 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; + } } } |