-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting project-wide ppx flags configuration #10601
Comments
Seems alright. No reason to not allow this for this specific set of flags. |
I'll rephrase here something that came up in the linked issue that may be more relevant to this feature request: When trying to add a ppx driver flag systematically to all dune files in a repo, I ran into an issue where some instances of ppx drivers do not accept the same set of flags as in other directories. I am guessing this depends on which ppx are enabled in the I created two PRs where I make use of the new flag If the automatic addition of the flags is implemented in Another option is to make the new stanza more like a config rather than a pure flag list, if things get too confusing. idk. |
Yeah, that seems rather magical. If the set of flags depends on the preprocessors provided, then it's not really global and i'm not sure dune should help you here. |
OK yes, I agree. I'm not sure how many different ppx_driver kinds you can build with Given all this, I still think there's a case for a feature that lets specific pps always be called a certain way within a project. Here's a revised proposal for your consideration: (env
(dev
(pps_flags
(ppx_jane "-deriving-keep-w32=impl")
((ppx_john ppx_eve) "-some-john-and-eve-flag")
(ppx_eve "-some-special-eve-flag")))) The idea here is that this config would define a map from By the way, I'm using (env
(dev
(pps_flags
...
(ppx_js_style "-check-doc-comments")
...))) If you find this a bit too messy, I am also quite happy to keep exploring things on my side, and re-open this issue later if need be. Thank you! |
At first glance this seems like it's going to create you more work than it's ever going to save in the long run. Conceptually it's simple enough to understand for users though. |
You may be right about that! Besides, I'm currently working on a similar I'm inclined to cancel my feature request for now and reassess after making some progress with my setup. Sounds OK? Thank you for your time and for the discussion. |
Nothing wrong with your original issue, so there's no reason to close it. It's your call though. |
I thought about this a little more, and I think that this type of issue comes up very often. If you don't mind, I'll attempt to generalize to the following use case "I would like to configure a large set of projects in a consistent way". While we accept one off features to help out with that, I think the real way to solve is a feature that is more ambitious. For example #8707. If you think it would help, you are welcome to comment on it. |
That generalization makes sense to me. In spirit, configuring a large set of projects in a consistent way is a good part of dunolint's motivations, and I have made that connection myself. Thank you for pointing me to that dune Discussion, I wasn't aware. |
Circling back to that, would fixing ppxlib's driver to provide a consistent set of flags, regardless of what ppx-es are being linked help toward having a simple variable to store ppx driver flags so one can set flags project wide? We recently released |
Desired Behavior
There are some interesting flags that can be supplied to ppx rewriters to tweak their behavior.
For context, a new one is under work here: ocaml-ppx/ppxlib#493
More generally I'd be interested in trying some of the following:
I don't mind adding them to all dune files in my project, but I thought that perhaps it could make sense to extend dune to allow for ppx flags to be configured more globally (project-wide).
I was thinking doing a parallel with other flags that do have such support via
env
such asc_flags
orlink_flags
.Example
Example in root dune file, something like:
(env (dev (ppx_flags "-deriving-keep-w32=impl")))
What do you think?
The text was updated successfully, but these errors were encountered: