mjambon / dune-deps

Show the internal dependencies in your OCaml/Reason/Dune project
BSD 3-Clause "New" or "Revised" License
58 stars 6 forks source link

Include modules of libraries #17

Closed sheijk closed 3 years ago

sheijk commented 4 years ago

It would be great to have an option include modules in the graph instead of only having libraries and executables etc.

For example for the following dune file (repo)

(library
 (name Calc_languages)
 (preprocess
  (pps ppx_deriving.show))
 (modules Calc_int Calc_float Calc_bool Calc)
 (wrapped false))

(executable
 (preprocess
  (pps ppx_deriving.show))
 (name calc_demo)
 (modules Calc_demo)
 (libraries Calc_languages))

(library
 (name Algo_languages)
 (preprocess
  (pps ppx_deriving.show))
 (modules Algo_int Algo)
 (libraries Calc_languages)
 (wrapped false))

(executable
 (preprocess
  (pps ppx_deriving.show))
 (name algo_demo)
 (modules Algo_demo)
 (libraries Calc_languages Algo_languages))

I'm getting this output:

digraph {
    "exe:./source/dune:3"   [label=algo_demo,
        shape=diamond];
    "lib:Algo_languages"    [label=Algo_languages];
    "exe:./source/dune:3" -> "lib:Algo_languages";
    "exe:./source/dune:1"   [label=calc_demo,
        shape=diamond];
    "lib:Calc_languages"    [label=Calc_languages];
    "exe:./source/dune:1" -> "lib:Calc_languages";
    "lib:Algo_languages" -> "lib:Calc_languages";
}

I'd like to be able to see all the modules (similar to the output of ocamldoc -dot).

mjambon commented 4 years ago

Thanks for the suggestion. I think this is out of the scope of this project, mostly because it serves my needs and I'm not interested in managing a growing project.

You mention ocamldoc -dot, which I haven't tried. There's also ocamldot which processes the output of ocamldep, which I used a long time ago. It was fun but not very useful because it was too messy and didn't really do anything to document a project. It would be good to know how to run ocamldep on a code base. In https://github.com/mjambon/dune-deps/issues/4, @jeremiedimino suggested looking into dune describe. Maybe that would be appropriate for the task. That's all I know :-)