Merge pull request #1223 from rgrinberg/setup-file-deps-function
Move setting lib file aliases to separate function
This commit is contained in:
commit
22fe0696ff
|
@ -324,6 +324,24 @@ module Gen (P : Install_rules.Params) = struct
|
||||||
in
|
in
|
||||||
SC.add_rule sctx build)
|
SC.add_rule sctx build)
|
||||||
|
|
||||||
|
let setup_file_deps lib ~dir ~obj_dir ~modules ~wrapped_compat =
|
||||||
|
let add_cms ~cm_kind ~init = Module.Name.Map.fold ~init ~f:(fun m acc ->
|
||||||
|
match Module.cm_file m ~obj_dir cm_kind with
|
||||||
|
| None -> acc
|
||||||
|
| Some fn -> Path.Set.add acc fn)
|
||||||
|
in
|
||||||
|
List.iter Cm_kind.all ~f:(fun cm_kind ->
|
||||||
|
let files = add_cms ~cm_kind ~init:Path.Set.empty modules in
|
||||||
|
let files = add_cms ~cm_kind ~init:files wrapped_compat in
|
||||||
|
Lib_file_deps.setup_file_deps_alias sctx ~dir lib ~exts:[Cm_kind.ext cm_kind]
|
||||||
|
files);
|
||||||
|
|
||||||
|
Lib_file_deps.setup_file_deps_group_alias sctx ~dir lib ~exts:[".cmi"; ".cmx"];
|
||||||
|
Lib_file_deps.setup_file_deps_alias sctx ~dir lib ~exts:[".h"]
|
||||||
|
(List.map lib.install_c_headers ~f:(fun header ->
|
||||||
|
Path.relative dir (header ^ ".h"))
|
||||||
|
|> Path.Set.of_list)
|
||||||
|
|
||||||
let library_rules (lib : Library.t) ~dir_contents ~dir ~scope
|
let library_rules (lib : Library.t) ~dir_contents ~dir ~scope
|
||||||
~compile_info ~dir_kind =
|
~compile_info ~dir_kind =
|
||||||
let obj_dir = Utils.library_object_directory ~dir lib.name in
|
let obj_dir = Utils.library_object_directory ~dir lib.name in
|
||||||
|
@ -403,22 +421,7 @@ module Gen (P : Install_rules.Params) = struct
|
||||||
if Library.has_stubs lib then
|
if Library.has_stubs lib then
|
||||||
build_stubs lib ~dir ~scope ~requires ~dir_contents;
|
build_stubs lib ~dir ~scope ~requires ~dir_contents;
|
||||||
|
|
||||||
let add_cms ~cm_kind ~init = Module.Name.Map.fold ~init ~f:(fun m acc ->
|
setup_file_deps lib ~dir ~obj_dir ~modules ~wrapped_compat;
|
||||||
match Module.cm_file m ~obj_dir cm_kind with
|
|
||||||
| None -> acc
|
|
||||||
| Some fn -> Path.Set.add acc fn)
|
|
||||||
in
|
|
||||||
List.iter Cm_kind.all ~f:(fun cm_kind ->
|
|
||||||
let files = add_cms ~cm_kind ~init:Path.Set.empty modules in
|
|
||||||
let files = add_cms ~cm_kind ~init:files wrapped_compat in
|
|
||||||
Lib_file_deps.setup_file_deps_alias sctx ~dir lib ~exts:[Cm_kind.ext cm_kind]
|
|
||||||
files);
|
|
||||||
|
|
||||||
Lib_file_deps.setup_file_deps_group_alias sctx ~dir lib ~exts:[".cmi"; ".cmx"];
|
|
||||||
Lib_file_deps.setup_file_deps_alias sctx ~dir lib ~exts:[".h"]
|
|
||||||
(List.map lib.install_c_headers ~f:(fun header ->
|
|
||||||
Path.relative dir (header ^ ".h"))
|
|
||||||
|> Path.Set.of_list);
|
|
||||||
|
|
||||||
if not (Library.is_virtual lib) then begin
|
if not (Library.is_virtual lib) then begin
|
||||||
(let modules =
|
(let modules =
|
||||||
|
|
Loading…
Reference in New Issue