Skip to content

Commit fc7ac54

Browse files
committed
refactor: reuse project_pins from Pkg.Lock instead of duplicating
Signed-off-by: Sachin Beniwal <s474996633@gmail.com>
1 parent 25709e4 commit fc7ac54

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

bin/lock_dev_tool.ml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,11 @@ let make_local_package_wrapping_dev_tool ~dev_tool ~dev_tool_version ~extra_depe
6666
}
6767
;;
6868

69-
(* Get pins from a project (both from pin stanzas and package pin_depends) *)
70-
let project_and_package_pins project =
71-
let dir = Dune_project.root project in
72-
let pins = Dune_project.pins project in
73-
let packages = Dune_project.packages project in
74-
Pin.DB.add_opam_pins (Pin.DB.of_stanza ~dir pins) packages
75-
;;
76-
7769
(* Collect all pins from all projects and filter to only compiler packages.
7870
This allows dev tools to use the same pinned compiler as the main project. *)
7971
let compiler_pins =
8072
let open Memo.O in
81-
Dune_rules.Dune_load.projects ()
82-
>>| List.fold_left ~init:Pin.DB.empty ~f:(fun acc project ->
83-
let pins = project_and_package_pins project in
84-
Pin.DB.combine_exn acc pins)
73+
Pkg.Lock.project_pins
8574
>>| Pin.DB.filter_by_package_names
8675
~package_names:Dune_pkg.Dev_tool.compiler_package_names
8776
;;

bin/pkg/lock.mli

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
open Import
22

3+
(** Collect all pins from all projects in the workspace. *)
4+
val project_pins : Dune_pkg.Pin.DB.t Memo.t
5+
36
val solve
47
: Workspace.t
58
-> local_packages:Dune_pkg.Local_package.t Package_name.Map.t

0 commit comments

Comments
 (0)