Improve error message for undefined aliases

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-06-28 12:49:43 +01:00 committed by Jérémie Dimino
parent 30db63ef71
commit 0a970aba35
1 changed files with 12 additions and 3 deletions

View File

@ -675,9 +675,9 @@ let no_rule_found =
die "No rule found for %s" (Utils.describe_target fn)
in
fun t fn ->
match Path.extract_build_context fn with
| None -> fail fn
| Some (ctx, _) ->
match Utils.analyse_target fn with
| Other _ -> fail fn
| Regular (ctx, _) ->
if String.Map.mem t.contexts ctx then
fail fn
else
@ -685,6 +685,15 @@ let no_rule_found =
(Path.to_string_maybe_quoted fn)
ctx
(hint ctx (String.Map.keys t.contexts))
| Alias (ctx, fn') ->
if String.Map.mem t.contexts ctx then
fail fn
else
let fn = Path.append (Path.relative Path.build_dir ctx) fn' in
die "Trying to build alias %s but build context %s doesn't exist.%s"
(Path.to_string_maybe_quoted fn)
ctx
(hint ctx (String.Map.keys t.contexts))
let rec compile_rule t ?(copy_source=false) pre_rule =
let { Pre_rule.