Completely get rid of first-dep

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-07-09 16:18:49 +01:00 committed by Rudi Grinberg
parent 04f62ecc03
commit df15d30845
7 changed files with 52 additions and 18 deletions

View File

@ -169,7 +169,6 @@ Jbuild Dune
======================== ============
``${@}`` ``%{targets}``
``${^}`` ``%{deps}``
``${<}`` ``%{first-dep}``
``${path:file}`` ``%{dep:file}``
``${SCOPE_ROOT}`` ``%{project_root}``
``${findlib:..}`` ``%{lib:..}``
@ -186,8 +185,26 @@ Jbuild Dune
Removed Variables
-----------------
``${path-no-dep:file}`` has been removed.
``${path-no-dep:file}`` and ``${<}`` have been removed.
A named dependency should be used instead of ``${<}``. For instance
the following jbuild file:
.. code:: scheme
(alias
((name runtest)
(deps (input))
(action (run ./test.exe %{<}))))
should be rewritten to the following dune file:
.. code:: scheme
(alias
(name runtest)
(deps (:x input))
(action (run ./test.exe %{x})))
``# JBUILDER_GEN`` renamed
--------------------------

View File

@ -1307,7 +1307,7 @@ module Rule = struct
[ S.virt_text __POS__ "-q"
; S.virt_text __POS__ "-o"
; S.virt_var __POS__ "targets"
; S.virt_var __POS__"first-dep-tmp"
; S.virt_var __POS__"deps"
])))
; mode
; locks = []
@ -1328,7 +1328,7 @@ module Rule = struct
Chdir
(S.virt_var __POS__ "root",
Run (S.virt_text __POS__ "ocamlyacc",
[S.virt_var __POS__ "first-dep-tmp"])))
[S.virt_var __POS__ "deps"])))
; mode
; locks = []
; loc

View File

@ -36,24 +36,24 @@ end
type 'a t =
| No_info of 'a
| Since of 'a * Syntax.Version.t
| Deleted_in of 'a * Syntax.Version.t
| Deleted_in of 'a * Syntax.Version.t * string option
| Renamed_in of Syntax.Version.t * string
module Map = struct
type nonrec 'a t = 'a t String.Map.t
let values v = No_info (Var.Values v)
let renamed_in ~new_name ~version = Renamed_in (version, new_name)
let deleted_in ~version kind = Deleted_in (kind, version)
let since ~version v = Since (v, version)
let values v = No_info (Var.Values v)
let renamed_in ~new_name ~version = Renamed_in (version, new_name)
let deleted_in ~version ?repl kind = Deleted_in (kind, version, repl)
let since ~version v = Since (v, version)
let static_vars =
[ "first-dep", since ~version:(1, 0) Var.First_dep
; "targets", since ~version:(1, 0) Var.Targets
[ "targets", since ~version:(1, 0) Var.Targets
; "deps", since ~version:(1, 0) Var.Deps
; "project_root", since ~version:(1, 0) Var.Project_root
; "<", renamed_in ~version:(1, 0) ~new_name:"first-dep"
; "<", deleted_in Var.Deps ~version:(1, 0)
~repl:"Use a named dependency instead: (:<name> <dep>)"
; "@", renamed_in ~version:(1, 0) ~new_name:"targets"
; "^", renamed_in ~version:(1, 0) ~new_name:"deps"
; "SCOPE_ROOT", renamed_in ~version:(1, 0) ~new_name:"project_root"
@ -167,10 +167,10 @@ module Map = struct
expand t ~syntax_version:in_version
~var:(String_with_vars.Var.with_name var ~name:new_name)
end
| Deleted_in (v, in_version) ->
| Deleted_in (v, in_version, repl) ->
if syntax_version < in_version then
Some v
else
Syntax.Error.deleted_in (String_with_vars.Var.loc var)
Stanza.syntax syntax_version ~what:(what var))
Stanza.syntax syntax_version ~what:(what var) ?repl)
end

View File

@ -28,7 +28,7 @@ end
type 'a t =
| No_info of 'a
| Since of 'a * Syntax.Version.t
| Deleted_in of 'a * Syntax.Version.t
| Deleted_in of 'a * Syntax.Version.t * string option
| Renamed_in of Syntax.Version.t * string
module Map : sig

View File

@ -65,9 +65,12 @@ module Error = struct
Loc.fail loc "%s was renamed to '%s' in the %s version of %s"
what to_ (Version.to_string ver) t.desc
let deleted_in loc t ver ~what =
Loc.fail loc "%s was deleted in version %s of %s"
let deleted_in loc t ?repl ver ~what =
Loc.fail loc "%s was deleted in version %s of %s%s"
what (Version.to_string ver) t.desc
(match repl with
| None -> ""
| Some s -> ".\n" ^ s)
end

View File

@ -25,7 +25,13 @@ module Error : sig
val renamed_in : Loc.t -> t -> Version.t -> what:string -> to_:string -> _
val deleted_in : Loc.t -> t -> Version.t -> what:string -> _
val deleted_in
: Loc.t
-> t
-> ?repl:string
-> Version.t
-> what:string
-> _
end
(** [create ~name ~desc supported_versions] defines a new

View File

@ -16,3 +16,11 @@
Error: 'link_executables' was deleted in version 1.0 of the dune language
[1]
$ rm -f dune
$ echo '(alias (name x) (deps x) (action (run %{<})))' > dune
$ dune build
File "dune", line 1, characters 40-42:
Error: %{<} was deleted in version 1.0 of the dune language.
Use a named dependency instead: (:<name> <dep>)
[1]
$ rm -f dune