From b611e797ad9db9794f4d151f454fa731d12b0bd3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 14 Nov 2018 13:08:29 +0200 Subject: Fallback to loading outer buildfile if there isn't one in src_base This covers the case where the target is defined in the outer buildfile which is common with non-intrusive project conversions where everything is built from a single root buildfile. --- build2/operation.cxx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'build2/operation.cxx') diff --git a/build2/operation.cxx b/build2/operation.cxx index aa92756..03d0476 100644 --- a/build2/operation.cxx +++ b/build2/operation.cxx @@ -94,6 +94,7 @@ namespace build2 search (const values&, const scope&, const scope& bs, + const path& bf, const target_key& tk, const location& l, action_targets& ts) @@ -104,11 +105,23 @@ namespace build2 const target* t (targets.find (tk, trace)); - if (t == nullptr && tk.is_a ()) + // Only do the implied buildfile if we haven't loaded one. Failed that we + // may try go this route even though we've concluded the implied buildfile + // is implausible and have loaded an outer buildfile (see main() for + // details). + // + if (t == nullptr && tk.is_a () && bf.empty ()) t = dir::search_implied (bs, tk, trace); if (t == nullptr) - fail (l) << "unknown target " << tk; + { + diag_record dr (fail (l)); + + dr << "unknown target " << tk; + + if (!bf.empty ()) + dr << " in " << bf; + } ts.push_back (t); } @@ -463,6 +476,7 @@ namespace build2 info_search (const values&, const scope& rs, const scope&, + const path&, const target_key& tk, const location& l, action_targets& ts) -- cgit v1.1