aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-07-03 16:23:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-07-03 16:23:49 +0200
commit736812cb586e0f80742337dce802ad24adf331ad (patch)
tree96d5e5e35d4409804b04117a623f9b25ff1bb03f /libbuild2
parentde97813722312ee64f0cb666eeb931d179a09ecc (diff)
Cutoff amalgamation and subproject for simple projects
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/file.cxx75
-rw-r--r--libbuild2/file.hxx5
2 files changed, 37 insertions, 43 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index a5ff070..f74dcb5 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -444,12 +444,7 @@ namespace build2
// do this before figuring out src_base since we may switch the root
// project (and src_root with it).
//
- {
- scope* nrs (&create_bootstrap_inner (*rs, out_base));
-
- if (rs != nrs)
- rs = nrs;
- }
+ rs = &create_bootstrap_inner (*rs, out_base);
// Switch to the new root scope.
//
@@ -817,7 +812,7 @@ namespace build2
}
}
- bool
+ void
bootstrap_src (scope& rs, optional<bool>& altn)
{
tracer trace ("bootstrap_src");
@@ -839,11 +834,14 @@ namespace build2
setup_root_extra (rs, altn);
}
- bool r (true);
- if (bf.empty ())
+ bool simple (bf.empty ());
+
+ if (simple)
{
- r = false;
- rs.root_extra->project = nullptr; // Simple project.
+ // Simple project: no name and disabled amalgamation.
+ //
+ rs.root_extra->project = nullptr;
+ rs.root_extra->amalgamation = nullptr;
}
// We assume that bootstrap out cannot load this file explicitly. It
// feels wrong to allow this since that makes the whole bootstrap
@@ -925,6 +923,7 @@ namespace build2
//
// Note: the amalgamation variable value is always a relative directory.
//
+ if (!simple)
{
auto rp (rs.vars.insert (*ctx.var_amalgamation)); // Set NULL by default.
value& v (rp.first);
@@ -934,41 +933,38 @@ namespace build2
if (scope* ars = rs.parent_scope ()->root_scope ())
{
- const dir_path& ad (ars->out_path ());
- dir_path rd (ad.relative (out_root));
-
- // If we already have the amalgamation variable set, verify that aroot
- // matches its value.
+ // We must not be amalgamated by a simple project.
//
- if (!rp.second)
+ if (!ars->root_extra->project || *ars->root_extra->project != nullptr)
{
- /* @@ TMP
- if (!v)
+ const dir_path& ad (ars->out_path ());
+ dir_path rd (ad.relative (out_root));
+
+ // If we already have the amalgamation variable set, verify that
+ // aroot matches its value.
+ //
+ if (!rp.second)
{
- fail << out_root << " cannot be amalgamated" <<
- info << "amalgamated by " << ad;
+ if (v)
+ {
+ const dir_path& vd (cast<dir_path> (v));
+
+ if (vd != rd)
+ {
+ fail << "inconsistent amalgamation of " << out_root <<
+ info << "specified: " << vd <<
+ info << "actual: " << rd << " by " << ad;
+ }
+ }
}
else
- */
- if (v)
{
- const dir_path& vd (cast<dir_path> (v));
-
- if (vd != rd)
- {
- fail << "inconsistent amalgamation of " << out_root <<
- info << "specified: " << vd <<
- info << "actual: " << rd << " by " << ad;
- }
+ // Otherwise, use the outer root as our amalgamation.
+ //
+ l5 ([&]{trace << out_root << " amalgamated as " << rd;});
+ v = move (rd);
}
}
- else
- {
- // Otherwise, use the outer root as our amalgamation.
- //
- l5 ([&]{trace << out_root << " amalgamated as " << rd;});
- v = move (rd);
- }
}
else if (rp.second)
{
@@ -1010,6 +1006,7 @@ namespace build2
// then we have to figure it out. When subprojects are calculated, the
// NULL value indicates that we found no subprojects.
//
+ if (!simple)
{
auto rp (rs.vars.insert (*ctx.var_subprojects)); // Set NULL by default.
value& v (rp.first);
@@ -1127,8 +1124,6 @@ namespace build2
}
}
}
-
- return r;
}
void
diff --git a/libbuild2/file.hxx b/libbuild2/file.hxx
index f64f130..856a248 100644
--- a/libbuild2/file.hxx
+++ b/libbuild2/file.hxx
@@ -161,10 +161,9 @@ namespace build2
LIBBUILD2_SYMEXPORT value&
bootstrap_out (scope& root, optional<bool>& altn);
- // Bootstrap the project's root scope, the src part. Return true if we
- // loaded anything (which confirms the src_root is not bogus).
+ // Bootstrap the project's root scope, the src part.
//
- LIBBUILD2_SYMEXPORT bool
+ LIBBUILD2_SYMEXPORT void
bootstrap_src (scope& root, optional<bool>& altn);
// Return true if this scope has already been bootstrapped, that is, the