From fa6f9986dd73627643469c238b32dd92607f5214 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 9 Mar 2015 09:45:25 +0200 Subject: Add support for skipping already loaded/included buildfiles at top level The idea is that a buildfile shall be included/loaded only once for any given out_root. --- build/b.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'build/b.cxx') diff --git a/build/b.cxx b/build/b.cxx index 0a1d8d2..ce10b22 100644 --- a/build/b.cxx +++ b/build/b.cxx @@ -269,7 +269,7 @@ main (int argc, char* argv[]) if (verb >= 4) { - trace << tn; + trace << tn << ':'; trace << " out_base: " << out_base.string (); trace << " src_base: " << src_base.string (); trace << " out_root: " << out_root.string (); @@ -293,6 +293,16 @@ main (int argc, char* argv[]) // path bf (src_base / path ("buildfile")); + // Check if this buildfile has already been loaded. + // + if (!proot_scope.buildfiles.insert (bf).second) + { + level4 ([&]{trace << "skipping already loaded " << bf;}); + continue; + } + + level4 ([&]{trace << "loading " << bf;}); + ifstream ifs (bf.string ()); if (!ifs.is_open ()) fail << "unable to open " << bf; @@ -302,7 +312,7 @@ main (int argc, char* argv[]) try { - p.parse_buildfile (ifs, bf, pbase_scope); + p.parse_buildfile (ifs, bf, pbase_scope, proot_scope); } catch (const std::ios_base::failure&) { -- cgit v1.1