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