From 8798a8bdf82c87a136c07410d65267859f92e851 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Tue, 8 Oct 2024 15:56:01 +0200 Subject: just analyse: support dumping the action graph without origins The origins of actions are useful for understanding the action graph; if, however, the action graph is only to be used for further computaiton, this is unnecessary information. Therefore, add an option to dump the action graph without origins. --- share/man/just.1.md | 5 +++++ src/buildtool/common/cli.hpp | 6 ++++++ src/buildtool/main/main.cpp | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/share/man/just.1.md b/share/man/just.1.md index dd585920..e981d633 100644 --- a/share/man/just.1.md +++ b/share/man/just.1.md @@ -439,6 +439,11 @@ File path for writing the action graph description to. See **`just-graph-file`**(5) for more details. Supported by: analyse|build|install|rebuild. +**`--dump-plain-graph`** *`PATH`* +File path for writing the action graph description to, however without +the additional `"origins"` key. See **`just-graph-file`**(5) for more details. +Supported by: analyse|build|install|rebuild. + **`-f`**, **`--log-file`** *`PATH`* Path to local log file. **`just`** will store the information printed on stderr in the log file along with the thread id and timestamp when the diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index 0571acb8..7f935364 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -71,6 +71,7 @@ struct AnalysisArguments { std::optional rule_root; std::optional expression_root; std::optional graph_file; + std::optional graph_file_plain; std::optional artifacts_to_build_file; std::optional serve_errors_file; }; @@ -343,6 +344,11 @@ static inline auto SetupAnalysisArguments( clargs->graph_file, "File path for writing the action graph description to.") ->type_name("PATH"); + app->add_option("--dump-plain-graph", + clargs->graph_file_plain, + "File path for writing the action graph description " + "(without origins) to.") + ->type_name("PATH"); app->add_option("--dump-artifacts-to-build", clargs->artifacts_to_build_file, "File path for writing the artifacts to build to.") diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp index 6a2c8525..bada208a 100644 --- a/src/buildtool/main/main.cpp +++ b/src/buildtool/main/main.cpp @@ -1148,6 +1148,12 @@ auto main(int argc, char* argv[]) -> int { result_map.ToFile( *arguments.analysis.graph_file, &stats, &progress); } + if (arguments.analysis.graph_file_plain) { + result_map.ToFile( + *arguments.analysis.graph_file_plain, + &stats, + &progress); + } auto const [artifacts, runfiles] = ReadOutputArtifacts(result->target); if (arguments.analysis.artifacts_to_build_file) { -- cgit v1.2.3