Open rdavison opened 5 years ago
No, it is not possible. I suppose the easiest way to make that work would be to add the same hack in ppxlib directly.
@rdavidson see #2262 for a solution
Appears that there is a viable work around.
What is the syntax for the workaround currently? I tried
(preprocess (pps ppxlib.metaquot -- -pp %{bin:ocaml-syntax-shims}))
but the result is that the ASTs in my project appear to be empty.
src/ppx/dune
is(ocamllex exclude_lexer)
(ocamlyacc exclude_parser)
(library
(name bisect_ppx)
(public_name bisect_ppx)
(kind ppx_rewriter)
(instrumentation.backend (ppx bisect_ppx))
(synopsis "Code coverage for OCaml")
(ppx_runtime_libraries bisect_ppx.runtime)
(preprocess (pps ppxlib.metaquot -- -pp %{bin:ocaml-syntax-shims}))
(flags (:standard -open Ocaml_shadow))
(libraries bisect_ppx.common ppxlib str))
Note the -- -pp %{bin:ocaml-syntax-shims}
.
I then run
$ ocamlc _build/default/src/ppx/instrument.pp.ml -dparsetree 2>&1 | wc -l
The result is 87, way too few lines for the expected AST from instrument.ml
. By comparison, without ocaml-syntax-shims,
$ ocamlc _build/default/src/ppx/instrument.pp.ml -dparsetree 2>&1 | wc -l
shows 19611 lines.
It does not appear that this issue has been fixed, or I am not able to understand how to use the workaround. cc @aalekseyev @Dean117, is this workaround working for you today in some way?
It appears I am able to reopen this issue. Not sure if that's appropriate -- please just close again if not!
This was Dune 3.7.1, OCaml 4.13.1, ocaml-syntax-shims 1.0.0.
@aantron The issue is that %{bin:...}
is not being expanded correctly in the preprocess field. To get around this you can copy the binary and directly mention the copy instead.
https://github.com/ocaml/dune/issues/2262#issuecomment-500422366
It might be worth keeping this open actually as it might be something that @anmonteiro can support with https://github.com/ocaml/dune/pull/7373.
We couldn't get copy
to work either. I don't have the exact error message immediately available right now.
Is there some way to specify
(preprocess future_syntax)
in combination with other preprocessors? None of the following seem to work: