Say I have the following directory:
.
├── dune-project
├── myproj.opam
└── src
├── dune
├── module1.ml
├── parser1
│ └── file1.ml
└── parser2
└── file2.ml
Since I want everything to be in the same library, I have the following:
src/dune:
(include_subdirs unqualified)
(library
(name myproj)
(modules module1 file1 file2)
)
And it compiles perfectly well.
Now, the thing is, my file1 and file2 are actually mly files so I have this:
.
├── dune-project
├── myproj.opam
└── src
├── dune
├── module1.ml
├── parser1
│ └── parser1.mly
└── parser2
└── parser2.mly
If I try to compile (by changing file(1|2) by parser(1|2) in the dune file), I have the following error:
❯ dune build
File "src/dune", line 5, characters 26-33:
5 | (modules module1 parser1 parser2 )
^^^^^^^
Error: Module Parser2 doesn't exist.
I edit my dune file:
(include_subdirs unqualified)
(menhir
(modules parser1 parser2)
)
(library
(name myproj)
(modules module1 parser1 parser2 )
)
Two errors now:
❯ dune build
File "src/dune", line 3, characters 0-36:
3 | (menhir
4 | (modules parser1 parser2)
5 | )
Error: No rule found for src/parser1.mly
File "src/dune", line 3, characters 0-36:
3 | (menhir
4 | (modules parser1 parser2)
5 | )
Error: No rule found for src/parser2.mly
Ok, I then add two dune files in parser(1|2) directories:
(menhir
(modules parser(1|2))
)
[EDIT] Looks like I missed something but this was actually working pretty well
And I now have the same error as before:
❯ dune build
File "src/dune", line 5, characters 26-33:
5 | (modules module1 parser1 parser2 )
^^^^^^^
Error: Module Parser2 doesn't exist.
Am I missing something to please dune? (I have the same problem if I have .mll files)