aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-04-23 08:23:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-04-24 18:32:07 +0200
commitc414abe13450e2b4e204f6368ba83c8916de1ebd (patch)
tree117cd370af6da7d4aec52d591c54cf9dffa89e86
parentd5d58307d5cbafde307b3e3173e734a0278f517d (diff)
Minor code reuse improvement
-rw-r--r--build2/config/operation.cxx41
-rw-r--r--build2/file.cxx2
-rw-r--r--build2/file.hxx9
3 files changed, 8 insertions, 44 deletions
diff --git a/build2/config/operation.cxx b/build2/config/operation.cxx
index ddbfc79..1e1ec94 100644
--- a/build2/config/operation.cxx
+++ b/build2/config/operation.cxx
@@ -419,43 +419,6 @@ namespace build2
// disfigure
//
- static void
- bootstrap_project (scope& root)
- {
- if (auto l = root.vars[var_subprojects])
- {
- const dir_path& out_root (root.out_path ());
- const dir_path& src_root (root.src_path ());
-
- for (auto p: cast<subprojects> (l))
- {
- const dir_path& pd (p.second);
-
- // Create and bootstrap subproject's root scope.
- //
- dir_path out_nroot (out_root / pd);
-
- // The same logic for src_root as in create_bootstrap_inner().
- //
- scope& nroot (create_root (root, out_nroot, dir_path ())->second);
-
- if (!bootstrapped (nroot))
- {
- bootstrap_out (nroot);
-
- value& val (nroot.assign (var_src_root));
-
- if (!val)
- val = is_src_root (out_nroot) ? out_nroot : (src_root / pd);
-
- setup_root (nroot);
- bootstrap_src (nroot);
- }
-
- bootstrap_project (nroot);
- }
- }
- }
static operation_id
disfigure_operation_pre (const values&, operation_id o)
@@ -479,9 +442,9 @@ namespace build2
// Since we don't load buildfiles during disfigure but still want to
// disfigure all the subprojects (see disfigure_project() below), we
- // bootstrap all known subprojects.
+ // bootstrap all the known subprojects.
//
- bootstrap_project (root);
+ create_bootstrap_inner (root);
}
static void
diff --git a/build2/file.cxx b/build2/file.cxx
index 5ffa59a..b0d202c 100644
--- a/build2/file.cxx
+++ b/build2/file.cxx
@@ -829,7 +829,7 @@ namespace build2
{
dir_path out_root (root.out_path () / p.second);
- if (!out_base.sub (out_root))
+ if (!out_base.empty () && !out_base.sub (out_root))
continue;
// The same logic to src_root as in create_bootstrap_outer().
diff --git a/build2/file.hxx b/build2/file.hxx
index f334d8c..a720d50 100644
--- a/build2/file.hxx
+++ b/build2/file.hxx
@@ -141,12 +141,13 @@ namespace build2
void
create_bootstrap_outer (scope& root);
- // Create and bootstrap inner root scopes between root and base,
- // if any. Return the innermost created root scope or root if
- // none were created. Loading is done by load_root_pre() below.
+ // Create and bootstrap inner root scopes between root and base, if any. If
+ // out_base is empty, then bootstrap all the way in. Return the innermost
+ // created root scope or root if none were created. Note: loading is done by
+ // load_root_pre() below.
//
scope&
- create_bootstrap_inner (scope& root, const dir_path& out_base);
+ create_bootstrap_inner (scope& root, const dir_path& out_base = dir_path ());
// Load project's root[-pre].build unless already loaded. Also
// make sure all outer root scopes are loaded prior to loading