Skip to content

Commit

Permalink
fix: sandboxing of ppx for dialect
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Caglayan <alizter@gmail.com>
  • Loading branch information
Alizter committed Jul 16, 2023
1 parent 3bc6cce commit 5b58411
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 33 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Unreleased
- Add `dune build --dump-gc-stats FILE` argument to dump garbage collection
stats to a named file. (#8072, @Alizter)

- Fix bug with ppx and Reason syntax due to missing dependency in sandboxed
action (#7932, fixes #7930, @Alizter)

3.9.1 (2023-07-06)
------------------

Expand Down
4 changes: 4 additions & 0 deletions src/dune_rules/preprocessing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,10 @@ let pp_one_module sctx ~lib_name ~scope ~preprocessor_deps
; Path (Path.build dst)
; Command.Ml_kind.ppx_driver_flag ml_kind
; Dep (Path.build src)
; Hidden_deps
(Module.source m ~ml_kind |> Option.value_exn
|> Module.File.path |> Dep.file
|> Dep.Set.singleton)
; As flags
]
>>| Action.Full.add_sandbox sandbox))))
Expand Down
3 changes: 1 addition & 2 deletions test/blackbox-tests/test-cases/dune
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,4 @@
(applies_to reason-expect)
(deps
%{bin:refmt}
;(package ppx_expect)
))
(package ppx_expect)))
33 changes: 2 additions & 31 deletions test/blackbox-tests/test-cases/reason-expect.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,14 @@ Testing the interaction of reason syntax and ppx expect
> EOF

In https://github.com/ocaml/dune/issues/7930 there is an issue where reason
syntax and ppx_expect break at dune lang 3.3.

When dune lang is 3.2 everything should work as expected:
syntax and ppx_expect break at dune lang 3.3 due to the sandboxing of ppx.

$ cat > dune-project << EOF
> (lang dune 3.2)
> (lang dune 3.9)
> EOF

$ dune test
File "test.re", line 1, characters 0-0:
Error: Files _build/default/test.re and _build/default/test.re.corrected
differ.
[1]

However on dune lang 3.3 this appears to break:

$ cat > dune-project << EOF
> (lang dune 3.3)
> EOF

$ dune test
File "test.re", line 1:
Error: I/O error: test.re: No such file or directory
[1]

This appears to only happen for .re files:

$ rm test.re

$ cat > test.ml << EOF
> let%expect_test _ =
> print_endline "Hello, world!";
> [%expect {| |}]
> EOF

$ dune test
File "test.ml", line 1, characters 0-0:
Error: Files _build/default/test.ml and _build/default/test.ml.corrected
differ.
[1]

0 comments on commit 5b58411

Please sign in to comment.