Clarification on opam's with-doc
and Dune's (documentation …)
and @doc
alias
#6022
Labels
with-doc
and Dune's (documentation …)
and @doc
alias
#6022
Dear Dune/Opam maintainers,
Whilst hacking on ocaml-ci, I've discovered a shared misunderstanding about the
with-doc
opam dependency annotation, howdune build @doc
works, and the Dune(documentation …)
stanza.We expected that we could annotate package dependency in the opam file that are only used for building the documentation with
{with-doc}
. For instance,md2mld
orconf-graphviz
to generate graphs to illustrate documentation pages. Then, we could use the(documentation …)
stanza to attach the generated mld files, with rules to generate them and their dependencies. We expected these rules to be triggered only whendune build @doc
was called.ocaml-ci has a
lint-doc
steps that simply installs the package dependencies,odoc
, and runsdune build @doc
. As devs were addingwith-doc
annotations, I've added experimental support to install these packages too. The main ocaml-ci job however doesn't install these packages and rundune build @install @check @runtest
. This main job started failing, becauseso the mld files were dependencies of the install target, and couldn't be generated because the required packages hadn't been installed.
It seems a bit weird, but right now the
with-doc
annotation is only useful for the odoc package! because it's the only one Dune actually depends on for the@doc
alias. It's not possible either to add(alias doc)
to the rules because the mld files are also dependencies of@install
.If possible, I'd suggest either to stop installing mld files as part of
@install
or as dependencies of the install file, usewith-doc
for packages used to generate documentation, and make
@doc
"understand" rules that generate documentation. If not, then we ought to be clearer and explain thatwith-doc
and@doc
are only used for the documentation processor, packages such asmd2mld
are regular (though it's conterintuitive) dependencies, anddune build @doc
is solely a wrapper around odoc.The text was updated successfully, but these errors were encountered: