Skip to content

Commit

Permalink
separate constructors for dune/findlib
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Dec 18, 2020
1 parent 6d392ca commit 63b2211
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/dune_rules/dune_package.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ module Lib = struct
let info = Lib_info.map_path info ~f:map_path in
{ info; main_module_name; modules }

let of_dune_lib ~info ~main_module_name ~modules =
make ~info ~main_module_name ~modules:(Some modules)

let of_findlib info = make ~info ~main_module_name:None ~modules:None

let dir_of_name name =
let _, components = Lib_name.split name in
Path.Local.L.relative Path.Local.root components
Expand Down
6 changes: 4 additions & 2 deletions src/dune_rules/dune_package.mli
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ module Lib : sig

val info : t -> Path.t Lib_info.t

val make :
val of_findlib : Path.t Lib_info.t -> t

val of_dune_lib :
info:Path.t Lib_info.t
-> main_module_name:Module_name.t option
-> modules:Modules.t option
-> modules:Modules.t
-> t

val to_dyn : t Dyn.Encoder.t
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/findlib/findlib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ end = struct
~special_builtin_support ~exit_module:None
~instrumentation_backend:None ~entry_modules
in
Dune_package.Lib.make ~info ~modules:None ~main_module_name:None
Dune_package.Lib.of_findlib info
end

(* Parse all the packages defined in a META file *)
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ let to_dune_lib ({ info; _ } as lib) ~modules ~foreign_objects ~dir =
Lib_info.for_dune_package info ~name ~ppx_runtime_deps ~requires
~foreign_objects ~obj_dir ~implements ~default_implementation ~sub_systems
in
Dune_package.Lib.make ~info ~modules:(Some modules) ~main_module_name
Dune_package.Lib.of_dune_lib ~info ~modules ~main_module_name

module Local : sig
type t = private lib
Expand Down

0 comments on commit 63b2211

Please sign in to comment.