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 _ ->
|
| Yes_with_transition _ ->
|
||||||
( wrap_modules modules
|
( wrap_modules modules
|
||||||
, Module.Name.Map.remove modules main_module_name
|
, Module.Name.Map.remove modules main_module_name
|
||||||
|> Module.Name.Map.map ~f:Module.deprecate
|
|> Module.Name.Map.map ~f:Module.wrapped_compat
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
let alias_module =
|
let alias_module =
|
||||||
|
|
|
@ -413,13 +413,13 @@ module Gen (P : Install_rules.Params) = struct
|
||||||
else
|
else
|
||||||
acc)
|
acc)
|
||||||
in
|
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 *)
|
(* deprecated modules have implementations so we can just append them *)
|
||||||
let top_sorted_modules =
|
let top_sorted_modules =
|
||||||
Ocamldep.Dep_graph.top_closed_implementations dep_graphs.impl modules
|
Ocamldep.Dep_graph.top_closed_implementations dep_graphs.impl modules
|
||||||
>>^ fun modules -> modules @ deprecated_modules
|
>>^ fun modules -> modules @ wrapped_compat
|
||||||
in
|
in
|
||||||
(let modules = modules @ deprecated_modules in
|
(let modules = modules @ wrapped_compat in
|
||||||
List.iter Mode.all ~f:(fun mode ->
|
List.iter Mode.all ~f:(fun mode ->
|
||||||
build_lib lib ~scope ~flags ~dir ~obj_dir ~mode ~top_sorted_modules
|
build_lib lib ~scope ~flags ~dir ~obj_dir ~mode ~top_sorted_modules
|
||||||
~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)
|
; "pp", (option string) (Option.map ~f:(fun _ -> "has pp") pp)
|
||||||
]
|
]
|
||||||
|
|
||||||
let deprecate t =
|
let wrapped_compat t =
|
||||||
{ t with
|
{ t with
|
||||||
intf = None
|
intf = None
|
||||||
; impl =
|
; impl =
|
||||||
|
@ -176,6 +176,12 @@ let deprecate t =
|
||||||
| Some intf, _ -> intf.path
|
| Some intf, _ -> intf.path
|
||||||
| None, None -> assert false
|
| None, None -> assert false
|
||||||
in
|
in
|
||||||
|
let path =
|
||||||
|
Path.L.relative (Path.parent_exn path)
|
||||||
|
[ ".wrapped_compat"
|
||||||
|
; Path.basename path
|
||||||
|
]
|
||||||
|
in
|
||||||
let (base, _) = Path.split_extension path in
|
let (base, _) = Path.split_extension path in
|
||||||
{ syntax = OCaml
|
{ syntax = OCaml
|
||||||
; path = Path.extend_basename base ~suffix:".ml-gen"
|
; 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 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
|
| In_source_tree l -> Local l
|
||||||
| External l -> External l
|
| External l -> External l
|
||||||
end
|
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
|
module Internal : sig
|
||||||
val raw_kind : t -> Kind.t
|
val raw_kind : t -> Kind.t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module L : sig
|
||||||
|
val relative : t -> string list -> t
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue