diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-01-26 16:57:57 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-01-30 11:38:45 +0100 |
commit | 0005677f3ca35f1535f4827433efcd04f3a5d731 (patch) | |
tree | 6b1f110c31aec7f503b5d3a968370792c7a1b6c5 /src | |
parent | 2c7ed6a93f6c28320343b2c5dc4990ae2d130832 (diff) | |
download | justbuild-0005677f3ca35f1535f4827433efcd04f3a5d731.tar.gz |
just-mr: add option to dump effective rc
Diffstat (limited to 'src')
-rw-r--r-- | src/other_tools/just_mr/cli.hpp | 4 | ||||
-rw-r--r-- | src/other_tools/just_mr/rc.cpp | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/other_tools/just_mr/cli.hpp b/src/other_tools/just_mr/cli.hpp index 130b7611..bcd5302a 100644 --- a/src/other_tools/just_mr/cli.hpp +++ b/src/other_tools/just_mr/cli.hpp @@ -46,6 +46,7 @@ struct MultiRepoCommonArguments { std::optional<std::string> main{std::nullopt}; std::optional<std::filesystem::path> rc_path{std::nullopt}; std::optional<std::filesystem::path> git_path{std::nullopt}; + std::optional<std::filesystem::path> dump_rc{std::nullopt}; bool norc{false}; std::size_t jobs{std::max(1U, std::thread::hardware_concurrency())}; std::vector<std::string> defines{}; @@ -208,6 +209,9 @@ static inline void SetupMultiRepoCommonArguments( fmt::format("Path to the git binary. (Default: {})", kDefaultGitPath)) ->type_name("PATH"); + app->add_option( + "--dump-rc", clargs->dump_rc, "Dump the effective rc value.") + ->type_name("PATH"); app->add_flag("--norc", clargs->norc, "Do not use any just-mrrc file."); app->add_option("-j, --jobs", clargs->jobs, diff --git a/src/other_tools/just_mr/rc.cpp b/src/other_tools/just_mr/rc.cpp index 320efca7..209e4be6 100644 --- a/src/other_tools/just_mr/rc.cpp +++ b/src/other_tools/just_mr/rc.cpp @@ -225,6 +225,14 @@ namespace { } } + // If requested, dump effective rc + if (clargs->common.dump_rc) { + auto dump_json = rc_config.ToJson(); + dump_json.erase("rc files"); + std::ofstream os(*clargs->common.dump_rc); + os << dump_json.dump(2) << std::endl; + } + // read local build root; overwritten if user provided it already if (not clargs->common.just_mr_paths->root) { auto build_root = |