File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
test/blackbox-tests/test-cases/pkg Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -177,11 +177,25 @@ 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+ | [] -> Some default_source_path
194+ | [ lock_dir ] -> Some lock_dir.path
195+ | _ :: _ :: _ ->
196+ (* Multiple lock dirs but context doesn't specify which one to use,
197+ fall back to default *)
198+ Some default_source_path)
185199;;
186200
187201let get_path ctx_name =
Original file line number Diff line number Diff line change @@ -32,7 +32,12 @@ Now change the workspace to use a custom lock directory:
3232 > EOF
3333
3434 $ dune build
35- Error: No rule found for default /.lock /dune .lock (context _private)
35+ Error: The package myproject does not have any user defined stanzas attached
36+ to it. If this is intentional, add (allow_empty) to the package definition in
37+ the dune-project file
38+ -> required by _build/ default / myproject. install
39+ -> required by alias all
40+ -> required by alias default
3641 [1 ]
3742
3843Now try with a context stanza that references the custom lock directory with a
You can’t perform that action at this time.
0 commit comments