summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-03-21 11:34:32 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-03-22 13:53:27 +0100
commita116a448353f34374c2c96dfe1d646f05da7c0bf (patch)
tree451c1ec4fbddaca0f97a84be286c26331c97f6a0 /src
parent224e813fdc25f1932069f5e738447193adab5e63 (diff)
downloadjustbuild-a116a448353f34374c2c96dfe1d646f05da7c0bf.tar.gz
just-mrrc: allow setting a default for the launcher the rc file
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/just_mr/cli.hpp4
-rw-r--r--src/other_tools/just_mr/main.cpp29
2 files changed, 30 insertions, 3 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp
index 01622980..8b5604a6 100644
--- a/src/other_tools/just_mr/cli.hpp
+++ b/src/other_tools/just_mr/cli.hpp
@@ -109,9 +109,7 @@ static inline void SetupMultiRepoCommonArguments(
},
"JSON array with the list of strings representing the launcher to "
"prepend actions' commands before being executed locally.")
- ->type_name("JSON")
- ->run_callback_for_default()
- ->default_val(nlohmann::json(kDefaultLauncher).dump());
+ ->type_name("JSON");
app->add_option_function<std::string>(
"--distdir",
[clargs](auto const& distdir_raw) {
diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp
index 965c3bf0..0657c84c 100644
--- a/src/other_tools/just_mr/main.cpp
+++ b/src/other_tools/just_mr/main.cpp
@@ -387,6 +387,35 @@ void SetupLogging(MultiRepoLogArguments const& clargs) {
clargs->just_cmd.just_args[cmd_name] = std::move(args);
}
}
+ // read default for local launcher
+ if (not clargs->common.local_launcher) {
+ auto launcher = rc_config["local launcher"];
+ if (launcher.IsNotNull()) {
+ if (not launcher->IsList()) {
+ Logger::Log(LogLevel::Error,
+ "Configuration-file provided launcher {} is not a "
+ "list of strings",
+ launcher->ToString());
+ std::exit(kExitConfigError);
+ }
+ std::vector<std::string> default_launcher{};
+ default_launcher.reserve(launcher->List().size());
+ for (auto const& entry : launcher->List()) {
+ if (not entry->IsString()) {
+ Logger::Log(LogLevel::Error,
+ "Configuration-file provided launcher {} is "
+ "not a list of strings",
+ launcher->ToString());
+ std::exit(kExitConfigError);
+ }
+ default_launcher.emplace_back(entry->String());
+ }
+ clargs->common.local_launcher = default_launcher;
+ }
+ else {
+ clargs->common.local_launcher = kDefaultLauncher;
+ }
+ }
// read config lookup order
auto config_lookup_order = rc_config["config lookup order"];
if (config_lookup_order.IsNotNull()) {