Merge pull request #1210 from rgrinberg/wrapped-virtual
Enforce wrapped true for virtual libs/implementations
This commit is contained in:
commit
a61a2c8cd8
|
@ -873,11 +873,15 @@ module Library = struct
|
||||||
string >>| fun x -> Yes_with_transition x
|
string >>| fun x -> Yes_with_transition x
|
||||||
]
|
]
|
||||||
|
|
||||||
let field = field "wrapped" ~default:(Simple true) dparse
|
let field = field_o "wrapped" (located dparse)
|
||||||
|
|
||||||
let to_bool = function
|
let to_bool = function
|
||||||
| Simple b -> b
|
| Simple b -> b
|
||||||
| Yes_with_transition _ -> true
|
| Yes_with_transition _ -> true
|
||||||
|
|
||||||
|
let value = function
|
||||||
|
| None -> Simple true
|
||||||
|
| Some (_loc, w) -> w
|
||||||
end
|
end
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
|
@ -953,7 +957,8 @@ module Library = struct
|
||||||
let open Syntax.Version.Infix in
|
let open Syntax.Version.Infix in
|
||||||
match name, public with
|
match name, public with
|
||||||
| Some n, _ ->
|
| Some n, _ ->
|
||||||
Lib_name.Local.validate n ~wrapped:(Wrapped.to_bool wrapped)
|
let wrapped = Wrapped.to_bool (Wrapped.value wrapped) in
|
||||||
|
Lib_name.Local.validate n ~wrapped
|
||||||
| 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.to_local name with
|
match Lib_name.to_local name with
|
||||||
|
@ -982,6 +987,15 @@ module Library = struct
|
||||||
(Ordered_set_lang.loc virtual_modules
|
(Ordered_set_lang.loc virtual_modules
|
||||||
|> Option.value_exn)
|
|> Option.value_exn)
|
||||||
"A library cannot be both virtual and implement %s" impl);
|
"A library cannot be both virtual and implement %s" impl);
|
||||||
|
begin match virtual_modules, wrapped, implements with
|
||||||
|
| Some _, Some (loc, Wrapped.Simple false), _ ->
|
||||||
|
of_sexp_error loc "A virtual library must be wrapped"
|
||||||
|
| _, Some (loc, _), Some _ ->
|
||||||
|
of_sexp_error loc
|
||||||
|
"Wrapped cannot be set for implementations. \
|
||||||
|
It is inherited from the virtual library."
|
||||||
|
| _, _, _ -> ()
|
||||||
|
end;
|
||||||
{ name
|
{ name
|
||||||
; public
|
; public
|
||||||
; synopsis
|
; synopsis
|
||||||
|
@ -997,7 +1011,7 @@ module Library = struct
|
||||||
; c_library_flags
|
; c_library_flags
|
||||||
; self_build_stubs_archive
|
; self_build_stubs_archive
|
||||||
; virtual_deps
|
; virtual_deps
|
||||||
; wrapped
|
; wrapped = Wrapped.value wrapped
|
||||||
; optional
|
; optional
|
||||||
; buildable
|
; buildable
|
||||||
; dynlink = Dynlink_supported.of_bool (not no_dynlink)
|
; dynlink = Dynlink_supported.of_bool (not no_dynlink)
|
||||||
|
|
Loading…
Reference in New Issue