Skip to content

Commit

Permalink
fix: allow to override partially the setup config (ocaml#10229)
Browse files Browse the repository at this point in the history
Signed-off-by: Alpha DIALLO <moyodiallo@gmail.com>
  • Loading branch information
moyodiallo committed Mar 8, 2024
1 parent 89f1c29 commit 4745e04
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion bin/install_uninstall.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ let get_dirs context ~prefix_from_command_line ~from_command_line =
| Some prefix ->
Roots.opam_from_prefix prefix ~relative:Path.relative
|> Roots.map ~f:(fun s -> Some s)
|> Fiber.return
|> (fun opam_roots ->
Memo.map
~f:(fun context_roots -> Roots.first_has_priority context_roots opam_roots)
(Context.roots ~only_setup:true context))
|> Memo.run
in
let roots = Roots.first_has_priority from_command_line roots in
let must_be_defined name v =
Expand Down
4 changes: 2 additions & 2 deletions src/dune_rules/context.ml
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ let map_exe (context : t) =
| _ -> exe)
;;

let roots t =
let roots ?(only_setup = false) t =
let module Roots = Install.Roots in
let+ prefix_roots =
let+ env = t.builder.env in
Expand All @@ -714,6 +714,6 @@ let roots t =
match t.kind with
| Lock _ | Default ->
let setup_roots = Roots.map ~f:(Option.map ~f:Path.of_string) Setup.roots in
Roots.first_has_priority setup_roots prefix_roots
if only_setup then setup_roots else Roots.first_has_priority setup_roots prefix_roots
| Opam _ -> prefix_roots
;;
2 changes: 1 addition & 1 deletion src/dune_rules/context.mli
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ val map_exe : t -> Path.t -> Path.t

(** Query where build artifacts should be installed if the user doesn't specify
an explicit installation directory. *)
val roots : t -> Path.t option Install.Roots.t Memo.t
val roots : ?only_setup:bool -> t -> Path.t option Install.Roots.t Memo.t

val host : t -> t Memo.t

Expand Down

0 comments on commit 4745e04

Please sign in to comment.