-
Notifications
You must be signed in to change notification settings - Fork 410
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
Allow to generating subdir with dynamic_include #10405
Comments
Hi, |
I did manage to make things work with a flat directory structure based on something like the guide. However, I do want to preserve a directory structure in the generated files, since the ultimate goal is to build generated files with Would that help if I provided an example of what we'd like to do? |
Unfortunately, unless you copy the sources to other directory, there is indeed a cycle problem in the way dune load rules I think, that is to say, if you have:
etc... and you want to generate an include file for the tests, you'll need to add |
In my experiment I do copy the sources to another directory, what I mean with a flat directory structure is that the source folder for which I want to generate rules itself has sub-folders. And ideally, I could handle all these subfolders with a single generated dune file that relies on |
This PR uses the new feature `dynamic_include` to include our generated file `dune.inc`. Pros: - We do not upstream `dune.inc` anymore! - The output of `dune.inc` depends on the plateform. This is the main motivation of this PR because Windows does not use the convention for path. Cons: - We need `Dune > 3.14` - We cannot use the stanza `subdir` in `dune.inc`, which means we have to ensure we do not use twice the same name for two tests even if there are not in the same directory. See issue ocaml/dune#10405
This PR uses the new feature `dynamic_include` to include our generated file `dune.inc`. Pros: - We do not upstream `dune.inc` anymore! - The output of `dune.inc` depends on the plateform. This is the main motivation of this PR because Windows does not use the convention for path. Cons: - We need `Dune > 3.14` - We cannot use the stanza `subdir` in `dune.inc`, which means we have to ensure we do not use twice the same name for two tests even if there are not in the same directory. See issue ocaml/dune#10405
Desired Behavior
Currently,
dynamic_include
cannot deal with files usingsubdir
. How hard would it be to support it?Example
The example I have in mind is simple, and involves generating rules that produce Coq files containing the representation of the AST of all the source files of a source tree. So, for each file of the source tree, say
dir1/dir2/bla.cpp
, I want to producedir1/dir2/bla.v
(and potentially other files as well based on the base name).Producing these rules is kind of complicated. In our current setup, we use a script that produces a
dune.inc
file (produced by a wrapperMakefile
), that is then included (viainclude
, notdynamic_include
). The produceddune.inc
relies heavily onsubdir
(for simplicity, and to not have to recursively include files). Ideally, I'd like to let dune run the script producingdune.inc
, and the rely ondynamic_include
, to avoid the two-stage build with theMakefile
.The text was updated successfully, but these errors were encountered: