aboutsummaryrefslogtreecommitdiff
path: root/build2/operation.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-11-14 13:08:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-11-14 13:08:29 +0200
commitb611e797ad9db9794f4d151f454fa731d12b0bd3 (patch)
treeb202ef1d894a313fb791d5f0af254f67d2ae84b7 /build2/operation.cxx
parent6c3d3f62f8560cbb8d1e983a8dd8cc98266bfe37 (diff)
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.
Diffstat (limited to 'build2/operation.cxx')
-rw-r--r--build2/operation.cxx18
1 files changed, 16 insertions, 2 deletions
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<dir> ())
+ // 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<dir> () && 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)