Skip to content

Commit

Permalink
refactor: lib id simplification (#11077)
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg authored Nov 2, 2024
1 parent edaa7b7 commit 20fd171
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
19 changes: 9 additions & 10 deletions src/dune_rules/lib_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -643,21 +643,20 @@ let library_rules

let rules (lib : Library.t) ~sctx ~dir_contents ~dir ~expander ~scope =
let buildable = lib.buildable in
let* local_lib, compile_info =
let libs = Scope.libs scope in
let lib_id =
let src_dir = Path.Build.drop_build_context_exn dir in
Library.to_lib_id ~src_dir lib
in
let* local_lib, compile_info =
Lib.DB.get_compile_info
(Scope.libs scope)
(Local (Library.to_lib_id ~src_dir lib))
libs
(Local lib_id)
~allow_overlaps:buildable.allow_overlapping_dependencies
in
let local_lib = Lib.Local.of_lib_exn local_lib in
let f () =
let* source_modules =
Dir_contents.ocaml dir_contents
>>= Ml_sources.modules
~libs:(Scope.libs scope)
~for_:
(Library (Lib_info.lib_id (Lib.Local.info local_lib) |> Lib_id.to_local_exn))
Dir_contents.ocaml dir_contents >>= Ml_sources.modules ~libs ~for_:(Library lib_id)
in
let* cctx = cctx lib ~sctx ~source_modules ~dir ~scope ~expander ~compile_info in
let* () =
Expand All @@ -668,7 +667,7 @@ let rules (lib : Library.t) ~sctx ~dir_contents ~dir ~expander ~scope =
in
library_rules
lib
~local_lib
~local_lib:(Lib.Local.of_lib_exn local_lib)
~cctx
~source_modules
~dir_contents
Expand Down
2 changes: 1 addition & 1 deletion src/dune_rules/merlin/merlin_ident.mli
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ val for_exes : names:string Nonempty_list.t -> t
val for_melange : target:string -> t

(** Merlin config folder name *)
val merlin_folder_name : string
val merlin_folder_name : Filename.t

(** Return the path of the merlin file for a given stanza *)
val merlin_file_path : Path.Build.t -> t -> Path.Build.t
3 changes: 2 additions & 1 deletion src/dune_rules/test_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ let rules (t : Tests.t) ~sctx ~dir ~scope ~expander ~dir_contents =
|> List.sort_uniq ~compare:Poly.compare
in
let* () =
Memo.parallel_iter (Nonempty_list.to_list t.exes.names) ~f:(fun (loc, s) ->
Nonempty_list.to_list t.exes.names
|> Memo.parallel_iter ~f:(fun (loc, s) ->
Memo.parallel_iter runtest_modes ~f:(fun runtest_mode ->
let ext =
match runtest_mode with
Expand Down

0 comments on commit 20fd171

Please sign in to comment.