summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/other_tools/just_mr/cli.hpp13
-rw-r--r--src/other_tools/just_mr/main.cpp8
-rw-r--r--src/other_tools/just_mr/utils.hpp17
3 files changed, 30 insertions, 8 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp
index 2174c331..c9a36387 100644
--- a/src/other_tools/just_mr/cli.hpp
+++ b/src/other_tools/just_mr/cli.hpp
@@ -37,6 +37,7 @@ struct MultiRepoCommonArguments {
std::optional<std::filesystem::path> checkout_locations_file{std::nullopt};
std::vector<std::string> explicit_distdirs{};
JustMR::PathsPtr just_mr_paths = std::make_shared<JustMR::Paths>();
+ std::optional<std::vector<std::string>> local_launcher{std::nullopt};
std::optional<std::filesystem::path> just_path{std::nullopt};
std::optional<std::string> main{std::nullopt};
std::optional<std::filesystem::path> rc_path{std::nullopt};
@@ -100,6 +101,18 @@ static inline void SetupMultiRepoCommonArguments(
"Specification file for checkout locations.")
->type_name("CHECKOUT_LOCATION");
app->add_option_function<std::string>(
+ "--local-launcher",
+ [clargs](auto const& launcher_raw) {
+ clargs->local_launcher =
+ nlohmann::json::parse(launcher_raw)
+ .template get<std::vector<std::string>>();
+ },
+ "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{"env", "--"}.dump());
+ app->add_option_function<std::string>(
"--distdir",
[clargs](auto const& distdir_raw) {
clargs->explicit_distdirs.emplace_back(
diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp
index 7157034d..b479e1f2 100644
--- a/src/other_tools/just_mr/main.cpp
+++ b/src/other_tools/just_mr/main.cpp
@@ -1241,6 +1241,7 @@ void DefaultReachableRepositories(
bool use_config{false};
bool use_build_root{false};
+ bool use_launcher{false};
std::optional<std::filesystem::path> mr_config_path{std::nullopt};
if (subcommand and kKnownJustSubcommands.contains(*subcommand)) {
@@ -1256,6 +1257,7 @@ void DefaultReachableRepositories(
}
}
use_build_root = kKnownJustSubcommands.at(*subcommand).build_root;
+ use_launcher = kKnownJustSubcommands.at(*subcommand).launch;
}
// build just command
std::vector<std::string> cmd = {arguments.common.just_path->string()};
@@ -1270,6 +1272,12 @@ void DefaultReachableRepositories(
cmd.emplace_back("--local-build-root");
cmd.emplace_back(*arguments.common.just_mr_paths->root);
}
+ if (use_launcher and arguments.common.local_launcher and
+ not arguments.common.local_launcher->empty()) {
+ cmd.emplace_back("--local-launcher");
+ cmd.emplace_back(
+ nlohmann::json(*arguments.common.local_launcher).dump());
+ }
// forward logging arguments
if (not arguments.log.log_files.empty()) {
cmd.emplace_back("--log-append");
diff --git a/src/other_tools/just_mr/utils.hpp b/src/other_tools/just_mr/utils.hpp
index f5cc7de9..bfd81f16 100644
--- a/src/other_tools/just_mr/utils.hpp
+++ b/src/other_tools/just_mr/utils.hpp
@@ -48,18 +48,19 @@ std::vector<std::string> const kTakeOver = {"bindings",
struct JustSubCmdFlags {
bool config;
bool build_root;
+ bool launch;
};
// ordered, so that we have replicability
std::map<std::string, JustSubCmdFlags> const kKnownJustSubcommands{
- {"version", {false /*config*/, false /*build_root*/}},
- {"describe", {true /*config*/, false /*build_root*/}},
- {"analyse", {true /*config*/, true /*build_root*/}},
- {"build", {true /*config*/, true /*build_root*/}},
- {"install", {true /*config*/, true /*build_root*/}},
- {"rebuild", {true /*config*/, true /*build_root*/}},
- {"install-cas", {false /*config*/, true /*build_root*/}},
- {"gc", {false /*config*/, true /*build_root*/}}};
+ {"version", {false /*config*/, false /*build_root*/, false /*launch*/}},
+ {"describe", {true /*config*/, false /*build_root*/, false /*launch*/}},
+ {"analyse", {true /*config*/, true /*build_root*/, false /*launch*/}},
+ {"build", {true /*config*/, true /*build_root*/, true /*launch*/}},
+ {"install", {true /*config*/, true /*build_root*/, true /*launch*/}},
+ {"rebuild", {true /*config*/, true /*build_root*/, true /*launch*/}},
+ {"install-cas", {false /*config*/, true /*build_root*/, false /*launch*/}},
+ {"gc", {false /*config*/, true /*build_root*/, false /*launch*/}}};
nlohmann::json const kDefaultConfigLocations = nlohmann::json::array(
{{{"root", "workspace"}, {"path", "repos.json"}},