summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/just-mrrc.5.md7
-rw-r--r--src/other_tools/just_mr/cli.hpp2
-rw-r--r--src/other_tools/just_mr/launch.cpp25
-rw-r--r--src/other_tools/just_mr/rc.cpp10
4 files changed, 43 insertions, 1 deletions
diff --git a/share/man/just-mrrc.5.md b/share/man/just-mrrc.5.md
index d63bc4ec..d25eb936 100644
--- a/share/man/just-mrrc.5.md
+++ b/share/man/just-mrrc.5.md
@@ -181,6 +181,12 @@ The just-mrrc is given by a JSON object.
directory the metadata file should be stored. If not given,
no metadata file will be written. See **`just-profile`**(5) for
details of the format.
+ - *`"--dump-graph"`* A file name specifying the file in
+ the invocation-log directory for an invocation-specific
+ `--dump-graph` option.
+ - *`"--dump-plain-graph"`* A file name specifying the file
+ in the invocation-log directory for an invocation-specific
+ `--dump-plain-graph` option.
EXAMPLE
@@ -202,6 +208,7 @@ An example just-mrrc file could look like the following:
, "invocation log":
{ "directory": {"root": "system", "path": "var/opt/just-invocation"}
, "metadata": "metadata.json"
+ , "--dump-graph": "graph.json"
}
, "absent":
[ {"root": "workspace", "path": "etc/absent.json"}
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp
index 44acc1f5..f9b32f53 100644
--- a/src/other_tools/just_mr/cli.hpp
+++ b/src/other_tools/just_mr/cli.hpp
@@ -94,6 +94,8 @@ struct InvocationLogArguments {
std::optional<std::filesystem::path> directory{std::nullopt};
std::optional<std::string> project_id{std::nullopt};
std::optional<std::string> metadata{std::nullopt};
+ std::optional<std::string> graph_file{std::nullopt};
+ std::optional<std::string> graph_file_plain{std::nullopt};
};
struct MultiRepoJustSubCmdsArguments {
diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp
index 181fc003..1c08688e 100644
--- a/src/other_tools/just_mr/launch.cpp
+++ b/src/other_tools/just_mr/launch.cpp
@@ -295,7 +295,30 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file,
nlohmann::json(dir.string()).dump());
}
}
-
+ // invocation-specific
+ if (log_dir and supports_remote_properties) {
+ if (invocation_log.graph_file) {
+ if (not IsValidFileName(*invocation_log.graph_file)) {
+ Logger::Log(LogLevel::Error,
+ "Invalid file name for option --dump-graph: {}",
+ nlohmann::json(*invocation_log.graph_file).dump());
+ std::exit(kExitClargsError);
+ }
+ cmd.emplace_back("--dump-graph");
+ cmd.emplace_back(*log_dir / *invocation_log.graph_file);
+ }
+ if (invocation_log.graph_file_plain) {
+ if (not IsValidFileName(*invocation_log.graph_file_plain)) {
+ Logger::Log(
+ LogLevel::Error,
+ "Invalid file name for option --dump-plain-graph: {}",
+ nlohmann::json(*invocation_log.graph_file_plain).dump());
+ std::exit(kExitClargsError);
+ }
+ cmd.emplace_back("--dump-plain-graph");
+ cmd.emplace_back(*log_dir / *invocation_log.graph_file_plain);
+ }
+ }
// add (remaining) args given by user as clargs
for (auto it = just_cmd_args.additional_just_args.begin() +
additional_args_offset;
diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp
index 401510f9..6bfda2c5 100644
--- a/src/other_tools/just_mr/rc.cpp
+++ b/src/other_tools/just_mr/rc.cpp
@@ -610,6 +610,16 @@ namespace {
if (metadata->IsString()) {
clargs->invocation_log.metadata = metadata->String();
}
+ auto graph_file =
+ invocation_log->Get("--dump-graph", Expression::none_t{});
+ if (graph_file->IsString()) {
+ clargs->invocation_log.graph_file = graph_file->String();
+ }
+ auto graph_file_plain =
+ invocation_log->Get("--dump-plain-graph", Expression::none_t{});
+ if (graph_file_plain->IsString()) {
+ clargs->invocation_log.graph_file = graph_file_plain->String();
+ }
}
}
// read config lookup order