From f7f2f0dc41b75b5f2a094d33e6325fdf9e8438a8 Mon Sep 17 00:00:00 2001 From: Alberto Sartori Date: Mon, 26 Feb 2024 16:31:00 +0100 Subject: just analyse: add --dump-result command line option The result of the analysis is a JSON object containing the keys `"artifacts"`, `"runfiles"`, and `"provides"`. This JSON object, by default, is logged. However, it might be useful to process the data contained in it, while, for example, developing new rules. This patch adds a new command line option (`--dump-result`), reserved to the subcommand `analyse`, to dump the analysis result to the given file or stdout (if `-` is given). --- src/buildtool/common/cli.hpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/buildtool/common/cli.hpp') diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index eded8112..57567cf7 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -91,6 +91,7 @@ struct DiagnosticArguments { std::optional dump_targets_graph{std::nullopt}; std::optional dump_anonymous{std::nullopt}; std::optional dump_nodes{std::nullopt}; + std::optional dump_result{std::nullopt}; }; /// \brief Arguments required for specifying build endpoint. @@ -398,6 +399,10 @@ static inline auto SetupDiagnosticArguments( clargs->dump_nodes, "Dump nodes of target to file (use - for stdout).") ->type_name("PATH"); + app->add_option("--dump-result", + clargs->dump_result, + "Dump the result of analyse to file (use - for stdout).") + ->type_name("PATH"); } static inline auto SetupCacheArguments( -- cgit v1.2.3