From bde49436928962ee8223530d4b97927819c9f455 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Thu, 2 Aug 2018 15:21:59 +0200 Subject: [PATCH] Make file_deps and file_deps_with_exts share code Signed-off-by: Rudi Grinberg --- src/super_context.ml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/super_context.ml b/src/super_context.ml index c4f72212..de47e8cf 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -706,23 +706,19 @@ module Libs = struct (lib_files_alias ~dir ~name:(Library.best_name lib) ~ext)) |> Path.Set.of_list) + let file_deps_of_lib t (lib : Lib.t) ~ext = + if Lib.is_local lib then + Alias.stamp_file + (lib_files_alias ~dir:(Lib.src_dir lib) ~name:(Lib.name lib) ~ext) + else + Build_system.stamp_file_for_files_of t.build_system + ~dir:(Lib.obj_dir lib) ~ext + let file_deps_with_exts t lib_exts = - List.rev_map lib_exts ~f:(fun ((lib : Lib.t), ext) -> - if Lib.is_local lib then - Alias.stamp_file - (lib_files_alias ~dir:(Lib.src_dir lib) ~name:(Lib.name lib) ~ext) - else - Build_system.stamp_file_for_files_of t.build_system - ~dir:(Lib.obj_dir lib) ~ext) + List.rev_map lib_exts ~f:(fun (lib, ext) -> file_deps_of_lib t lib ~ext) let file_deps t libs ~ext = - List.rev_map libs ~f:(fun (lib : Lib.t) -> - if Lib.is_local lib then - Alias.stamp_file - (lib_files_alias ~dir:(Lib.src_dir lib) ~name:(Lib.name lib) ~ext) - else - Build_system.stamp_file_for_files_of t.build_system - ~dir:(Lib.obj_dir lib) ~ext) + List.rev_map libs ~f:(file_deps_of_lib t ~ext) end module Deps = struct