From 8cc86445437e7afc583dee18b36c0e8ba4b6fe12 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 12 Dec 2022 18:35:08 +0300 Subject: Add support for omitting sub-projects from b_info() result --- libbutl/b.hxx | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'libbutl/b.hxx') diff --git a/libbutl/b.hxx b/libbutl/b.hxx index cc3a309..d3fd2bf 100644 --- a/libbutl/b.hxx +++ b/libbutl/b.hxx @@ -51,11 +51,6 @@ namespace butl // result vector can be used to determine which project information caused // the error. // - // Unless you need information that may come from external modules - // (operations, meta-operations, etc), pass false as the ext_mods argument, - // which results in passing --no-external-modules to the build2 program and - // speeds up its execution. - // // You can also specify the build2 verbosity level, command line callback // (see process_run_callback() for details), build program search details, // and additional options. @@ -92,12 +87,35 @@ namespace butl std::vector modules; }; + enum class b_info_flags: std::uint16_t + { + // Retrieve information that may come from external modules (operations, + // meta-operations, etc). Omitting this flag results in passing + // --no-external-modules to the build2 program and speeds up its + // execution. + // + ext_mods = 0x1, + + // Discover subprojects. Omitting this flag results in passing + // no_subprojects info meta-operation parameter to the build2 program and + // speeds up its execution. + // + subprojects = 0x2, + + none = 0 + }; + + inline b_info_flags operator& (b_info_flags, b_info_flags); + inline b_info_flags operator| (b_info_flags, b_info_flags); + inline b_info_flags operator&= (b_info_flags&, b_info_flags); + inline b_info_flags operator|= (b_info_flags&, b_info_flags); + using b_callback = void (const char* const args[], std::size_t n); LIBBUTL_SYMEXPORT void b_info (std::vector& result, const std::vector& projects, - bool ext_mods, + b_info_flags, std::uint16_t verb = 1, const std::function& cmd_callback = {}, const path& program = path ("b"), @@ -108,7 +126,7 @@ namespace butl // inline b_project_info b_info (const dir_path& project, - bool ext_mods, + b_info_flags fl, std::uint16_t verb = 1, const std::function& cmd_callback = {}, const path& program = path ("b"), @@ -118,7 +136,7 @@ namespace butl std::vector r; b_info (r, std::vector ({project}), - ext_mods, + fl, verb, cmd_callback, program, @@ -128,3 +146,5 @@ namespace butl return std::move (r[0]); } } + +#include -- cgit v1.1