Make invalid public name warn when (wrapped false)
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
c08cec1f4b
commit
5706e4ee56
|
@ -925,12 +925,20 @@ module Library = struct
|
||||||
in
|
in
|
||||||
let name =
|
let name =
|
||||||
match name, public with
|
match name, public with
|
||||||
| Some n, _ -> n
|
| Some n, _ -> Lib_name.to_string n
|
||||||
| None, Some { name = (loc, name) ; _ } ->
|
| None, Some { name = (loc, name) ; _ } ->
|
||||||
if dune_version >= (1, 1) then
|
if dune_version >= (1, 1) then
|
||||||
match Lib_name.of_string name with
|
match Lib_name.of_string name, wrapped with
|
||||||
| Some n -> n
|
| Some n, _ -> Lib_name.to_string n
|
||||||
| None ->
|
| None, false ->
|
||||||
|
Loc.warn loc
|
||||||
|
"%s.\n\
|
||||||
|
This is temporary allowed for libraries with (wrapped false).\
|
||||||
|
\nIt will not be supported in the future. \
|
||||||
|
Please choose a valid name field."
|
||||||
|
Lib_name.error_message;
|
||||||
|
name
|
||||||
|
| None, true ->
|
||||||
of_sexp_errorf loc
|
of_sexp_errorf loc
|
||||||
"%s.\n\
|
"%s.\n\
|
||||||
Public library names don't have this restriction. \
|
Public library names don't have this restriction. \
|
||||||
|
@ -948,7 +956,7 @@ module Library = struct
|
||||||
"name field is missing"
|
"name field is missing"
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
{ name = Lib_name.to_string name
|
{ name
|
||||||
; public
|
; public
|
||||||
; synopsis
|
; synopsis
|
||||||
; install_c_headers
|
; install_c_headers
|
||||||
|
|
|
@ -33,7 +33,8 @@ it's just a warning
|
||||||
$ dune build --root public-name-invalid-wrapped-false
|
$ dune build --root public-name-invalid-wrapped-false
|
||||||
Info: creating file dune-project with this contents: (lang dune 1.1)
|
Info: creating file dune-project with this contents: (lang dune 1.1)
|
||||||
File "dune", line 3, characters 14-21:
|
File "dune", line 3, characters 14-21:
|
||||||
Error: invalid library name.
|
Warning: invalid library name.
|
||||||
Hint: library names must be non-empty and composed only of the following characters: 'A'..'Z', 'a'..'z', '_' or '0'..'9'.
|
Hint: library names must be non-empty and composed only of the following characters: 'A'..'Z', 'a'..'z', '_' or '0'..'9'.
|
||||||
Public library names don't have this restriction. You can either change this public name to be a valid library name or add a "name" field with a valid library name.
|
This is temporary allowed for libraries with (wrapped false).
|
||||||
[1]
|
It will not be supported in the future. Please choose a valid name field.
|
||||||
|
Entering directory 'public-name-invalid-wrapped-false'
|
||||||
|
|
Loading…
Reference in New Issue