From 35ff6466deb95c54564901c7254b31a1c8d4ec88 Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Tue, 3 Jul 2018 13:54:39 +0200 Subject: [PATCH] Remove path-no-dep syntax See #944 Signed-off-by: Etienne Millon --- CHANGES.md | 2 ++ doc/dune-files.rst | 8 ++------ doc/migration.rst | 6 +++++- src/super_context.ml | 9 +++++++-- test/blackbox-tests/test-cases/aliases/run.t | 14 +++++++------- test/blackbox-tests/test-cases/aliases/src/dune | 2 +- .../test-cases/aliases/src/foo/bar/dune | 2 +- .../test-cases/aliases/src/foo/baz/dune | 2 +- .../test-cases/path-variables/dune-invalid/dune | 8 ++++++++ .../path-variables/dune-invalid/dune-project | 1 + .../test-cases/path-variables/dune/dune | 9 --------- .../blackbox-tests/test-cases/path-variables/run.t | 13 +++++++------ 12 files changed, 42 insertions(+), 34 deletions(-) create mode 100644 test/blackbox-tests/test-cases/path-variables/dune-invalid/dune create mode 100644 test/blackbox-tests/test-cases/path-variables/dune-invalid/dune-project diff --git a/CHANGES.md b/CHANGES.md index b961f606..ca6f7943 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) ----------------------- diff --git a/doc/dune-files.rst b/doc/dune-files.rst index b07bb7e3..7464ff35 100644 --- a/doc/dune-files.rst +++ b/doc/dune-files.rst @@ -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:`` expands to ```` -- ``path-no-dep:`` is the same as ``path:``, except that - ```` 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:`` expands to ```` (and adds ```` as a dependency of + the action) - ``exe:`` is the same as ````, except when cross-compiling, in which case it will expand to ```` from the host build context - ``bin:`` expands to a path to ``program``. If ``program`` diff --git a/doc/migration.rst b/doc/migration.rst index 4553a4d0..06ad462b 100644 --- a/doc/migration.rst +++ b/doc/migration.rst @@ -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. diff --git a/src/super_context.ml b/src/super_context.ml index c6273ae7..d7632d44 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -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 -> diff --git a/test/blackbox-tests/test-cases/aliases/run.t b/test/blackbox-tests/test-cases/aliases/run.t index 78573784..4bad37e7 100644 --- a/test/blackbox-tests/test-cases/aliases/run.t +++ b/test/blackbox-tests/test-cases/aliases/run.t @@ -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. diff --git a/test/blackbox-tests/test-cases/aliases/src/dune b/test/blackbox-tests/test-cases/aliases/src/dune index e2079593..20302805 100644 --- a/test/blackbox-tests/test-cases/aliases/src/dune +++ b/test/blackbox-tests/test-cases/aliases/src/dune @@ -1,3 +1,3 @@ (alias (name x) - (action (chdir %{ROOT} (echo "running in %{path-no-dep:.}\n")))) + (action (chdir %{ROOT} (echo "running in .\n")))) diff --git a/test/blackbox-tests/test-cases/aliases/src/foo/bar/dune b/test/blackbox-tests/test-cases/aliases/src/foo/bar/dune index e2079593..7ccf02de 100644 --- a/test/blackbox-tests/test-cases/aliases/src/foo/bar/dune +++ b/test/blackbox-tests/test-cases/aliases/src/foo/bar/dune @@ -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")))) diff --git a/test/blackbox-tests/test-cases/aliases/src/foo/baz/dune b/test/blackbox-tests/test-cases/aliases/src/foo/baz/dune index e2079593..ff87541b 100644 --- a/test/blackbox-tests/test-cases/aliases/src/foo/baz/dune +++ b/test/blackbox-tests/test-cases/aliases/src/foo/baz/dune @@ -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")))) diff --git a/test/blackbox-tests/test-cases/path-variables/dune-invalid/dune b/test/blackbox-tests/test-cases/path-variables/dune-invalid/dune new file mode 100644 index 00000000..2e49a748 --- /dev/null +++ b/test/blackbox-tests/test-cases/path-variables/dune-invalid/dune @@ -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"))))) diff --git a/test/blackbox-tests/test-cases/path-variables/dune-invalid/dune-project b/test/blackbox-tests/test-cases/path-variables/dune-invalid/dune-project new file mode 100644 index 00000000..de4fc209 --- /dev/null +++ b/test/blackbox-tests/test-cases/path-variables/dune-invalid/dune-project @@ -0,0 +1 @@ +(lang dune 1.0) diff --git a/test/blackbox-tests/test-cases/path-variables/dune/dune b/test/blackbox-tests/test-cases/path-variables/dune/dune index 6d5c2c34..106c8116 100644 --- a/test/blackbox-tests/test-cases/path-variables/dune/dune +++ b/test/blackbox-tests/test-cases/path-variables/dune/dune @@ -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"))))) diff --git a/test/blackbox-tests/test-cases/path-variables/run.t b/test/blackbox-tests/test-cases/path-variables/run.t index 69a6cad2..ccaca183 100644 --- a/test/blackbox-tests/test-cases/path-variables/run.t +++ b/test/blackbox-tests/test-cases/path-variables/run.t @@ -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]