File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
test/blackbox-tests/test-cases/pkg Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -177,11 +177,23 @@ let get_source_path_for_context ctx_name =
177177 | false -> None
178178 | true -> Some ctx)
179179 with
180- | None | Some (Default { lock_dir = None ; _ } ) -> Memo. return (Some default_source_path)
181180 | Some (Default { lock_dir = Some lock_dir_selection ; _ } ) ->
182181 let + source_lock_dir = select_lock_dir lock_dir_selection in
183182 Some source_lock_dir
184183 | Some (Opam _ ) -> Memo. return None
184+ | None | Some (Default { lock_dir = None ; _ } ) ->
185+ (* CR-someday Alizter: The logic here is hard to follow. Improve the lock
186+ directory selection logic so that it is harder to make a mistake. This
187+ can be done by enforcing invariants about contexts and their lock
188+ directories slightly earlier. *)
189+ Memo. return
190+ @@
191+ (* Context doesn't specify a lock_dir, check if there's a top-level one *)
192+ (match workspace.lock_dirs with
193+ | [ lock_dir ] -> Some lock_dir.path
194+ | [] | _ :: _ :: _ ->
195+ (* No clear choice, fall back to default *)
196+ Some default_source_path)
185197;;
186198
187199let get_path ctx_name =
Original file line number Diff line number Diff line change @@ -43,12 +43,7 @@ Now change the workspace to use a custom lock directory:
4343 > EOF
4444
4545 $ dune exec -- bar
46- Error: No rule found for default /.lock /dune .lock (context _private)
47- - > required by lock directory environment for context "default "
48- - > required by base environment for context "default "
49- - > required by loading findlib for context "default "
50- - > required by creating installed environment for "default "
51- [1 ]
46+ hello from bar
5247
5348Now try with a context stanza that references the custom lock directory with a
5449context stanza:
You can’t perform that action at this time.
0 commit comments