diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-02-14 11:15:36 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-02-14 11:15:36 +0200 |
commit | 4c1b2f072bcc41c00990331245e479a55b0990ff (patch) | |
tree | 1c63a4d02a464ed0e5a6a182780619b1899574b5 /build2/b.cxx | |
parent | 5fc7471c034c367ff5ad776c2b9d7698678266c9 (diff) |
Factor reusable code to contex::enter_project_overrides()
Diffstat (limited to 'build2/b.cxx')
-rw-r--r-- | build2/b.cxx | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/build2/b.cxx b/build2/b.cxx index bb09675..c094523 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -1580,62 +1580,7 @@ main (int argc, char* argv[]) // boundaries (specifically, amalgamation) are only known after // bootstrap. // - // The mildly tricky part here is to distinguish the situation where - // we are bootstrapping the same project multiple times. The first - // override that we set cannot already exist (because the override - // variable names are unique) so if it is already set, then it can - // only mean this project is already bootstrapped. - // - // This is further complicated by the project vs amalgamation logic - // (we may have already done the amalgamation but not the project). - // So we split it into two passes. - // - { - auto& sm (ctx.scopes.rw ()); - - for (const variable_override& o: ctx.var_overrides) - { - if (o.ovr.visibility != variable_visibility::global) - continue; - - // If we have a directory, enter the scope, similar to how we do - // it in the context ctor. - // - scope& s ( - o.dir - ? *sm.insert_out ((out_base / *o.dir).normalize ())->second.front () - : *rs.weak_scope ()); - - auto p (s.vars.insert (o.ovr)); - - if (!p.second) - break; - - value& v (p.first); - v = o.val; - } - - for (const variable_override& o: ctx.var_overrides) - { - // Ours is either project (%foo) or scope (/foo). - // - if (o.ovr.visibility == variable_visibility::global) - continue; - - scope& s ( - o.dir - ? *sm.insert_out ((out_base / *o.dir).normalize ())->second.front () - : rs); - - auto p (s.vars.insert (o.ovr)); - - if (!p.second) - break; - - value& v (p.first); - v = o.val; - } - } + ctx.enter_project_overrides (rs, out_base, ctx.var_overrides); ts.root_scope = &rs; ts.out_base = move (out_base); |