Rename Jbuild.Named to Jbuild.Bindings
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
bfc1b9fd25
commit
65e1aa0043
|
@ -929,7 +929,7 @@ module Gen(P : Install_rules.Params) = struct
|
|||
let module S = Sexp.To_sexp in
|
||||
Sexp.List
|
||||
[ Sexp.unsafe_atom_of_string "user-alias"
|
||||
; Jbuild.Named.sexp_of_t Jbuild.Dep_conf.sexp_of_t alias_conf.deps
|
||||
; Jbuild.Bindings.sexp_of_t Jbuild.Dep_conf.sexp_of_t alias_conf.deps
|
||||
; S.option Action.Unexpanded.sexp_of_t
|
||||
(Option.map alias_conf.action ~f:snd)
|
||||
]
|
||||
|
@ -976,7 +976,7 @@ module Gen(P : Install_rules.Params) = struct
|
|||
let rule =
|
||||
{ Rule.
|
||||
targets = Infer
|
||||
; deps = Named.empty
|
||||
; deps = Bindings.empty
|
||||
; action =
|
||||
(loc, Action.Unexpanded.Redirect (Stdout, diff.file2, run_action))
|
||||
; mode = Standard
|
||||
|
|
|
@ -214,7 +214,7 @@ include Sub_system.Register_end_point(
|
|||
~init:extra_vars
|
||||
~f:(fun acc (k, v) -> String.Map.add acc k v)
|
||||
in
|
||||
Build.return Named.empty
|
||||
Build.return Bindings.empty
|
||||
>>>
|
||||
Build.all
|
||||
(List.filter_map backends ~f:(fun (backend : Backend.t) ->
|
||||
|
|
|
@ -232,7 +232,7 @@ module Pps_and_flags = struct
|
|||
Dune_syntax.t
|
||||
end
|
||||
|
||||
module Named = struct
|
||||
module Bindings = struct
|
||||
type 'a one =
|
||||
| Unnamed of 'a
|
||||
| Named of string * 'a list
|
||||
|
@ -1140,7 +1140,7 @@ module Rule = struct
|
|||
|
||||
type t =
|
||||
{ targets : Targets.t
|
||||
; deps : Dep_conf.t Named.t
|
||||
; deps : Dep_conf.t Bindings.t
|
||||
; action : Loc.t * Action.Unexpanded.t
|
||||
; mode : Mode.t
|
||||
; locks : String_with_vars.t list
|
||||
|
@ -1182,7 +1182,7 @@ module Rule = struct
|
|||
let short_form =
|
||||
located Action.Unexpanded.t >>| fun (loc, action) ->
|
||||
{ targets = Infer
|
||||
; deps = Named.empty
|
||||
; deps = Bindings.empty
|
||||
; action = (loc, action)
|
||||
; mode = Standard
|
||||
; locks = []
|
||||
|
@ -1195,7 +1195,7 @@ module Rule = struct
|
|||
>>= fun action ->
|
||||
field "targets" (list file_in_current_dir)
|
||||
>>= fun targets ->
|
||||
field "deps" (Named.t Dep_conf.t) ~default:Named.empty
|
||||
field "deps" (Bindings.t Dep_conf.t) ~default:Bindings.empty
|
||||
>>= fun deps ->
|
||||
field "locks" (list String_with_vars.t) ~default:[] >>= fun locks ->
|
||||
map_validate
|
||||
|
@ -1301,7 +1301,7 @@ module Rule = struct
|
|||
let src = name ^ ".mll" in
|
||||
let dst = name ^ ".ml" in
|
||||
{ targets = Static [dst]
|
||||
; deps = Named.singleton (Dep_conf.File (S.virt_text __POS__ src))
|
||||
; deps = Bindings.singleton (Dep_conf.File (S.virt_text __POS__ src))
|
||||
; action =
|
||||
(loc,
|
||||
Chdir
|
||||
|
@ -1322,7 +1322,7 @@ module Rule = struct
|
|||
List.map modules ~f:(fun name ->
|
||||
let src = name ^ ".mly" in
|
||||
{ targets = Static [name ^ ".ml"; name ^ ".mli"]
|
||||
; deps = Named.singleton (Dep_conf.File (S.virt_text __POS__ src))
|
||||
; deps = Bindings.singleton (Dep_conf.File (S.virt_text __POS__ src))
|
||||
; action =
|
||||
(loc,
|
||||
Chdir
|
||||
|
@ -1390,7 +1390,7 @@ end
|
|||
module Alias_conf = struct
|
||||
type t =
|
||||
{ name : string
|
||||
; deps : Dep_conf.t Named.t
|
||||
; deps : Dep_conf.t Bindings.t
|
||||
; action : (Loc.t * Action.Unexpanded.t) option
|
||||
; locks : String_with_vars.t list
|
||||
; package : Package.t option
|
||||
|
@ -1409,7 +1409,7 @@ module Alias_conf = struct
|
|||
field_o "package" Pkg.t >>= fun package ->
|
||||
field_o "action" (located Action.Unexpanded.t) >>= fun action ->
|
||||
field "locks" (list String_with_vars.t) ~default:[] >>= fun locks ->
|
||||
field "deps" (Named.t Dep_conf.t) ~default:Named.empty
|
||||
field "deps" (Bindings.t Dep_conf.t) ~default:Bindings.empty
|
||||
>>= fun deps ->
|
||||
return
|
||||
{ name
|
||||
|
@ -1425,7 +1425,7 @@ module Tests = struct
|
|||
{ exes : Executables.t
|
||||
; locks : String_with_vars.t list
|
||||
; package : Package.t option
|
||||
; deps : Dep_conf.t Named.t
|
||||
; deps : Dep_conf.t Bindings.t
|
||||
}
|
||||
|
||||
let gen_parse names =
|
||||
|
@ -1433,11 +1433,12 @@ module Tests = struct
|
|||
(Buildable.t >>= fun buildable ->
|
||||
field_oslu "link_flags" >>= fun link_flags ->
|
||||
names >>= fun names ->
|
||||
field "deps" (Named.t Dep_conf.t) ~default:Named.empty >>= fun deps ->
|
||||
field_o "package" Pkg.t >>= fun package ->
|
||||
field "locks" (list String_with_vars.t) ~default:[] >>= fun locks ->
|
||||
field "modes" Executables.Link_mode.Set.t
|
||||
~default:Executables.Link_mode.Set.default >>= fun modes ->
|
||||
field "deps" (Bindings.t Dep_conf.t) ~default:Bindings.empty
|
||||
>>= fun deps ->
|
||||
return
|
||||
{ exes =
|
||||
{ Executables.
|
||||
|
|
|
@ -81,7 +81,7 @@ module Lib_deps : sig
|
|||
val of_pps : Pp.t list -> t
|
||||
end
|
||||
|
||||
module Named : sig
|
||||
module Bindings : sig
|
||||
type 'a one =
|
||||
| Unnamed of 'a
|
||||
| Named of string * 'a list
|
||||
|
@ -304,7 +304,7 @@ module Rule : sig
|
|||
|
||||
type t =
|
||||
{ targets : Targets.t
|
||||
; deps : Dep_conf.t Named.t
|
||||
; deps : Dep_conf.t Bindings.t
|
||||
; action : Loc.t * Action.Unexpanded.t
|
||||
; mode : Mode.t
|
||||
; locks : String_with_vars.t list
|
||||
|
@ -327,7 +327,7 @@ end
|
|||
module Alias_conf : sig
|
||||
type t =
|
||||
{ name : string
|
||||
; deps : Dep_conf.t Named.t
|
||||
; deps : Dep_conf.t Bindings.t
|
||||
; action : (Loc.t * Action.Unexpanded.t) option
|
||||
; locks : String_with_vars.t list
|
||||
; package : Package.t option
|
||||
|
@ -370,7 +370,7 @@ module Tests : sig
|
|||
{ exes : Executables.t
|
||||
; locks : String_with_vars.t list
|
||||
; package : Package.t option
|
||||
; deps : Dep_conf.t Named.t
|
||||
; deps : Dep_conf.t Bindings.t
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ let lint_module sctx ~dir ~dep_kind ~lint ~lib_name ~scope ~dir_kind =
|
|||
let src_path = Path.relative dir src.name in
|
||||
add_alias src.name
|
||||
(Build.path src_path
|
||||
>>^ (fun _ -> Jbuild.Named.singleton src_path)
|
||||
>>^ (fun _ -> Jbuild.Bindings.singleton src_path)
|
||||
>>> SC.Action.run sctx
|
||||
action
|
||||
~loc
|
||||
|
@ -531,7 +531,7 @@ let make sctx ~dir ~dep_kind ~lint ~preprocess
|
|||
(preprocessor_deps
|
||||
>>>
|
||||
Build.path src
|
||||
>>^ (fun _ -> Jbuild.Named.singleton src)
|
||||
>>^ (fun _ -> Jbuild.Bindings.singleton src)
|
||||
>>>
|
||||
SC.Action.run sctx
|
||||
(Redirect
|
||||
|
|
|
@ -528,28 +528,18 @@ module Deps = struct
|
|||
>>^ List.concat
|
||||
|
||||
let interpret_named t ~scope ~dir bindings =
|
||||
let unnamed x = Jbuild.Named.Unnamed x in
|
||||
let unnamed x = Jbuild.Bindings.Unnamed x in
|
||||
List.map bindings ~f:(function
|
||||
| Jbuild.Named.Unnamed p ->
|
||||
| Jbuild.Bindings.Unnamed p ->
|
||||
dep t ~scope ~dir p >>^ unnamed
|
||||
| Named (s, ps) ->
|
||||
List.map ~f:(dep t ~scope ~dir) ps
|
||||
|> Build.all
|
||||
>>^ (fun deps -> Jbuild.Named.Named (s, deps)))
|
||||
>>^ (fun deps -> Jbuild.Bindings.Named (s, deps)))
|
||||
|> Build.all
|
||||
>>^ List.concat_map ~f:(function
|
||||
| Jbuild.Named.Unnamed s -> List.map s ~f:unnamed
|
||||
| Jbuild.Bindings.Unnamed s -> List.map s ~f:unnamed
|
||||
| Named (s, ps) -> [Named (s, List.concat ps)])
|
||||
|
||||
(* let unnamed = deps (Jbuild.Named.unnamed bindings) in
|
||||
* let named =
|
||||
* String.Map.to_list named
|
||||
* |> List.map ~f:(fun (k, d) -> deps d >>^ fun d -> (k, d))
|
||||
* |> Build.all
|
||||
* >>^ String.Map.of_list_exn
|
||||
* in
|
||||
* unnamed &&& named >>^ fun (unnamed, named) ->
|
||||
* { Named.unnamed; named } *)
|
||||
end
|
||||
|
||||
module Pkg_version = struct
|
||||
|
@ -780,7 +770,7 @@ module Action = struct
|
|||
(t, acc)
|
||||
|
||||
let expand_step2 ~dir ~dynamic_expansions
|
||||
~(deps_written_by_user : Path.t Jbuild.Named.t)
|
||||
~(deps_written_by_user : Path.t Jbuild.Bindings.t)
|
||||
~map_exe t =
|
||||
U.Partial.expand t ~dir ~map_exe ~f:(fun var syntax_version ->
|
||||
let key = String_with_vars.Var.full_name var in
|
||||
|
@ -792,17 +782,17 @@ module Action = struct
|
|||
Pform.Map.expand Pform.Map.static_vars ~syntax_version ~var
|
||||
with
|
||||
| None ->
|
||||
Jbuild.Named.find deps_written_by_user key
|
||||
Jbuild.Bindings.find deps_written_by_user key
|
||||
|> Option.map ~f:Value.L.paths
|
||||
| Some x ->
|
||||
begin match x with
|
||||
Pform.Var.Deps ->
|
||||
deps_written_by_user
|
||||
|> Jbuild.Named.to_list
|
||||
|> Jbuild.Bindings.to_list
|
||||
|> Value.L.paths
|
||||
|> Option.some
|
||||
| First_dep ->
|
||||
begin match Jbuild.Named.first deps_written_by_user with
|
||||
begin match Jbuild.Bindings.first deps_written_by_user with
|
||||
| Error `Named_exists ->
|
||||
Loc.fail loc "%%{first-dep} is not allowed with named dependencies"
|
||||
| Error `Empty ->
|
||||
|
@ -819,7 +809,7 @@ module Action = struct
|
|||
|
||||
let run sctx ~loc ?(extra_vars=String.Map.empty)
|
||||
t ~dir ~dep_kind ~targets:targets_written_by_user ~scope
|
||||
: (Path.t Named.t, Action.t) Build.t =
|
||||
: (Path.t Bindings.t, Action.t) Build.t =
|
||||
let map_exe = map_exe sctx in
|
||||
if targets_written_by_user = Alias then begin
|
||||
match Action.Infer.unexpanded_targets t with
|
||||
|
|
|
@ -224,8 +224,8 @@ module Deps : sig
|
|||
: t
|
||||
-> scope:Scope.t
|
||||
-> dir:Path.t
|
||||
-> Dep_conf.t Named.t
|
||||
-> (unit, Path.t Named.t) Build.t
|
||||
-> Dep_conf.t Bindings.t
|
||||
-> (unit, Path.t Bindings.t) Build.t
|
||||
end
|
||||
|
||||
(** Interpret action written in jbuild files *)
|
||||
|
@ -245,7 +245,7 @@ module Action : sig
|
|||
-> dep_kind:Build.lib_dep_kind
|
||||
-> targets:targets
|
||||
-> scope:Scope.t
|
||||
-> (Path.t Named.t, Action.t) Build.t
|
||||
-> (Path.t Bindings.t, Action.t) Build.t
|
||||
end
|
||||
|
||||
module Pkg_version : sig
|
||||
|
|
Loading…
Reference in New Issue