Improve dependency path printing

This commit is contained in:
Jeremie Dimino 2017-03-15 11:49:31 +00:00
parent eb4c5a099f
commit 34a8951292
5 changed files with 14 additions and 10 deletions

View File

@ -142,18 +142,11 @@ module Build_error = struct
raise (E { backtrace; dep_path; exn })
end
let describe_target fn =
match Path.extract_build_context fn with
| Some (".aliases", dir) ->
sprintf "alias %s" (Path.to_string dir)
| _ ->
Path.to_string fn
let wait_for_file t fn ~targeting =
match Hashtbl.find t.files fn with
| None ->
if Path.is_in_build_dir fn then
die "no rule found for %s" (describe_target fn)
die "no rule found for %s" (Utils.describe_target fn)
else if Path.exists fn then
return ()
else

View File

@ -124,7 +124,7 @@ let report_error ?map_fname ppf exn =
if !Clflags.debug_dep_path then
Format.fprintf ppf "Dependency path:\n %s\n"
(String.concat ~sep:"\n--> "
(List.map (E.dependency_path err) ~f:Path.to_string))
(List.map (E.dependency_path err) ~f:Utils.describe_target))
| exn ->
let backtrace = Printexc.get_raw_backtrace () in
report_error ?map_fname ppf exn ~backtrace

View File

@ -66,3 +66,10 @@ let jbuild_name_in ~dir =
sprintf "%s (context %s)"
(Path.to_string (Path.relative dir "jbuild"))
ctx_name
let describe_target fn =
match Path.extract_build_context fn with
| Some (".aliases", dir) ->
sprintf "alias %s" (Path.to_string dir)
| _ ->
Path.to_string fn

View File

@ -11,3 +11,6 @@ val signal_name : int -> string
(** Return the path to the jbuild file in this directory as a string. *)
val jbuild_name_in : dir:Path.t -> string
(** Nice description of a target *)
val describe_target : Path.t -> string

View File

@ -23,4 +23,5 @@
(deps ((files_recursively_in workspaces/github24)))
(action
(chdir workspaces/github24
(run ${exe:run.exe} ${bin:jbuilder} build @install --root .)))))
(run ${exe:run.exe} ${bin:jbuilder}
build @install --root . --debug-dependency-path)))))