Skip to content

Commit

Permalink
fix: apply reviews
Browse files Browse the repository at this point in the history
Signed-off-by: Etienne Marais <[email protected]>
  • Loading branch information
maiste authored and Leonidas-from-XIV committed Jan 17, 2025
1 parent 6a657f9 commit c0f9083
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions src/dune_rules/pkg_toolchain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ let is_compiler_and_toolchains_enabled name =
(* TODO don't hardcode these names here *)
[ Package_name.of_string "ocaml-base-compiler"
; Package_name.of_string "ocaml-variants"
; Package_name.of_string
"ocaml-compiler" (* HACK: This is required for ocaml.5.3.0 *)
; Package_name.of_string "ocaml-compiler"
(* The [ocaml-compiler] package is required to include all the
packages that might install a compiler, starting from ocaml.5.3.0.
*)
]
in
List.mem compiler_package_names name ~equal:Package_name.equal
Expand Down Expand Up @@ -163,34 +165,28 @@ let modify_install_action ~prefix ~suffix action =
else modify_install_action action ~installation_prefix:prefix ~suffix
;;

(* Create an empty config.cache file so other packages see that the
compiler package is installed. *)
let touch_config_cache =
Dune_lang.Action.Progn
[ Dune_lang.Action.Run
[ Slang.text "touch"
; Slang.concat
[ Slang.pform (Pform.Var (Pform.Var.Pkg Pform.Var.Pkg.Build))
; Slang.text "/config.cache"
]
]
; Dune_lang.Action.Run
[ Slang.text "touch"
; Slang.concat
[ Slang.pform (Pform.Var (Pform.Var.Pkg Pform.Var.Pkg.Build))
; Slang.text "/config.status"
]
]
let touch file =
Dune_lang.Action.Run
[ Slang.text "touch"
; Slang.concat
[ Slang.pform (Pform.Var (Pform.Var.Pkg Pform.Var.Pkg.Build)); Slang.text file ]
]
;;

(* Create an empty config.cache and config.status files so other packages see
that the compiler package is installed.
TODO: extract this from the .install *)
let touch_compiler_install =
Dune_lang.Action.Progn [ touch "/config.cache"; touch "/config.status" ]
;;

let modify_build_action ~prefix action =
let+ installed = Fs_memo.dir_exists prefix in
if installed
then
(* If the toolchain is already installed, just create config.cache file.
TODO(steve): Move this check to action execution time *)
touch_config_cache
touch_compiler_install
else action
;;

Expand Down

0 comments on commit c0f9083

Please sign in to comment.