ocaml / odoc

Documentation compiler for OCaml and Reason
Other
322 stars 89 forks source link

Modules listed three times for LLVM documentation #1186

Closed Kakadu closed 1 month ago

Kakadu commented 1 month ago

I did odig doc llvm for LLVM bindings 16x and 17.x and toplevel modules a listed three times with the same content. I don't know if this is an issue of LLVM package or odoc itself? Could somebody double-check?

dbuenzli commented 1 month ago

It's likely more an odig issue so I'm moving the issue there.

But can you be more specific? In general when this happens it's because you have library variants or something like that. Perhaps the simplest is not to rely on odig's automatically generated file and add your own index.mld landing page.

See the docs here for the details.

dbuenzli commented 1 month ago

Mmmh it seems I can't transfer stuff to another organisation.

dbuenzli commented 1 month ago

So I tried to install llvm and I confirm your finding. The problem is the following. Do a:

odig pkg llvm -l

And have a look at the doc-cobjs fields which lists the file that are used for generating the documentation according to the convention. You will see that most modules appear three times. For example:

> odig pkg llvm -l | grep 'llvm.cmti\?'
   /Users/dbuenzli/.opam/4.14.2/lib/llvm/static/llvm.cmt
   /Users/dbuenzli/.opam/4.14.2/lib/llvm/shared/llvm.cmt
   /Users/dbuenzli/.opam/4.14.2/lib/llvm/llvm.cmti

Since the index.mld file is automatically generated by odig, the index gets three Llvm mentions.

I'm not sure I exactly understand the install structure here or how it can be made automatically understandable to odig. So the best is likely to write our own index.mld file and install it as per convention in $(opam var doc)/llvm/odoc-pages.

(I could uniquify the modules but I suspect the whole install structure leads to larger problems for odig, if I look at odig doc llvm && odig log -m llmv the driver seems to drive odoc in a way that confuses it, see these Ambiguous lookup)

Feel free to reopen an issue on odig if you think there's something better that can be automatically done there.