Skip to content

Instantly share code, notes, and snippets.

@wokalski
Created August 26, 2019 07:38
Show Gist options
  • Save wokalski/1afe33936aaefbe0392cab26bd0a9a09 to your computer and use it in GitHub Desktop.
Save wokalski/1afe33936aaefbe0392cab26bd0a9a09 to your computer and use it in GitHub Desktop.
How to run a driver based ppx with bucklescript
  1. Create a dune file:
(library
 (public_name aggregate_ppx_name)
 (kind ppx_rewriter)
 (libraries ppx_deriving_protobuf other_ppx another_ppx))
  1. Build:
dune build --profile release
  1. Create a script (I called it ppx.exe) in the same directory as bsconfig.json. It'll containt all rewriters listed under libraries above:
./_build/install/default/lib/aggregate_ppx_name/ppx.exe --as-ppx "$@"
  1. Add your ./ppx.exe to bsconfig.json
  "ppx-flags": ["./ppx.exe"],

Note: the commands/paths are slightly different if you use esy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment