Change deprecated modules in a separate directory
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
ba1b3f8d24
commit
868ecbc632
|
@ -198,7 +198,7 @@ end = struct
|
|||
| Yes_with_transition _ ->
|
||||
( wrap_modules modules
|
||||
, Module.Name.Map.remove modules main_module_name
|
||||
|> Module.Name.Map.map ~f:Module.deprecate
|
||||
|> Module.Name.Map.map ~f:Module.wrapped_compat
|
||||
)
|
||||
in
|
||||
let alias_module =
|
||||
|
|
|
@ -413,13 +413,13 @@ module Gen (P : Install_rules.Params) = struct
|
|||
else
|
||||
acc)
|
||||
in
|
||||
let deprecated_modules = Module.Name.Map.values wrapped_compat in
|
||||
let wrapped_compat = Module.Name.Map.values wrapped_compat in
|
||||
(* deprecated modules have implementations so we can just append them *)
|
||||
let top_sorted_modules =
|
||||
Ocamldep.Dep_graph.top_closed_implementations dep_graphs.impl modules
|
||||
>>^ fun modules -> modules @ deprecated_modules
|
||||
>>^ fun modules -> modules @ wrapped_compat
|
||||
in
|
||||
(let modules = modules @ deprecated_modules in
|
||||
(let modules = modules @ wrapped_compat in
|
||||
List.iter Mode.all ~f:(fun mode ->
|
||||
build_lib lib ~scope ~flags ~dir ~obj_dir ~mode ~top_sorted_modules
|
||||
~modules)));
|
||||
|
|
|
@ -164,7 +164,7 @@ let to_sexp { name; impl; intf; obj_name ; pp } =
|
|||
; "pp", (option string) (Option.map ~f:(fun _ -> "has pp") pp)
|
||||
]
|
||||
|
||||
let deprecate t =
|
||||
let wrapped_compat t =
|
||||
{ t with
|
||||
intf = None
|
||||
; impl =
|
||||
|
@ -176,6 +176,12 @@ let deprecate t =
|
|||
| Some intf, _ -> intf.path
|
||||
| None, None -> assert false
|
||||
in
|
||||
let path =
|
||||
Path.L.relative (Path.parent_exn path)
|
||||
[ ".wrapped_compat"
|
||||
; Path.basename path
|
||||
]
|
||||
in
|
||||
let (base, _) = Path.split_extension path in
|
||||
{ syntax = OCaml
|
||||
; path = Path.extend_basename base ~suffix:".ml-gen"
|
||||
|
|
|
@ -95,4 +95,4 @@ val set_pp : t -> (unit, string list) Build.t option -> t
|
|||
|
||||
val to_sexp : t Sexp.To_sexp.t
|
||||
|
||||
val deprecate : t -> t
|
||||
val wrapped_compat : t -> t
|
||||
|
|
|
@ -943,3 +943,8 @@ module Internal = struct
|
|||
| In_source_tree l -> Local l
|
||||
| External l -> External l
|
||||
end
|
||||
|
||||
module L = struct
|
||||
(* TODO more efficient implementation *)
|
||||
let relative t = List.fold_left ~init:t ~f:relative
|
||||
end
|
||||
|
|
|
@ -169,3 +169,7 @@ val set_root : External.t -> unit
|
|||
module Internal : sig
|
||||
val raw_kind : t -> Kind.t
|
||||
end
|
||||
|
||||
module L : sig
|
||||
val relative : t -> string list -> t
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue