ocaml / odoc

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

Fix using `odoc_driver` to build `odoc` #1205

Open panglesd opened 16 hours ago

panglesd commented 16 hours ago

Quoting the docs of the Findlib library:

  • Furthermore, the environment variables OCAMLPATH, OCAMLFIND_DESTDIR,
  • OCAMLFIND_COMMANDS, OCAMLFIND_IGNORE_DUPS_IN, and CAMLLIB are interpreted.
  • By default, the function takes
  • the values found in the environment, but you can pass different values
  • using the [env_*] arguments. By setting these values to empty strings
  • they are no longer considered.

So when we do

dune exec -- odoc_driver -p odoc

findlib finds the odoc library in _build/install in some part of the codebase[^1], in <opam switch>/lib/odoc in some other parts of the code, which results in the docs for odoc not being built.

This changes to consistently find the <opam switch>/lib/odoc.

[^1]: ~because the ocamlpath of compile time was used!~ Missread...

panglesd commented 14 hours ago

Surely there is a better way here. I originally opened the PR with the confusion that it would take the compile time value, which was then always wrong.