Remove path-no-dep syntax

See #944

Signed-off-by: Etienne Millon <etienne@cryptosense.com>
This commit is contained in:
Etienne Millon 2018-07-03 13:54:39 +02:00
parent 9ece73dadc
commit 35ff6466de
12 changed files with 42 additions and 34 deletions

View File

@ -112,6 +112,8 @@ next
- Rename `path:file` to `dep:file` (#944, @emillon)
- Remove `path-no-dep:file` (#948, @emillon)
1.0+beta20 (10/04/2018)
-----------------------

View File

@ -830,12 +830,8 @@ In addition, ``(action ...)`` fields support the following special variables:
- ``<`` expands to the first dependency, or the empty string if there are no
dependencies
- ``^`` expands to the list of dependencies, separated by spaces
- ``dep:<path>`` expands to ``<path>``
- ``path-no-dep:<path>`` is the same as ``path:<path>``, except that
``<path>`` is not considered as a dependency of the action. For instance
``(chdir ${ROOT} (run foo --base ${path-no-dep:bar}))`` in ``src/blah/jbuild``
will expand to ``(chdir ../.. (run foo --base src/blah/bar))`` where
``src/blah/bar`` doesn't have to be an existing or buildable file
- ``dep:<path>`` expands to ``<path>`` (and adds ``<path>`` as a dependency of
the action)
- ``exe:<path>`` is the same as ``<path>``, except when cross-compiling, in
which case it will expand to ``<path>`` from the host build context
- ``bin:<program>`` expands to a path to ``program``. If ``program``

View File

@ -171,7 +171,11 @@ Jbuild Dune
``${^}`` ``%{deps}``
``${<}`` ``%{deps[0]}``
``${path:file}`` ``%{dep:file}``
``${path-no-dep:file}`` ``%{path:file}``
``${SCOPE_ROOT}`` ``%{project_root}``
``${findlib:..}`` ``%{lib:..}``
======================== ============
Removed Variables
-----------------
``${path-no-dep:file}`` has been removed.

View File

@ -644,7 +644,7 @@ module Action = struct
Loc.fail
loc
"${dep:%s} is not supported in jbuild files.\n\
Did you mean: ${path:%s}"
Hint: Did you mean ${path:%s} instead?"
s
s
| Pair ("bin", s) -> begin
@ -755,7 +755,12 @@ module Action = struct
| _ ->
match String_with_vars.Var.destruct var with
| Pair ("path-no-dep", s) ->
Some (path_exp (Path.relative dir s))
if syntax_version < (1, 0) then
Some (path_exp (Path.relative dir s))
else
Loc.fail
loc
"The ${path-no-dep:...} syntax has been removed from dune."
| _ ->
let exp = expand var syntax_version in
Option.iter exp ~f:(fun vs ->

View File

@ -1,16 +1,16 @@
$ dune clean --display short
$ dune build --display short @just-in-src
running in src
running in .
$ dune clean --display short
$ dune build --display short @everywhere
running in src/foo/bar
running in src/foo/baz
running in src
running in bar
running in baz
running in .
$ dune clean --display short
$ dune build --display short @x
running in src/foo/bar
running in src/foo/baz
running in src
running in bar
running in baz
running in .
$ dune build --display short @plop
From the command line:
Error: Alias "plop" is empty.

View File

@ -1,3 +1,3 @@
(alias
(name x)
(action (chdir %{ROOT} (echo "running in %{path-no-dep:.}\n"))))
(action (chdir %{ROOT} (echo "running in .\n"))))

View File

@ -1,3 +1,3 @@
(alias
(name x)
(action (chdir %{ROOT} (echo "running in %{path-no-dep:.}\n"))))
(action (chdir %{ROOT} (echo "running in bar\n"))))

View File

@ -1,3 +1,3 @@
(alias
(name x)
(action (chdir %{ROOT} (echo "running in %{path-no-dep:.}\n"))))
(action (chdir %{ROOT} (echo "running in baz\n"))))

View File

@ -0,0 +1,8 @@
(alias
(name test-path-no-dep)
(action
(chdir
sub-tree/dir
(progn
(echo "%{path-no-dep:file-that-does-not-exist}\n")
(echo "%{path-no-dep:.}\n")))))

View File

@ -0,0 +1 @@
(lang dune 1.0)

View File

@ -12,12 +12,3 @@
(progn
(echo "%{path:file-that-does-not-exist}\n")
(echo "%{path:.}\n")))))
(alias
(name test-path-no-dep)
(action
(chdir
sub-tree/dir
(progn
(echo "%{path-no-dep:file-that-does-not-exist}\n")
(echo "%{path-no-dep:.}\n")))))

View File

@ -13,12 +13,13 @@ In expands to a file name, and registers this as a dependency.
%{path-no-dep:string}
---------------------
It expands to a file name, but does not register it as a dependency.
This form does not exist, but displays an hint:
$ dune build --root dune @test-path-no-dep
Entering directory 'dune'
../../file-that-does-not-exist
../..
$ dune build --root dune-invalid @test-path-no-dep
Entering directory 'dune-invalid'
File "dune", line 7, characters 17-54:
Error: The ${path-no-dep:...} syntax has been removed from dune.
[1]
jbuild files
============
@ -51,5 +52,5 @@ This form does not exist, but displays an hint:
Entering directory 'jbuild-invalid'
File "jbuild", line 5, characters 16-37:
Error: ${dep:generated-file} is not supported in jbuild files.
Did you mean: ${path:generated-file}
Hint: Did you mean ${path:generated-file} instead?
[1]