Make package field without a public_name an error in dune files

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-07-10 14:32:30 +01:00 committed by Jérémie Dimino
parent 81d053337f
commit 8c9c27fdc2
2 changed files with 8 additions and 3 deletions

View File

@ -1066,10 +1066,14 @@ module Executables = struct
(field_o "package" (junk >>> loc) >>= function
| None -> return (t, None)
| Some loc ->
Loc.warn loc
(Stanza.file_kind () >>| function
| Jbuild -> Loc.warn
| Dune -> Loc.fail) >>= fun func ->
func loc
"This field is useless without a (public_name%s ...) field."
(if multi then "s" else "");
return (t, None))
return (t, None)
)
| files ->
Pkg.field >>= fun package ->
return (t, Some { Install_conf. section = Bin; files; package })

View File

@ -17,7 +17,8 @@ argument of "package".
$ cd package-without-pub-name && dune build -p foo
File "dune", line 3, characters 1-14:
Warning: This field is useless without a (public_name ...) field.
Error: This field is useless without a (public_name ...) field.
[1]
$ cd package-without-pub-name-jbuild && dune build -p foo
File "jbuild", line 3, characters 2-15: