Move functions that operate on more than 1 module to Lib_deps.L

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-09-02 16:18:11 +04:00
parent e47987a670
commit 0ebad2d50f
4 changed files with 27 additions and 22 deletions

View File

@ -16,7 +16,7 @@ module Includes = struct
let cmi_includes =
Arg_spec.S [ iflags
; Hidden_deps
(Lib_deps.file_deps sctx libs ~ext:".cmi")
(Lib_deps.L.file_deps sctx libs ~ext:".cmi")
]
in
let cmx_includes =
@ -29,9 +29,9 @@ module Includes = struct
".cmi"
else
".cmi-and-.cmx"))
|> Lib_deps.file_deps_with_exts sctx
|> Lib_deps.L.file_deps_with_exts sctx
else
Lib_deps.file_deps sctx libs ~ext:".cmi-and-.cmx"
Lib_deps.L.file_deps sctx libs ~ext:".cmi-and-.cmx"
)
]
in

View File

@ -17,6 +17,7 @@ let setup_file_deps_group_alias t ~dir ~exts lib =
(lib_files_alias ~dir ~name:(Library.best_name lib) ~ext))
|> Path.Set.of_list)
module L = struct
let file_deps_of_lib t (lib : Lib.t) ~ext =
if Lib.is_local lib then
Alias.stamp_file
@ -30,3 +31,4 @@ let file_deps_with_exts t lib_exts =
let file_deps t libs ~ext =
List.rev_map libs ~f:(file_deps_of_lib t ~ext)
end

View File

@ -1,5 +1,7 @@
open Stdune
module L : sig
(** [file_deps t libs ~ext] returns a list of path dependencies for all the
files with extension [ext] of libraries [libs]. *)
val file_deps : Super_context.t -> Lib.L.t -> ext:string -> Path.t list
@ -8,6 +10,7 @@ val file_deps_with_exts
: Super_context.t
-> (Lib.t * string) list
-> Path.t list
end
(** Setup the alias that depends on all files with a given extension
for a library *)

View File

@ -273,7 +273,7 @@ module Gen (P : Install_rules.Params) = struct
[ Hidden_deps h_files
; Arg_spec.of_result_map requires ~f:(fun libs ->
S [ Lib.L.c_include_flags libs ~stdlib_dir:ctx.stdlib_dir
; Hidden_deps (Lib_deps.file_deps sctx libs ~ext:".h")
; Hidden_deps (Lib_deps.L.file_deps sctx libs ~ext:".h")
])
]
in