Rename Shared_stanaza to Dune_env
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
78786e09d4
commit
78e18716ce
|
@ -26,7 +26,7 @@ type t =
|
|||
; for_host : t option
|
||||
; implicit : bool
|
||||
; build_dir : Path.t
|
||||
; env_node : Shared_stanza.Env.t option
|
||||
; env_node : Dune_env.Stanza.t option
|
||||
; path : Path.t list
|
||||
; toplevel_path : Path.t option
|
||||
; ocaml_bin : Path.t
|
||||
|
|
|
@ -51,7 +51,7 @@ type t =
|
|||
build_dir : Path.t
|
||||
|
||||
; (** env node that this context was initialized with *)
|
||||
env_node : Shared_stanza.Env.t option
|
||||
env_node : Dune_env.Stanza.t option
|
||||
|
||||
; (** [PATH] *)
|
||||
path : Path.t list
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
open Import
|
||||
open Stanza.Of_sexp
|
||||
type stanza = Stanza.t = ..
|
||||
|
||||
let field_oslu name = Ordered_set_lang.Unexpanded.field name
|
||||
module Stanza = struct
|
||||
open Import
|
||||
open Stanza.Of_sexp
|
||||
|
||||
let field_oslu name = Ordered_set_lang.Unexpanded.field name
|
||||
|
||||
module Env = struct
|
||||
type config =
|
||||
{ flags : Ordered_set_lang.Unexpanded.t
|
||||
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
||||
|
@ -40,7 +42,8 @@ module Env = struct
|
|||
loc >>= fun loc ->
|
||||
repeat rule >>| fun rules ->
|
||||
{ loc; rules }
|
||||
|
||||
end
|
||||
|
||||
type Stanza.t +=
|
||||
| Env of Env.t
|
||||
type stanza +=
|
||||
| T of Stanza.t
|
|
@ -1,6 +1,8 @@
|
|||
open Import
|
||||
|
||||
module Env : sig
|
||||
type stanza = Stanza.t = ..
|
||||
|
||||
module Stanza : sig
|
||||
type config =
|
||||
{ flags : Ordered_set_lang.Unexpanded.t
|
||||
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
||||
|
@ -19,5 +21,5 @@ module Env : sig
|
|||
val t : t Sexp.Of_sexp.t
|
||||
end
|
||||
|
||||
type Stanza.t +=
|
||||
| Env of Env.t
|
||||
type stanza +=
|
||||
| T of Stanza.t
|
|
@ -1592,6 +1592,7 @@ module Stanzas = struct
|
|||
(let%map () = Syntax.since Stanza.syntax (1, 0)
|
||||
and t = Tests.single in
|
||||
[Tests t])
|
||||
; "env", Dune_env.Stanza.t >>| fun x -> [Dune_env.T x]
|
||||
]
|
||||
|
||||
let jbuild_parser =
|
||||
|
@ -1663,7 +1664,7 @@ module Stanzas = struct
|
|||
in
|
||||
match
|
||||
List.filter_map stanzas
|
||||
~f:(function Shared_stanza.Env e -> Some e | _ -> None)
|
||||
~f:(function Dune_env.T e -> Some e | _ -> None)
|
||||
with
|
||||
| _ :: e :: _ ->
|
||||
Loc.fail e.loc "The 'env' stanza cannot appear more than once"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Shared_stanza
|
||||
(* open Dune_env.Stanza *)
|
||||
open Jbuild
|
||||
|
||||
module A = Action
|
||||
|
@ -29,7 +29,7 @@ module Env_node = struct
|
|||
{ dir : Path.t
|
||||
; inherit_from : t Lazy.t option
|
||||
; scope : Scope.t
|
||||
; config : Env.t
|
||||
; config : Dune_env.Stanza.t
|
||||
; mutable ocaml_flags : Ocaml_flags.t option
|
||||
}
|
||||
end
|
||||
|
@ -449,7 +449,7 @@ end = struct
|
|||
in
|
||||
let flags =
|
||||
match List.find_map node.config.rules ~f:(fun (pat, cfg) ->
|
||||
match (pat : Env.pattern), profile t with
|
||||
match (pat : Dune_env.Stanza.pattern), profile t with
|
||||
| Any, _ -> Some cfg
|
||||
| Profile a, b -> Option.some_if (a = b) cfg)
|
||||
with
|
||||
|
@ -629,7 +629,7 @@ let create
|
|||
List.iter stanzas
|
||||
~f:(fun { Dir_with_jbuild. ctx_dir; scope; stanzas; _ } ->
|
||||
List.iter stanzas ~f:(function
|
||||
| Env config ->
|
||||
| Dune_env.T config ->
|
||||
let inherit_from =
|
||||
if ctx_dir = Scope.root scope then
|
||||
context_env_node
|
||||
|
|
|
@ -45,11 +45,11 @@ module Context = struct
|
|||
{ loc : Loc.t
|
||||
; profile : string
|
||||
; targets : Target.t list
|
||||
; env : Shared_stanza.Env.t option
|
||||
; env : Dune_env.Stanza.t option
|
||||
}
|
||||
|
||||
let t ~profile =
|
||||
field_o "env" Shared_stanza.Env.t >>= fun env ->
|
||||
field_o "env" Dune_env.Stanza.t >>= fun env ->
|
||||
field "targets" (list Target.t) ~default:[Target.Native]
|
||||
>>= fun targets ->
|
||||
field "profile" string ~default:profile
|
||||
|
|
|
@ -13,7 +13,7 @@ module Context : sig
|
|||
{ loc : Loc.t
|
||||
; profile : string
|
||||
; targets : Target.t list
|
||||
; env : Shared_stanza.Env.t option
|
||||
; env : Dune_env.Stanza.t option
|
||||
}
|
||||
end
|
||||
module Opam : sig
|
||||
|
|
Loading…
Reference in New Issue