From 4a23b4cdf3102a8fef8ac6ebd8a884cd613c28ee Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 26 Aug 2019 17:24:48 +0200 Subject: Implement auto-import of development build2 build --- libbuild2/file.cxx | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'libbuild2/file.cxx') diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx index 1c6bb1d..f0215df 100644 --- a/libbuild2/file.cxx +++ b/libbuild2/file.cxx @@ -1296,6 +1296,13 @@ namespace build2 { string n ("config.import." + proj.variable ()); + auto skip = [&target, &proj, &trace] () + { + target.proj = move (proj); + l5 ([&]{trace << "skipping " << target;}); + return make_pair (move (target), dir_path ()); + }; + // config.import. // { @@ -1318,11 +1325,7 @@ namespace build2 // to use system-installed). // if (out_root.empty ()) - { - target.proj = move (proj); - l5 ([&]{trace << "skipping " << target;}); - return make_pair (move (target), dir_path ()); - } + return skip (); break; } @@ -1383,6 +1386,26 @@ namespace build2 } } + // import.build2 + // + if (proj == "build2") + { + // Note that this variable can be set to NULL to disable relying on + // the built-in path. We use this in our tests to make sure we are + // importing and testing the build system being built and not the one + // doing the building. + // + if (auto l = iroot[ctx.var_import_build2]) + { + out_root = cast (l); + + if (out_root.empty ()) + return skip (); + + break; + } + } + // Otherwise search subprojects, starting with our root and then trying // outer roots for as long as we are inside an amalgamation. // -- cgit v1.1