Dune - transitive dependencies

When a jbuild files declares the availability of a library like bos below, every library that bos depends on, like astring, is also available: it is not necessary to declare astring explicitly. This is dangerous because if bos decides to drop this dependency, code that depends on astring won’t compile any longer.

Could Dune warn about libraries that are used but are not declared explicitly?

(executable
 ((name main)
  (public_name hello)
  (libraries
   (cmdliner bos))))
2 Likes

+1
Or better yet, disallow this altogether?

This is a good idea and is work-progress: see https://github.com/ocaml/dune/pull/430

7 Likes

I like that. Maybe it would be also possible to detect unused libraries.

1 Like