Adding both action and PPS in preprocess - Dune file

Hey everyone,

I am new to OCaml and wanted to know how can i add two preprocess in my dune file. Here’s the dune file and my use case is to add (pps ppx_deriving_yojson) in preprocess -

 (name ml)
 (wrapped false)
   (run %{bin:cppo} %{env:CPPO_FLAGS=} %{input-file})))
  (:standard -w +a-4-42-40-41-44-45-9-48-67-70))
 (libraries ext js_parser))

(ocamllex lexer)

This is not possible at the moment. See Preprocess using both cppo and PPXs · Issue #171 · ocaml/dune · GitHub. There’s an implementation at feat: allow preprocessing action chains before `pps` by anmonteiro · Pull Request #7373 · ocaml/dune · GitHub but which has stalled.

Is there any workaround for this? My usecase is to add (pps ppx_deriving_yojson) so that i can use [@@deriving to_yojson] on various types defined.

Or this there any other alternative that i can use to get json from any OCaml type?

you can try to separate the parts that require cppo from the parts that require ppx.

How to do that? This dune file is of a package that i have vendored and don’t know much about their implementation.

No, I won’t join your meeting link. I can’t help you more. If this is an assignment, ask your supervisor. Thanks