aboutsummaryrefslogtreecommitdiff
path: root/build2/config
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-03-28 09:14:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-03-28 16:03:35 +0200
commit3ce44330cca9dbc4314feebb27403ebc3175b6c2 (patch)
tree8c1f27442f3b2dafaec3ba50baaca3d5fd63dca7 /build2/config
parent9d0d078ff297138622cd2f3f1076f5984395e42b (diff)
New variable architecture
Diffstat (limited to 'build2/config')
-rw-r--r--build2/config/operation.cxx32
-rw-r--r--build2/config/utility.cxx2
2 files changed, 18 insertions, 16 deletions
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx
index 6199f8b..8047e61 100644
--- a/build2/config/operation.cxx
+++ b/build2/config/operation.cxx
@@ -86,7 +86,7 @@ namespace build2
if (auto l = root.vars["amalgamation"])
{
- const dir_path& d (as<dir_path> (*l));
+ const dir_path& d (cast<dir_path> (*l));
ofs << "# Base configuration inherited from " << d << endl
<< "#" << endl;
@@ -95,6 +95,8 @@ namespace build2
// Save all the variables in the config namespace that are set
// on the project's root scope.
//
+ names storage;
+
for (auto p (root.vars.find_namespace ("config"));
p.first != p.second;
++p.first)
@@ -115,7 +117,7 @@ namespace build2
if (n.size () > 11 &&
n.compare (n.size () - 11, 11, ".configured") == 0)
{
- if (val == nullptr || as<bool> (val))
+ if (val == nullptr || cast<bool> (val))
continue;
}
@@ -132,14 +134,11 @@ namespace build2
if (val)
{
- ofs << var.name << " = " << val.data_ << endl;
- //text << var.name << " = " << val.data_;
+ storage.clear ();
+ ofs << var.name << " = " << reverse (val, storage) << endl;
}
else
- {
ofs << var.name << " = #[null]" << endl; // @@ TODO: [null]
- //text << var.name << " = [null]";
- }
}
}
catch (const ofstream::failure&)
@@ -189,7 +188,7 @@ namespace build2
//
if (auto l = root.vars["subprojects"])
{
- for (auto p: as<subprojects> (*l))
+ for (auto p: cast<subprojects> (*l))
{
const dir_path& pd (p.second);
dir_path out_nroot (out_root / pd);
@@ -314,7 +313,7 @@ namespace build2
//
if (auto l = root.vars["subprojects"])
{
- for (auto p: as<subprojects> (*l))
+ for (auto p: cast<subprojects> (*l))
{
const dir_path& pd (p.second);
@@ -325,16 +324,19 @@ namespace build2
// The same logic for src_root as in create_bootstrap_inner().
//
scope& nroot (create_root (out_nroot, dir_path ()));
- bootstrap_out (nroot);
- value& val (nroot.assign ("src_root"));
+ if (!bootstrapped (nroot))
+ {
+ bootstrap_out (nroot);
- if (!val)
- val = is_src_root (out_nroot) ? out_nroot : (src_root / pd);
+ value& val (nroot.assign ("src_root"));
- setup_root (nroot);
+ if (!val)
+ val = is_src_root (out_nroot) ? out_nroot : (src_root / pd);
- bootstrap_src (nroot);
+ setup_root (nroot);
+ bootstrap_src (nroot);
+ }
m = disfigure_project (a, nroot) || m;
diff --git a/build2/config/utility.cxx b/build2/config/utility.cxx
index d27e1ff..e96a896 100644
--- a/build2/config/utility.cxx
+++ b/build2/config/utility.cxx
@@ -43,7 +43,7 @@ namespace build2
if (v && !v.empty ())
{
- dir_path& d (as<dir_path> (v));
+ dir_path& d (cast<dir_path> (v));
if (d.relative ())
{