dune icon indicating copy to clipboard operation
dune copied to clipboard

The ability to describe modules without implementation in included subdirectories

Open xvw opened this issue 1 year ago • 1 comments

Desired Behavior

Currently (3.16.0) it is not possible to describe a module without implementation when it is included from a subdirectory (using (include_subdirs qualified)) (or no). If the inclusion is unqualified, the module can be referenced in the modules_without_implementation stanza.

Example

With the following source-tree

lib
 |_ a
   |_ dune
   |_ b
     |_ t.mli

and lib/a/dune

(library
 (name a)
 (public_name proj.a))

(include_subdirs qualified)

dune build leads to the following error:

Error: Some modules don't have an implementation.
You need to add the following field to this stanza:

  (modules_without_implementation b.T)

Let's try:

 (library
  (name a)
+ (modules_without_implementation b.T)
  (public_name proj.a))

  (include_subdirs qualified)
File "lib/static/dune", line 5, characters 33-44:
5 |  (modules_without_implementation b.Types))
                                     ^^^^^^^
Error: Module b.Types doesn't exist.

And I have try with t, b.t, b.T and b/t.

xvw avatar Sep 16 '24 10:09 xvw

Stumbled upon the same problem right now with 3.17. A workaround is to make the subdirectory its own library, but if it is somewhere in the middle of the dependencies tree, that might force you to transform all of your subdirectories into libraries.

Niols avatar Jan 24 '25 00:01 Niols