Make Ocaml_flags.t abstract

This commit is contained in:
David Allsopp 2017-06-14 17:06:56 +02:00 committed by Jérémie Dimino
parent ea377efbbb
commit 712981d847
3 changed files with 15 additions and 8 deletions

View File

@ -275,7 +275,7 @@ module Gen(P : Params) = struct
~js_of_ocaml
~dynlink
~sandbox:alias_module_build_sandbox
~flags:{ flags with common = flags.common @ ["-w"; "-49"] }
~flags:(Ocaml_flags.append_common flags ["-w"; "-49"])
~dir
~modules:(String_map.singleton m.name m)
~dep_graph:(Ml_kind.Dict.make_both (Build.return (String_map.singleton m.name [])))
@ -398,8 +398,8 @@ module Gen(P : Params) = struct
let flags =
match alias_module with
| None -> flags.common
| Some m -> "-open" :: m.name :: flags.common
| None -> Ocaml_flags.common flags
| Some m -> Ocaml_flags.prepend_common ["-open"; m.name] flags |> Ocaml_flags.common
in
{ Merlin.
requires = real_requires
@ -498,7 +498,7 @@ module Gen(P : Params) = struct
~force_custom_bytecode:(mode = Native && not exes.modes.native)));
{ Merlin.
requires = real_requires
; flags = flags.common
; flags = Ocaml_flags.common flags
; preprocess = Buildable.single_preprocess exes.buildable
; libname = None
}

View File

@ -56,3 +56,9 @@ let default () =
; native = default_ocamlopt_flags ()
}
}
let append_common t flags = {t with common = t.common @ flags}
let prepend_common flags t = {t with common = flags @ t.common}
let common t = t.common

View File

@ -1,9 +1,6 @@
(** OCaml flags *)
type t =
{ common : string list
; specific : string list Mode.Dict.t
}
type t
val make : Jbuild.Buildable.t -> t
@ -12,3 +9,7 @@ val default : unit -> t
val get : t -> Mode.t -> _ Arg_spec.t
val get_for_cm : t -> cm_kind:Cm_kind.t -> _ Arg_spec.t
val append_common : t -> string list -> t
val prepend_common : string list -> t -> t
val common : t -> string list