Use the generic ppx driver support of Dune #40
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This feature is part of a larger work to remove the hard-coded knowledge of various ppx projects in Dune: ocaml/dune#576
Dune can link custom ppx drivers on demand. Currently, it hard-codes the fact that ocaml-migrate-parsetree and ppx_driver provide entry points for such drivers. This is not very satisfactory and it forces changes to the system to be synchronized between the various projects, which is painful.
Starting from Jbuilder 1.0+beta20, individual libraries will be able to declare themselves as ppx drivers and Dune will use this information to decide what driver to use and how to use it, i.e. what flags to pass it. One can declare that a library is a ppx driver by adding a
ppx.driver
field to the library stanza:We are doing this change in two steps: in Jbuilder 1.0+beta19 which is being released, the
ppx.driver
field is accepted and ignored. In Jbuilder 1.0+beta20, it will be used and Jbuilder will now longer have hard-coded knowledge of ocaml-migrate-parsetree and ppx_driver.This PR adds the
ppx.driver
field tosrc/jbuild
and bumps the version constraint on Dune to Jbuilder 1.0+beta19.Additionally, in the new system ppx_driver will automatically be selected as soon as one uses a ppx_driver based rewriter. As a result we need ppx_driver to accept all the command line flags accepted by the ocaml-migrate-parsetree driver. To do that, we need to retreive the command line arguments that where registered with the omp driver by individual rewriters. This PR adds functions to do that.