From 136afdbb1232f0546a2b013fd08cfe8278722ef2 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 29 Sep 2020 21:12:03 +0300 Subject: Add ext_mods parameter to b_info() --- libbutl/b.cxx | 2 ++ libbutl/b.mxx | 6 ++++++ libbutl/utility.mxx | 2 +- tests/b-info/driver.cxx | 7 ++++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/libbutl/b.cxx b/libbutl/b.cxx index a071bba..e1caa4c 100644 --- a/libbutl/b.cxx +++ b/libbutl/b.cxx @@ -73,6 +73,7 @@ namespace butl b_project_info b_info (const dir_path& project, + bool ext_mods, uint16_t verb, const function& cmd_callback, const path& program, @@ -111,6 +112,7 @@ namespace butl 2 /* stderr */, pp, vops, + ext_mods ? nullptr : "--no-external-modules", "-s", ops, "info:", "'" + project.representation () + "'"); diff --git a/libbutl/b.mxx b/libbutl/b.mxx index 6eaf473..9e12711 100644 --- a/libbutl/b.mxx +++ b/libbutl/b.mxx @@ -67,6 +67,11 @@ LIBBUTL_MODEXPORT namespace butl // Run `b info: ` command and parse and return the build2 // project information it prints to stdout. Throw b_error on 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. @@ -101,6 +106,7 @@ LIBBUTL_MODEXPORT namespace butl LIBBUTL_SYMEXPORT b_project_info b_info (const dir_path& project, + bool ext_mods, std::uint16_t verb = 1, const std::function& cmd_callback = {}, const path& program = path ("b"), diff --git a/libbutl/utility.mxx b/libbutl/utility.mxx index a59686b..8a0059a 100644 --- a/libbutl/utility.mxx +++ b/libbutl/utility.mxx @@ -271,7 +271,7 @@ LIBBUTL_MODEXPORT namespace butl // Throw system_error on failure. // - // Note that on Windows setting an empty value usets the variable. + // Note that on Windows setting an empty value unsets the variable. // LIBBUTL_SYMEXPORT void setenv (const std::string& name, const std::string& value); diff --git a/tests/b-info/driver.cxx b/tests/b-info/driver.cxx index 6a3e0a4..3ecfbc0 100644 --- a/tests/b-info/driver.cxx +++ b/tests/b-info/driver.cxx @@ -63,10 +63,11 @@ try cout.exceptions (ios::failbit | ios::badbit); b_project_info pi (b_info (project, - 1 /* verb */, - {} /* cmd_callback */, + true /* ext_mods */, + 1 /* verb */, + {} /* cmd_callback */, b, - {} /* search_fallback */, + {} /* search_fallback */, {"--no-default-options"})); cout << "project: " << pi.project << endl -- cgit v1.1