aboutsummaryrefslogtreecommitdiff
path: root/build2/cli
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-11 07:57:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-11 07:57:19 +0200
commit0342dc2fcdd78ef28a4e59d84193a3807068d726 (patch)
treee750c3062d6ff54f0d409fe1a25984b7e78592c8 /build2/cli
parent5f7c3f923de106f9d204a8f3500274731ae84fd9 (diff)
New configuration logic, iteration 1
Diffstat (limited to 'build2/cli')
-rw-r--r--build2/cli/module2
-rw-r--r--build2/cli/module.cxx29
2 files changed, 13 insertions, 18 deletions
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<module>&, bool, bool);
+ scope&, scope&, const location&, unique_ptr<module_base>&, 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<module>&,
+ unique_ptr<module_base>&,
bool first,
bool optional)
{
@@ -55,13 +55,11 @@ namespace build2
{
auto& v (var_pool);
- // @@ OVR
-
- v.insert<bool> ("config.cli.configured");
-
- v.insert<path> ("config.cli");
+ // Note: some overridable, some not.
+ //
+ v.insert<path> ("config.cli", true);
+ v.insert<strings> ("config.cli.options", true);
- v.insert<strings> ("config.cli.options");
v.insert<strings> ("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<bool> (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<strings> (v);
+ base.assign ("cli.options") += cast_null<strings> (
+ config::optional (root, "config.cli.options"));
// Register our rules.
//