From 3007f3f9225b9de424bfa62ec2ac87b63202f2de Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 15 Oct 2021 07:10:25 +0200 Subject: Allow explicit amalgamation by simple projects --- libbuild2/file.cxx | 17 ++++++++--------- 1 file 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. // -- cgit v1.1