From 0342dc2fcdd78ef28a4e59d84193a3807068d726 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 11 Apr 2016 07:57:19 +0200 Subject: New configuration logic, iteration 1 --- build2/cli/module | 2 +- build2/cli/module.cxx | 29 ++++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'build2/cli') diff --git a/build2/cli/module b/build2/cli/module index ab629f1..0469b2c 100644 --- a/build2/cli/module +++ b/build2/cli/module @@ -16,7 +16,7 @@ namespace build2 { extern "C" bool cli_init ( - scope&, scope&, const location&, unique_ptr&, bool, bool); + scope&, scope&, const location&, unique_ptr&, bool, bool); } } diff --git a/build2/cli/module.cxx b/build2/cli/module.cxx index bf975e7..7b98e93 100644 --- a/build2/cli/module.cxx +++ b/build2/cli/module.cxx @@ -29,7 +29,7 @@ namespace build2 cli_init (scope& root, scope& base, const location& loc, - unique_ptr&, + unique_ptr&, bool first, bool optional) { @@ -55,13 +55,11 @@ namespace build2 { auto& v (var_pool); - // @@ OVR - - v.insert ("config.cli.configured"); - - v.insert ("config.cli"); + // Note: some overridable, some not. + // + v.insert ("config.cli", true); + v.insert ("config.cli.options", true); - v.insert ("config.cli.options"); v.insert ("cli.options"); } @@ -88,13 +86,8 @@ namespace build2 // Don't re-run tests if the configuration says we are unconfigured. // - if (optional) - { - auto l (root["config.cli.configured"]); - - if (l && !cast (l)) + if (optional && config::unconfigured (root, "config.cli")) return false; - } // config.cli // @@ -167,7 +160,7 @@ namespace build2 // Note that we are unconfigured so that we don't keep re-testing // this on each run. // - root.assign ("config.cli.configured") = false; + config::unconfigured (root, "config.cli", true); if (verb >= 2) text << cli << " not found, leaving cli module unconfigured"; @@ -198,7 +191,9 @@ namespace build2 // Clear the unconfigured flag, if any. // - root.assign ("config.cli.configured") = true; + // @@ Get rid of needing to do this. + // + config::unconfigured (root, "config.cli", false); if (!ver.empty () && verb >= 2) text << cli << " " << ver; @@ -210,8 +205,8 @@ namespace build2 // cli.* variables. See the cxx module for more information on // this merging semantics and some of its tricky aspects. // - if (const value& v = config::optional (root, "config.cli.options")) - base.assign ("cli.options") += cast (v); + base.assign ("cli.options") += cast_null ( + config::optional (root, "config.cli.options")); // Register our rules. // -- cgit v1.1