aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-10-15 07:10:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-10-15 07:10:25 +0200
commit3007f3f9225b9de424bfa62ec2ac87b63202f2de (patch)
tree91fd7449e806e181d5971d50d4750ccde7315681
parent8b3b4f62e55f8a795d893eeb7415ba1318da237f (diff)
Allow explicit amalgamation by simple projects
-rw-r--r--libbuild2/file.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index 1eb20ad..c93a86f 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -1039,13 +1039,6 @@ namespace build2
scope* ars (rs.parent_scope ()->root_scope ());
- // We must not be amalgamated by a simple project.
- //
- auto simple = [ars] ()
- {
- return ars->root_extra->project && *ars->root_extra->project == nullptr;
- };
-
if (rp.second)
{
// If the amalgamation variable hasn't been set, then we need to check
@@ -1088,6 +1081,9 @@ namespace build2
// If we have the amalgamation variable set by the user, verify that
// it's a subdirectory of the outer root scope.
//
+ // Note that in this case we allow amalgamation by a simple project
+ // (we rely on this, for example, in our modules sidebuild machinery).
+ //
if (!rp.second)
{
if (v)
@@ -1096,11 +1092,14 @@ namespace build2
dir_path d (out_root / vd);
d.normalize ();
- if (!d.sub (ad) || (simple () && d == ad))
+ if (!d.sub (ad))
fail << "incorrect amalgamation " << vd << " of " << out_root;
}
}
- else if (!simple ())
+ // By default we do not get amalgamated by a simple project.
+ //
+ else if (!(ars->root_extra->project &&
+ *ars->root_extra->project == nullptr))
{
// Otherwise, use the outer root as our amalgamation.
//