File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ module Config : sig
9393 val of_string : string -> t
9494 val of_flags : string list -> t
9595 val to_flags : jsoo_version :Version .t option -> t -> string list
96+ val remove_effect_flags : string list -> string list
9697end = struct
9798 type effects_backend =
9899 | Cps
@@ -243,6 +244,21 @@ end = struct
243244 | None -> None )
244245 ]
245246 ;;
247+
248+ let remove_effect_flags flags =
249+ let rec loop acc = function
250+ | [] -> acc
251+ | "--enable" :: "effects" :: rest -> loop acc rest
252+ | "--enable=effects" :: rest -> loop acc rest
253+ | "--disable" :: "effects" :: rest -> loop acc rest
254+ | "--disable=effects" :: rest -> loop acc rest
255+ | "--effects" :: _backend :: rest -> loop acc rest
256+ | maybe_effects :: rest when String. is_prefix maybe_effects ~prefix: " --effects=" ->
257+ loop acc rest
258+ | other :: rest -> loop (other :: acc) rest
259+ in
260+ loop [] flags |> List. rev
261+ ;;
246262end
247263
248264let install_jsoo_hint = " opam install js_of_ocaml-compiler"
@@ -325,6 +341,13 @@ let js_of_ocaml_rule
325341 | Link -> flags.link
326342 | Build_runtime -> flags.build_runtime
327343 in
344+ let flags =
345+ (* Avoid duplicating effect-related flags *)
346+ Action_builder. map flags ~f: (fun flags ->
347+ match config with
348+ | None -> flags
349+ | Some _ -> Config. remove_effect_flags flags)
350+ in
328351 Command. run_dyn_prog
329352 ~dir: (Path. build dir)
330353 jsoo
You can’t perform that action at this time.
0 commit comments