diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-02-26 10:16:30 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-03-10 16:28:59 +0100 |
commit | d53358c350898091d9cf2ba76ccdfa9e590275ee (patch) | |
tree | 46f7e89bbc18dd3df3039a08a757c3b622d7cb1c /src/buildtool/common/cli.hpp | |
parent | d1cfcdcb8909f35cdd1591dda099a5370648bbba (diff) | |
download | justbuild-d53358c350898091d9cf2ba76ccdfa9e590275ee.tar.gz |
Make graph-dumping options cummulative
If --dump-graph or --dump-plain-graph is given several times, the
action graph wil also be written several times. In this way, regular
use of those options will not be affected by adding them implicitly
through invocation-logging options in the rc file.
Diffstat (limited to 'src/buildtool/common/cli.hpp')
-rw-r--r-- | src/buildtool/common/cli.hpp | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index ef6c043c..a8acea87 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -73,8 +73,8 @@ struct AnalysisArguments { std::optional<std::filesystem::path> target_root; 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::vector<std::filesystem::path> graph_file; + std::vector<std::filesystem::path> graph_file_plain; std::optional<std::filesystem::path> artifacts_to_build_file; std::optional<std::filesystem::path> serve_errors_file; }; @@ -346,16 +346,22 @@ static inline auto SetupAnalysisArguments( "errors as json.") ->type_name("PATH"); if (with_graph) { - app->add_option( + app->add_option_function<std::string>( "--dump-graph", - clargs->graph_file, + [clargs](auto const& file_) { + clargs->graph_file.emplace_back(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"); + ->type_name("PATH") + ->trigger_on_parse(); + app->add_option_function<std::string>( + "--dump-plain-graph", + [clargs](auto const& file_) { + clargs->graph_file_plain.emplace_back(file_); + }, + "File path for writing the action graph description to.") + ->type_name("PATH") + ->trigger_on_parse(); app->add_option("--dump-artifacts-to-build", clargs->artifacts_to_build_file, "File path for writing the artifacts to build to.") |