diff --git a/src/jbuild.ml b/src/jbuild.ml index bdbd5c13..269bb0b2 100644 --- a/src/jbuild.ml +++ b/src/jbuild.ml @@ -925,12 +925,20 @@ module Library = struct in let name = match name, public with - | Some n, _ -> n + | Some n, _ -> Lib_name.to_string n | None, Some { name = (loc, name) ; _ } -> if dune_version >= (1, 1) then - match Lib_name.of_string name with - | Some n -> n - | None -> + match Lib_name.of_string name, wrapped with + | Some n, _ -> Lib_name.to_string n + | 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 "%s.\n\ Public library names don't have this restriction. \ @@ -948,7 +956,7 @@ module Library = struct "name field is missing" ) in - { name = Lib_name.to_string name + { name ; public ; synopsis ; install_c_headers diff --git a/test/blackbox-tests/test-cases/no-name-field/run.t b/test/blackbox-tests/test-cases/no-name-field/run.t index a25f890b..e35fbc5d 100644 --- a/test/blackbox-tests/test-cases/no-name-field/run.t +++ b/test/blackbox-tests/test-cases/no-name-field/run.t @@ -33,7 +33,8 @@ it's just a warning $ dune build --root public-name-invalid-wrapped-false Info: creating file dune-project with this contents: (lang dune 1.1) 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'. - 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. - [1] + This is temporary allowed for libraries with (wrapped false). + It will not be supported in the future. Please choose a valid name field. + Entering directory 'public-name-invalid-wrapped-false'