aboutsummaryrefslogtreecommitdiff
path: root/build/cli/module.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-12-03 14:37:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-12-03 14:37:22 +0200
commit29f8159583d2b02efa2afeaa58082f57222c943d (patch)
tree1fa520de084c6c0dacc8af6525b58b294f1e9eae /build/cli/module.cxx
parent772b1e013bb0068d7347d0bbe2ff73c67358ee1b (diff)
Add ability for module to remember that it is unconfigured
A module can set and then check the config.*.configured special variable to false.
Diffstat (limited to 'build/cli/module.cxx')
-rw-r--r--build/cli/module.cxx40
1 files changed, 28 insertions, 12 deletions
diff --git a/build/cli/module.cxx b/build/cli/module.cxx
index 7ce4235..c44d670 100644
--- a/build/cli/module.cxx
+++ b/build/cli/module.cxx
@@ -65,6 +65,8 @@ namespace build
//
if (first)
{
+ var_pool.find ("config.cli.configured", bool_type);
+
var_pool.find ("config.cli", string_type); //@@ VAR type
var_pool.find ("config.cli.options", strings_type);
@@ -73,17 +75,26 @@ namespace build
// Configure.
//
- // The plan is as follows: try to configure the module. If this
- // fails with the default values and the module is optional,
- // leave it unconfigured.
+ // The plan is as follows: try to configure the module. If this fails,
+ // we are using default values, and the module is optional, leave it
+ // unconfigured.
//
- bool r (true);
// We will only honor optional if the user didn't specify any cli
// configuration explicitly.
//
optional = optional && !config::specified (root, "config.cli");
+ // Don't re-run tests if the configuration says we are unconfigured.
+ //
+ if (optional)
+ {
+ auto l (root["config.cli.configured"]);
+
+ if (l && !as<bool> (*l))
+ return false;
+ }
+
// config.cli
//
if (first)
@@ -148,10 +159,15 @@ namespace build
if (ver.empty ())
{
- r = false;
+ // Note that we are unconfigured so that we don't keep re-testing
+ // this on each run.
+ //
+ root.assign ("config.cli.configured") = false;
if (verb >= 2)
text << cli << " not found, leaving cli module unconfigured";
+
+ return false;
}
else
{
@@ -175,6 +191,10 @@ namespace build
}
}
+ // Clear the unconfigured flag, if any.
+ //
+ root.assign ("config.cli.configured") = true;
+
if (!ver.empty () && verb >= 2)
text << cli << " " << ver;
}
@@ -185,15 +205,11 @@ namespace build
// cli.* variables. See the cxx module for more information on
// this merging semantics and some of its tricky aspects.
//
- if (r)
- {
- if (const value& v = config::optional (root, "config.cli.options"))
- base.assign ("cli.options") += as<strings> (v);
- }
+ if (const value& v = config::optional (root, "config.cli.options"))
+ base.assign ("cli.options") += as<strings> (v);
// Register our rules.
//
- if (r)
{
auto& rs (base.rules);
@@ -216,7 +232,7 @@ namespace build
rs.insert<cli_cxx> (configure_id, update_id, "cli", compile_);
}
- return r;
+ return true;
}
}
}