diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-10-08 15:56:01 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-10-08 16:35:46 +0200 |
commit | 8798a8bdf82c87a136c07410d65267859f92e851 (patch) | |
tree | 5f15ec2fd65dd7f8ed5f6c15a8a7296ecd372c39 /src | |
parent | c9325cea0aa43f328644157dee4eafe3d7b45e6f (diff) | |
download | justbuild-8798a8bdf82c87a136c07410d65267859f92e851.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/common/cli.hpp | 6 | ||||
-rw-r--r-- | src/buildtool/main/main.cpp | 6 |
2 files changed, 12 insertions, 0 deletions
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<std::filesystem::path> rule_root; std::optional<std::filesystem::path> expression_root; std::optional<std::filesystem::path> graph_file; + std::optional<std::filesystem::path> graph_file_plain; std::optional<std::filesystem::path> artifacts_to_build_file; std::optional<std::filesystem::path> 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</*kIncludeOrigins=*/false>( + *arguments.analysis.graph_file_plain, + &stats, + &progress); + } auto const [artifacts, runfiles] = ReadOutputArtifacts(result->target); if (arguments.analysis.artifacts_to_build_file) { |