Yes, this means you need to commit the generated
dune files into your repository, but depending on your use-case this may be better than mantaining the files by hand (for example if you have a lot of rules to generate). Also you can use
dune's promote machinery to handle changes to the generated files, which is handy.
If you want to give it a try, the simplest possible way to use this is as follows:
;; This rule generates the dune file, you should replace `...` by
;; a suitable action.
(action (with-stdout-to dune.inc (run ...))))
;; This includes the actual generated dune file; note that
;; it must exist in the source tree (so it must be committed with the repository).
If you want to use
dune's promote machinery to have better control of the changes in the generated files, you can modify things a bit as follows:
;; Note the different file name `dune.inc.gen`.
(rule (with-stdout-to dune.inc.gen (run ...)))
;; You can use `dune build @gen` to see the diff in the generated file,
;; and `dune promote` to accept it.
(action (diff dune.inc dune.inc.gen)))
Hope it helps,