@@ -16,7 +16,10 @@ type where =
1616 | Original_path
1717
1818type path =
19- | Resolved of Path.Build .t
19+ | Resolved of
20+ { binding : File_binding.Expanded .t
21+ ; path : Path.Build .t
22+ }
2023 | Origin of origin list
2124
2225type local_bins = path Filename.Map .t
@@ -36,6 +39,13 @@ let force { local_bins; _ } =
3639 ()
3740;;
3841
42+ let local_binaries { local_bins; _ } =
43+ let + local_bins = Memo.Lazy. force local_bins in
44+ List. filter_map (Filename.Map. to_list local_bins) ~f: (function
45+ | _ , Resolved p -> Some p.binding
46+ | _ , Origin _origins -> None )
47+ ;;
48+
3949let analyze_binary t name =
4050 match Filename. is_relative name with
4151 | false -> Memo. return (`Resolved (Path. of_filename_relative_to_initial_cwd name))
@@ -48,7 +58,7 @@ let analyze_binary t name =
4858 | Some path -> `Resolved path
4959 in
5060 (match Filename.Map. find local_bins name with
51- | Some (Resolved p ) -> Memo. return (`Resolved (Path. build p))
61+ | Some (Resolved p ) -> Memo. return (`Resolved (Path. build p.path ))
5262 | None -> which ()
5363 | Some (Origin origins ) ->
5464 Memo. parallel_map origins ~f: (fun origin ->
@@ -108,9 +118,9 @@ let add_binaries t ~dir l =
108118 let local_bins =
109119 Memo. lazy_ ~name: " Artifacts.Bin.add_binaries" (fun () ->
110120 let + local_bins = Memo.Lazy. force t.local_bins in
111- List. fold_left l ~init: local_bins ~f: (fun acc fb ->
112- let path = File_binding.Expanded. dst_path fb ~dir: (local_bin dir) in
113- Filename.Map. set acc (Path.Build. basename path) (Resolved path)))
121+ List. fold_left l ~init: local_bins ~f: (fun acc binding ->
122+ let path = File_binding.Expanded. dst_path binding ~dir: (local_bin dir) in
123+ Filename.Map. set acc (Path.Build. basename path) (Resolved { binding; path } )))
114124 in
115125 { t with local_bins }
116126;;
0 commit comments