From b734b2a16678b835742eed0de5fbf07f8a6332ae Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 15 May 2025 11:57:38 +0200 Subject: just-mr: support invocation-specific artifacts-to-build logging It is already supported to ask just-mr (via the rc file) to log for each invocation the artifacts that were built. Add a similar option for the artifacts that were to be built, i.e., for dumping the intensional description of the output artifacts. That information can be used, e.g., to compute the critical path. --- src/other_tools/just_mr/cli.hpp | 1 + src/other_tools/just_mr/launch.cpp | 14 ++++++++++++++ src/other_tools/just_mr/rc.cpp | 6 ++++++ 3 files changed, 21 insertions(+) (limited to 'src') diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index df952957..defb7be6 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -98,6 +98,7 @@ struct InvocationLogArguments { std::optional metadata{std::nullopt}; std::optional graph_file{std::nullopt}; std::optional graph_file_plain{std::nullopt}; + std::optional dump_artifacts_to_build{std::nullopt}; std::optional dump_artifacts{std::nullopt}; std::optional profile{std::nullopt}; }; diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp index 7d2bdf25..0a061031 100644 --- a/src/other_tools/just_mr/launch.cpp +++ b/src/other_tools/just_mr/launch.cpp @@ -326,6 +326,20 @@ auto CallJust(std::optional const& config_file, cmd.emplace_back("--dump-plain-graph"); cmd.emplace_back(*log_dir / *invocation_log.graph_file_plain); } + if (invocation_log.dump_artifacts_to_build) { + if (not IsValidFileName(*invocation_log.dump_artifacts_to_build)) { + Logger::Log( + LogLevel::Error, + "Invalid file name for option --dump-artifacts_to_build: " + "{}", + nlohmann::json(*invocation_log.dump_artifacts_to_build) + .dump()); + std::exit(kExitClargsError); + } + cmd.emplace_back("--dump-artifacts-to-build"); + cmd.emplace_back(*log_dir / + *invocation_log.dump_artifacts_to_build); + } if (does_build and invocation_log.dump_artifacts) { if (not IsValidFileName(*invocation_log.dump_artifacts)) { Logger::Log( diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp index 7d7f6f5a..41b7e77e 100644 --- a/src/other_tools/just_mr/rc.cpp +++ b/src/other_tools/just_mr/rc.cpp @@ -619,6 +619,12 @@ namespace { if (graph_file_plain->IsString()) { clargs->invocation_log.graph_file = graph_file_plain->String(); } + auto dump_artifacts_to_build = invocation_log->Get( + "--dump-artifacts-to-build", Expression::none_t{}); + if (dump_artifacts_to_build->IsString()) { + clargs->invocation_log.dump_artifacts_to_build = + dump_artifacts_to_build->String(); + } auto dump_artifacts = invocation_log->Get("--dump-artifacts", Expression::none_t{}); if (dump_artifacts->IsString()) { -- cgit v1.2.3