From 3813b05824fa2616b8ab9c18ed158c0c02265337 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Apr 2018 12:01:09 +0200 Subject: Add support for build hooks The following buildfiles are loaded (if present) at appropriate times from the out_root subdirectories of a project: build/bootstrap/pre-*.build # before loading bootstrap.build build/bootstrap/post-*.build # after loading bootstrap.build build/root/pre-*.build # before loading root.build build/root/post-*.build # after loading root.build --- build2/b.cxx | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'build2/b.cxx') diff --git a/build2/b.cxx b/build2/b.cxx index e427237..6921a97 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -822,9 +822,9 @@ main (int argc, char* argv[]) scope& rs ( create_root (*scope::global_, out_root, src_root)->second); - bool bootstrapped (build2::bootstrapped (rs)); + bool bstrapped (bootstrapped (rs)); - if (!bootstrapped) + if (!bstrapped) { bootstrap_out (rs); @@ -860,22 +860,27 @@ main (int argc, char* argv[]) v = src_root; } - setup_root (rs); + setup_root (rs, forwarded); // Now that we have src_root, load the src_root bootstrap file, // if there is one. // - bootstrapped = bootstrap_src (rs); + bootstrap_pre (rs); + bootstrap_src (rs); + // bootstrap_post() delayed until after create_bootstrap_outer(). } - else if (src_root.empty ()) - src_root = rs.src_path (); + else + { + if (src_root.empty ()) + src_root = rs.src_path (); - // Note that we only "upgrade" the forwarded value since the same - // project root can be arrived at via multiple paths (think command - // line and import). - // - if (forwarded) - rs.assign (var_forwarded) = true; + // Note that we only "upgrade" the forwarded value since the same + // project root can be arrived at via multiple paths (think + // command line and import). + // + if (forwarded) + rs.assign (var_forwarded) = true; + } // At this stage we should have both roots and out_base figured // out. If src_base is still undetermined, calculate it. @@ -917,6 +922,9 @@ main (int argc, char* argv[]) // create_bootstrap_outer (rs); + if (!bstrapped) + bootstrap_post (rs); + // The src bootstrap should have loaded all the modules that // may add new meta/operations. So at this stage they should // all be known. We store the combined action id in uint8_t; -- cgit v1.1