diff options
-rw-r--r-- | share/man/just-mrrc.5.md | 3 | ||||
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 1 | ||||
-rw-r--r-- | src/other_tools/just_mr/launch.cpp | 10 | ||||
-rw-r--r-- | src/other_tools/just_mr/rc.cpp | 5 |
4 files changed, 19 insertions, 0 deletions
diff --git a/share/man/just-mrrc.5.md b/share/man/just-mrrc.5.md index d25eb936..c0227b13 100644 --- a/share/man/just-mrrc.5.md +++ b/share/man/just-mrrc.5.md @@ -187,6 +187,8 @@ The just-mrrc is given by a JSON object. - *`"--dump-plain-graph"`* A file name specifying the file in the invocation-log directory for an invocation-specific `--dump-plain-graph` option. + - *`"--profile"`* A file name specifying the file in invocation-log + directory for an invocation-specific `--profile` option. EXAMPLE @@ -209,6 +211,7 @@ An example just-mrrc file could look like the following: { "directory": {"root": "system", "path": "var/opt/just-invocation"} , "metadata": "metadata.json" , "--dump-graph": "graph.json" + , "--profile": "profile.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 f9b32f53..96760b0d 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -96,6 +96,7 @@ struct InvocationLogArguments { std::optional<std::string> metadata{std::nullopt}; std::optional<std::string> graph_file{std::nullopt}; std::optional<std::string> graph_file_plain{std::nullopt}; + std::optional<std::string> profile{std::nullopt}; }; struct MultiRepoJustSubCmdsArguments { diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp index 1c08688e..76272213 100644 --- a/src/other_tools/just_mr/launch.cpp +++ b/src/other_tools/just_mr/launch.cpp @@ -318,6 +318,16 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, cmd.emplace_back("--dump-plain-graph"); cmd.emplace_back(*log_dir / *invocation_log.graph_file_plain); } + if (invocation_log.profile) { + if (not IsValidFileName(*invocation_log.profile)) { + Logger::Log(LogLevel::Error, + "Invalid file name for option --profile: {}", + nlohmann::json(*invocation_log.profile).dump()); + std::exit(kExitClargsError); + } + cmd.emplace_back("--profile"); + cmd.emplace_back(*log_dir / *invocation_log.profile); + } } // add (remaining) args given by user as clargs for (auto it = just_cmd_args.additional_just_args.begin() + diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp index 6bfda2c5..67ef3e24 100644 --- a/src/other_tools/just_mr/rc.cpp +++ b/src/other_tools/just_mr/rc.cpp @@ -620,6 +620,11 @@ namespace { if (graph_file_plain->IsString()) { clargs->invocation_log.graph_file = graph_file_plain->String(); } + auto profile = + invocation_log->Get("--profile", Expression::none_t{}); + if (profile->IsString()) { + clargs->invocation_log.profile = profile->String(); + } } } // read config lookup order |