File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed
Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,12 @@ let gen_rules_output
181181 if ocamlformat_is_locked
182182 then (
183183 let { Action_builder.With_targets. build; targets } = rule in
184+ let build =
185+ let open Action_builder.O in
186+ let + build = build
187+ and + env = Action_builder. of_memo (Pkg_rules. dev_tool_env Ocamlformat ) in
188+ Action.Full. add_env env build
189+ in
184190 Rule. make ~mode: Standard ~targets build |> Rules.Produce. rule)
185191 else
186192 let open Memo.O in
Original file line number Diff line number Diff line change @@ -2140,6 +2140,21 @@ let ocamlpath context =
21402140let lock_dir_active = Lock_dir. lock_dir_active
21412141let lock_dir_path = Lock_dir. get_path
21422142
2143+ let dev_tool_env tool =
2144+ let package_name = Dune_pkg.Dev_tool. package_name tool in
2145+ Memo. push_stack_frame ~human_readable_description: (fun () ->
2146+ Pp. textf
2147+ " lock directory environment for dev tools %S"
2148+ (Package.Name. to_string package_name))
2149+ @@ fun () ->
2150+ let universe : Package_universe.t = Dev_tool tool in
2151+ let * db = DB. get universe in
2152+ Resolve. resolve db (Loc. none, package_name) universe
2153+ >> | function
2154+ | `System_provided -> assert false
2155+ | `Inside_lock_dir pkg -> Pkg. exported_env pkg
2156+ ;;
2157+
21432158let exported_env context =
21442159 Memo. push_stack_frame ~human_readable_description: (fun () ->
21452160 Pp. textf " lock directory environment for context %S" (Context_name. to_string context))
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ val which : Context_name.t -> (Filename.t -> Path.t option Memo.t) Staged.t
2525val exported_env : Context_name .t -> Env .t Memo .t
2626val ocamlpath : Context_name .t -> Path .t list Memo .t
2727val find_package : Context_name .t -> Package.Name .t -> unit Action_builder .t option Memo .t
28+ val dev_tool_env : Dune_pkg.Dev_tool .t -> Env .t Memo .t
2829
2930val setup_pkg_install_alias
3031 : dir:Path.Build. t
You can’t perform that action at this time.
0 commit comments