Open Chris00 opened 7 years ago
I think, dependencies should be managed at a module level: if a module M
appears in several Library and/or Executable sections, the intersection of these sections dependencies should be used for m.ml{,i,y}
.
This should allow to have optional sections, only built if the proper dependencies are present.
For csv-1.6
, I changed <src/*.ml{,i,y}>: package(lwt)
into <src/csv_lwt.ml{,i,y}>: package(lwt)
in the _tag
file and tests passed, showing that this is the culprit.
Option 1 (simple solution to the problem): Put the optional library in a different directory, e.g. src/gtk:
Library cairo2
Path: src
Library cairo_gtk
Build$: flag(lablgtk2)
Path: src/gtk
This will prevent dependency pollution.
Option 2 (more complex): The best way would be to tag precisely files. In order to do this, you need to be able to list the files really used. We can guess all the file names in the directory using Modules and InternalModules and then generate each precise rules.
We will need the feature source_patterns. This allows to get a precise listing.
I think the design of this thing is a bit fragile, because if we miss a single file for the compilation, we fail...
As an example, this
_oasis
file optionally compiles a library, making thelablgtk2
dependency optional. However, the_tag
file containswhich turns it into a compulsory dependency.