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/parser.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'build/parser.cxx') diff --git a/build/parser.cxx b/build/parser.cxx index 2c629d6..343f5e1 100644 --- a/build/parser.cxx +++ b/build/parser.cxx @@ -37,18 +37,19 @@ namespace build typedef token_type type; void parser:: - parse_buildfile (istream& is, const path& p, scope& s) + parse_buildfile (istream& is, const path& p, scope& base, scope& root) { string rw (diag_relative_work (p)); path_ = &rw; lexer l (is, rw); lexer_ = &l; - scope_ = &s; + scope_ = &base; + root_ = &root; default_target_ = nullptr; - out_root_ = &s["out_root"].as (); - src_root_ = &s["src_root"].as (); + out_root_ = &root["out_root"].as (); + src_root_ = &root["src_root"].as (); token t (type::eos, false, 0, 0); type tt; @@ -477,7 +478,7 @@ namespace build p.normalize (); } - if (!include_.insert (p).second) + if (!root_->buildfiles.insert (p).second) { level4 ([&]{trace (l) << "skipping already included " << p;}); continue; @@ -955,7 +956,7 @@ namespace build lexer l (is, name); lexer_ = &l; - scope_ = root_scope; + scope_ = root_ = root_scope; // Turn on pairs recognition (e.g., src_root/=out_root/exe{foo bar}). // -- cgit v1.1