Let Report_error print the location for Private_deps_not_allowed

This commit is contained in:
Jeremie Dimino 2018-03-12 17:58:54 +00:00
parent 178e26cfd9
commit 7e361d596e
2 changed files with 8 additions and 7 deletions

View File

@ -1147,11 +1147,10 @@ let report_lib_error ppf (e : Error.t) =
Format.fprintf ppf "-> %S in %s"
name (Path.to_string_maybe_quoted path)))
cycle
| Private_deps_not_allowed (t : private_deps_not_allowed) ->
| Private_deps_not_allowed t ->
Format.fprintf ppf
"%a@{<error>Error@}: Library %S is private, it cannot be a dependency of\
"@{<error>Error@}: Library %S is private, it cannot be a dependency of \
a public library.\nYou need to give %S a public name.\n"
Loc.print t.pd_loc
t.private_dep.name
t.private_dep.name
@ -1167,6 +1166,8 @@ let () =
| [] -> (* during bootstrap *) None
| l ->
Some (List.map l ~f:quote_for_shell |> String.concat ~sep:" "))
| Private_deps_not_allowed t ->
(Some t.pd_loc, None)
| _ -> (None, None)
in
Some

View File

@ -2,8 +2,8 @@ public libraries may not have private dependencies
$ $JBUILDER build -j1 --display short --root private-dep 2>&1 | grep -v Entering
File "jbuild", line 1, characters 0-155:
Error: Library "privatelib" is private, it cannot be a dependency ofa public library. You need to give "privatelib" a public name
-> required by library "publiclib" in _build/default
Error: Library "privatelib" is private, it cannot be a dependency of a public library.
You need to give "privatelib" a public name.
ocamldep publiclib.ml.d
On the other hand, public libraries may have private preprocessors
@ -23,8 +23,8 @@ On the other hand, public libraries may have private preprocessors
Unless they introduce private runtime dependencies:
$ $JBUILDER build -j1 --display short --root private-runtime-deps 2>&1 | grep -v Entering
File "jbuild", line 8, characters 1-143:
Error: Library "private_runtime_dep" is private, it cannot be a dependency ofa public library. You need to give "private_runtime_dep" a public name
-> required by library "mylib" in _build/default
Error: Library "private_runtime_dep" is private, it cannot be a dependency of a public library.
You need to give "private_runtime_dep" a public name.
ocamlc .private_ppx.objs/private_ppx.{cmi,cmo,cmt}
ocamlopt .private_ppx.objs/private_ppx.{cmx,o}
ocamlopt private_ppx.{a,cmxa}