From b4641d937e68d578e6417de90416a731656e1f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ulysse=20G=C3=A9rard?= Date: Wed, 9 Oct 2024 18:23:26 +0200 Subject: [PATCH] Merlin: Remove unused `source_dirs` argument. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ulysse GĂ©rard --- src/dune_rules/exe_rules.ml | 1 - src/dune_rules/lib_rules.ml | 1 - src/dune_rules/melange/melange_rules.ml | 1 - src/dune_rules/merlin/merlin.ml | 33 +++++++++++-------------- src/dune_rules/merlin/merlin.mli | 1 - 5 files changed, 14 insertions(+), 23 deletions(-) diff --git a/src/dune_rules/exe_rules.ml b/src/dune_rules/exe_rules.ml index 5c9d0ff66168..c3de011f3afa 100644 --- a/src/dune_rules/exe_rules.ml +++ b/src/dune_rules/exe_rules.ml @@ -286,7 +286,6 @@ let executables_rules ~stdlib_dir ~flags ~modules - ~source_dirs:Path.Source.Set.empty ~libname:None ~obj_dir ~preprocess: diff --git a/src/dune_rules/lib_rules.ml b/src/dune_rules/lib_rules.ml index 4edef02046d7..9893e17dd8ff 100644 --- a/src/dune_rules/lib_rules.ml +++ b/src/dune_rules/lib_rules.ml @@ -633,7 +633,6 @@ let library_rules ~stdlib_dir ~flags ~modules - ~source_dirs:Path.Source.Set.empty ~preprocess:(Preprocess.Per_module.without_instrumentation lib.buildable.preprocess) ~libname:(Some (snd lib.name)) ~obj_dir diff --git a/src/dune_rules/melange/melange_rules.ml b/src/dune_rules/melange/melange_rules.ml index 80e1665af21d..8f75c43708b5 100644 --- a/src/dune_rules/melange/melange_rules.ml +++ b/src/dune_rules/melange/melange_rules.ml @@ -360,7 +360,6 @@ let setup_emit_cmj_rules ~stdlib_dir ~flags ~modules - ~source_dirs:Path.Source.Set.empty ~libname:None ~preprocess:(Preprocess.Per_module.without_instrumentation mel.preprocess) ~obj_dir diff --git a/src/dune_rules/merlin/merlin.ml b/src/dune_rules/merlin/merlin.ml index ab31744ef1f2..a5ea9f977467 100644 --- a/src/dune_rules/merlin/merlin.ml +++ b/src/dune_rules/merlin/merlin.ml @@ -464,7 +464,6 @@ module Unprocessed = struct ; preprocess : Preprocess.Without_instrumentation.t Preprocess.t Module_name.Per_item.t ; libname : Lib_name.Local.t option - ; source_dirs : Path.Source.Set.t ; objs_dirs : Path.Set.t ; extensions : string option Ml_kind.Dict.t list ; readers : string list String.Map.t @@ -484,7 +483,6 @@ module Unprocessed = struct ~flags ~preprocess ~libname - ~source_dirs ~modules ~obj_dir ~dialects @@ -511,7 +509,6 @@ module Unprocessed = struct ; flags ; preprocess ; libname - ; source_dirs ; objs_dirs ; extensions ; readers @@ -613,19 +610,21 @@ module Unprocessed = struct ~f:(pp_flags ctx ~expander t.config.libname) ;; - let add_lib_dirs sctx mode ~init libs = + let add_lib_dirs sctx mode libs = Action_builder.of_memo (let open Memo.O in Memo.parallel_map libs ~f:(fun lib -> let+ dirs = src_dirs sctx lib in lib, dirs) - >>| List.fold_left ~init ~f:(fun (src_dirs, obj_dirs) (lib, more_src_dirs) -> - ( Path.Set.union src_dirs more_src_dirs - , let public_cmi_dir = - let info = Lib.info lib in - obj_dir_of_lib `Public mode (Lib_info.obj_dir info) - in - Path.Set.add obj_dirs public_cmi_dir ))) + >>| List.fold_left + ~init:(Path.Set.empty, Path.Set.empty) + ~f:(fun (src_dirs, obj_dirs) (lib, more_src_dirs) -> + ( Path.Set.union src_dirs more_src_dirs + , let public_cmi_dir = + let info = Lib.info lib in + obj_dir_of_lib `Public mode (Lib_info.obj_dir info) + in + Path.Set.add obj_dirs public_cmi_dir ))) ;; let process @@ -637,7 +636,6 @@ module Unprocessed = struct ; readers ; flags ; objs_dirs - ; source_dirs ; requires_compile ; requires_hidden ; preprocess = _ @@ -692,15 +690,12 @@ module Unprocessed = struct in let+ flags = flags and+ indexes = Action_builder.of_memo (Ocaml_index.context_indexes sctx) - and+ src_dirs, obj_dirs = - let init = Path.set_of_source_paths source_dirs, objs_dirs in - add_lib_dirs sctx mode ~init requires_compile - and+ hidden_src_dirs, hidden_obj_dirs = - add_lib_dirs sctx mode ~init:(Path.Set.empty, Path.Set.empty) requires_hidden - in + and+ deps_src_dirs, deps_obj_dirs = add_lib_dirs sctx mode requires_compile + and+ hidden_src_dirs, hidden_obj_dirs = add_lib_dirs sctx mode requires_hidden in let src_dirs = - Path.Set.union src_dirs (Path.Set.of_list_map ~f:Path.source more_src_dirs) + Path.Set.of_list_map ~f:Path.source more_src_dirs |> Path.Set.union deps_src_dirs in + let obj_dirs = Path.Set.union deps_obj_dirs objs_dirs in let source_root = Path.Source.root |> Path.source in { Processed.stdlib_dir ; source_root diff --git a/src/dune_rules/merlin/merlin.mli b/src/dune_rules/merlin/merlin.mli index 8f89938f0ccc..f063f1f8397d 100644 --- a/src/dune_rules/merlin/merlin.mli +++ b/src/dune_rules/merlin/merlin.mli @@ -47,7 +47,6 @@ val make -> flags:Ocaml_flags.t -> preprocess:Preprocess.Without_instrumentation.t Preprocess.t Module_name.Per_item.t -> libname:Lib_name.Local.t option - -> source_dirs:Path.Source.Set.t -> modules:Modules.With_vlib.t -> obj_dir:Path.Build.t Obj_dir.t -> dialects:Dialect.DB.t