diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-05-15 11:57:38 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-05-15 16:31:24 +0200 |
commit | b734b2a16678b835742eed0de5fbf07f8a6332ae (patch) | |
tree | eda98c419b802f26c7e9a739ae1ca9fcc2dd7710 /src/other_tools/just_mr | |
parent | 44a7f88d0c6cd13087b422a4e8dd7b991b9be134 (diff) | |
download | justbuild-b734b2a16678b835742eed0de5fbf07f8a6332ae.tar.gz |
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.
Diffstat (limited to 'src/other_tools/just_mr')
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 1 | ||||
-rw-r--r-- | src/other_tools/just_mr/launch.cpp | 14 | ||||
-rw-r--r-- | src/other_tools/just_mr/rc.cpp | 6 |
3 files changed, 21 insertions, 0 deletions
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<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> dump_artifacts_to_build{std::nullopt}; std::optional<std::string> dump_artifacts{std::nullopt}; std::optional<std::string> 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<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.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()) { |