Skip to content

Commit

Permalink
Make an error with dune_lang >= 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Julow committed Sep 20, 2019
1 parent e5fd864 commit 0354e88
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/dune/preprocessing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,13 @@ let make sctx ~dir ~expander ~dep_kind ~lint ~preprocess ~preprocessor_deps
in
let preprocessor_deps =
let loc, deps = preprocessor_deps in
if (not (is_preprocessing preprocess)) && not (List.is_empty deps) then
User_warning.emit ~loc
( if (not (is_preprocessing preprocess)) && not (List.is_empty deps) then
let is_error = Dune_project.dune_version (Scope.project scope) >= (2, 0) in
User_warning.emit ~loc ~is_error
[ Pp.text
"This preprocessor_deps field will be ignored because no \
preprocessor is configured."
];
] );
SC.Deps.interpret sctx deps ~expander |> Build.memoize "preprocessor deps"
in
let lint_module =
Expand Down

This file was deleted.

12 changes: 12 additions & 0 deletions test/blackbox-tests/test-cases/unused-preprocessor-deps/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Should warn.

$ touch a.ml b.ml

$ echo "(lang dune 1.11)" > dune-project
$ echo "(allow_approximate_merlin)" >> dune-project
$ dune build
File "dune", line 5, characters 1-39:
5 | (preprocessor_deps does-not-exist.txt))
Expand All @@ -13,3 +16,12 @@ Should warn.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning: This preprocessor_deps field will be ignored because no preprocessor
is configured.

$ echo "(lang dune 2.0)" > dune-project
$ dune build
File "dune", line 5, characters 1-39:
5 | (preprocessor_deps does-not-exist.txt))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This preprocessor_deps field will be ignored because no preprocessor
is configured.
[1]

0 comments on commit 0354e88

Please sign in to comment.