Stream: Dune devs & users

Topic: Translating %.foo : %.bar to dune


view this post on Zulip Paolo Giarrusso (Sep 12 2020 at 18:33):

Is there a way, or should I leave those rules to Makefiles?

view this post on Zulip Paolo Giarrusso (Sep 12 2020 at 18:35):

Looking at e.g. https://dune.readthedocs.io/en/stable/dune-files.html#coq-pp suggests that can be expressed using rule — but the translation seems to require writing by hand one rule per each target.

view this post on Zulip Paolo Giarrusso (Sep 12 2020 at 18:45):

The implementation seems to be https://github.com/ocaml/dune/blob/6d83f12d59abd4237cc19bbb00415dc1354bff0e/src/dune_rules/coq_rules.ml#L438-L448, which seems to confirm the idea.

view this post on Zulip Enrico Tassi (Sep 12 2020 at 19:00):

An option (not my favorite, but still) is to write a little ml program that spits all the dune rules (one per file) and then include the generated file. This is where I learnt it: https://tarides.com/blog/2019-05-09-an-introduction-to-ocaml-ppx-ecosystem#testing-your-ppx

view this post on Zulip Paolo Giarrusso (Sep 12 2020 at 19:33):

Ah, no OCaml required, and it has advantages over sticking to make.

view this post on Zulip Paolo Giarrusso (Sep 12 2020 at 19:33):

That’s great, thanks! One more question:

view this post on Zulip Paolo Giarrusso (Sep 12 2020 at 19:34):

can I generate and include the file in the same run, or does dune force the build script to be static?

view this post on Zulip Paolo Giarrusso (Sep 12 2020 at 19:34):

I can easily run the generator from a step elsewhere, so this isn’t a big deal..

view this post on Zulip Paolo Giarrusso (Sep 12 2020 at 19:39):

However, even after reading https://github.com/ocaml/dune’s README, I am not sure I understand the rationale for omitting such a feature.

view this post on Zulip Rudi Grinberg (Sep 14 2020 at 23:48):

We do plan to lift this restriction eventually. It’s a bit tough unfortunately.


Last updated: Oct 16 2021 at 09:07 UTC