@@ -115,17 +115,14 @@ let build_prog ~no_rebuild ~prog p =
115115 p
116116;;
117117
118- let dir_of_context common context =
119- let open Memo.O in
120- let + sctx = Super_context. find_exn context in
118+ let dir_of_context common sctx =
121119 let context = Dune_rules.Super_context. context sctx in
122120 Path.Build. relative (Context. build_dir context) (Common. prefix_target common " " )
123121;;
124122
125- let get_path common context ~prog =
123+ let get_path common sctx ~prog =
126124 let open Memo.O in
127- let * sctx = Super_context. find_exn context
128- and * dir = dir_of_context common context in
125+ let dir = dir_of_context common sctx in
129126 match Filename. analyze_program_name prog with
130127 | In_path ->
131128 Super_context. resolve_program_memo sctx ~dir ~loc: None prog
@@ -153,9 +150,9 @@ let get_path common context ~prog =
153150 | None -> not_found_with_suggestions ~dir ~prog )
154151;;
155152
156- let get_path_and_build_if_necessary common context ~no_rebuild ~prog =
153+ let get_path_and_build_if_necessary common sctx ~no_rebuild ~prog =
157154 let open Memo.O in
158- let * path = get_path common context ~prog in
155+ let * path = get_path common sctx ~prog in
159156 match Filename. analyze_program_name prog with
160157 | In_path | Relative_to_current_dir -> build_prog ~no_rebuild ~prog path
161158 | Absolute -> Memo. return path
@@ -166,7 +163,7 @@ let step ~prog ~args ~common ~no_rebuild ~context ~on_exit () =
166163 let * sctx = Super_context. find_exn context in
167164 let * path =
168165 let * prog = Cmd_arg. expand ~root: (Common. root common) ~sctx prog in
169- get_path_and_build_if_necessary common context ~no_rebuild ~prog
166+ get_path_and_build_if_necessary common sctx ~no_rebuild ~prog
170167 and * args =
171168 Memo. parallel_map args ~f: (Cmd_arg. expand ~root: (Common. root common) ~sctx )
172169 in
@@ -282,8 +279,7 @@ let exec_building_directly ~common ~config ~context ~prog ~args ~no_rebuild =
282279 let * env = Super_context. context_env sctx
283280 and * prog =
284281 let * prog = Cmd_arg. expand ~root: (Common. root common) ~sctx prog in
285- get_path_and_build_if_necessary common context ~no_rebuild ~prog
286- >> | Path. to_string
282+ get_path_and_build_if_necessary common sctx ~no_rebuild ~prog >> | Path. to_string
287283 and * args =
288284 Memo. parallel_map ~f: (Cmd_arg. expand ~root: (Common. root common) ~sctx ) args
289285 in
0 commit comments