Small simplification
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
parent
dd4994495d
commit
e6e4589c47
|
@ -279,8 +279,9 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
+-----------------------------------------------------------------+ *)
|
+-----------------------------------------------------------------+ *)
|
||||||
|
|
||||||
let guess_modules ~dir ~files =
|
let guess_modules ~dir ~files =
|
||||||
let make_file syntax fn =
|
let make_module syntax base fn =
|
||||||
Module.File.make syntax (Path.relative dir fn)
|
(Module.Name.of_string base,
|
||||||
|
Module.File.make syntax (Path.relative dir fn))
|
||||||
in
|
in
|
||||||
let impl_files, intf_files =
|
let impl_files, intf_files =
|
||||||
String.Set.to_list files
|
String.Set.to_list files
|
||||||
|
@ -288,17 +289,14 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
(* we aren't using Filename.extension because we want to handle
|
(* we aren't using Filename.extension because we want to handle
|
||||||
filenames such as foo.cppo.ml *)
|
filenames such as foo.cppo.ml *)
|
||||||
match String.lsplit2 fn ~on:'.' with
|
match String.lsplit2 fn ~on:'.' with
|
||||||
| Some (s, "ml" ) -> Left (s, make_file OCaml fn)
|
| Some (s, "ml" ) -> Left (make_module OCaml s fn)
|
||||||
| Some (s, "re" ) -> Left (s, make_file Reason fn)
|
| Some (s, "re" ) -> Left (make_module Reason s fn)
|
||||||
| Some (s, "mli") -> Right (s, make_file OCaml fn)
|
| Some (s, "mli") -> Right (make_module OCaml s fn)
|
||||||
| Some (s, "rei") -> Right (s, make_file Reason fn)
|
| Some (s, "rei") -> Right (make_module Reason s fn)
|
||||||
| _ -> Skip)
|
| _ -> Skip)
|
||||||
in
|
in
|
||||||
let parse_one_set files =
|
let parse_one_set (files : (Module.Name.t * Module.File.t) list) =
|
||||||
List.map files ~f:(fun (base, (f : Module.File.t)) ->
|
match Module.Name.Map.of_list files with
|
||||||
(Module.Name.of_string base, f))
|
|
||||||
|> Module.Name.Map.of_list
|
|
||||||
|> function
|
|
||||||
| Ok x -> x
|
| Ok x -> x
|
||||||
| Error (name, f1, f2) ->
|
| Error (name, f1, f2) ->
|
||||||
let src_dir = Path.drop_build_context_exn dir in
|
let src_dir = Path.drop_build_context_exn dir in
|
||||||
|
|
Loading…
Reference in New Issue