Skip to content

Commit

Permalink
Merge pull request ocaml#1626 from nojb/multi-dir-preprocess-action
Browse files Browse the repository at this point in the history
Add test for using (include_subdirs unqualified) + (preprocess (action ...))
  • Loading branch information
rgrinberg authored Dec 11, 2018
2 parents b2bda53 + bb5a9d4 commit 0294a31
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ unreleased
- Generate `dune-package` files for every package. These files are installed and
read instead of `META` files whenever they are available (#1329, @rgrinberg)

- Fix preprocessing for libraries with `(include_subdirs ..)` (#1624, fix #1626,
@nojb, @rgrinberg)

1.6.2 (05/12/2018)
------------------

Expand Down
2 changes: 1 addition & 1 deletion src/preprocessing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ let make sctx ~dir ~expander ~dep_kind ~lint ~preprocess
~expander
~dep_kind
~targets:(Static [dst])
~targets_dir:dir))
~targets_dir:(Path.parent_exn dst)))
|> setup_reason_rules sctx in
if lint then lint_module ~ast ~source:m;
ast)
Expand Down
18 changes: 18 additions & 0 deletions test/blackbox-tests/test-cases/multi-dir/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,21 @@ Test some error cases
Error: This stanza is not allowed in a sub-directory of directory with (include_subdirs unqualified).
Hint: add (include_subdirs no) to this file.
[1]

Test for (include_subdir unqualified) with (preprocess (action ...))
--------------------------------------------------------------------

$ dune build --display short --root test4 @all
Entering directory 'test4'
ocamldep .main.eobjs/main.ml.d
ocamlc .main.eobjs/main.{cmi,cmo,cmt}
ocamlopt .main.eobjs/main.{cmx,o}
ocamlopt main.exe
main sub/foo.pp.ml
ocamldep .foo.objs/foo.pp.ml.d
ocamlc .foo.objs/foo.{cmi,cmo,cmt}
ocamlopt .foo.objs/foo.{cmx,o}
ocamlopt foo.{a,cmxa}
ocamlopt foo.cmxs
ocamlc main.bc
ocamlc foo.cma
10 changes: 10 additions & 0 deletions test/blackbox-tests/test-cases/multi-dir/test4/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(executable
(name main)
(modules main))

(library
(name foo)
(preprocess (action (run ./main.exe %{input-file})))
(modules foo))

(include_subdirs unqualified)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(lang dune 1.1)
2 changes: 2 additions & 0 deletions test/blackbox-tests/test-cases/multi-dir/test4/main.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
let () =
print_endline "print_endline \"foo\""
Empty file.

0 comments on commit 0294a31

Please sign in to comment.