dune icon indicating copy to clipboard operation
dune copied to clipboard

`dune build @doc-new` treats dependency errors as fatal

Open art-w opened this issue 1 year ago • 1 comments

As reported by @mbarbin, when running dune build @doc-new with fatal warnings enabled in the dune env:

(env (dev (odoc (warnings fatal))))

(library (public_name foo) (libraries eio))
(* foo.ml *)
let f = Eio.Switch.run

As of eio.0.14, we happen to get a warning for that dependency which blocks the html documentation generation of our local foo library:

$ dune build @doc-new
File "eio.mld", line 10, characters 0-11:
Error: '{!modules ...}' should not be empty.
ERROR: Warnings have been generated.

$ ls _build/default/_doc_new/html/docs/
findlib-0  findlib-1  local  odoc.support  stdlib

$ ls _build/default/_doc_new/html/docs/local/
index.html   # missing `foo` folder

Note that when sherlodoc is installed, there is even less directories/files generated in the _doc_new folder:

$ opam install sherlodoc
$ dune build @doc-new
$ ls _build/default/_doc_new/html/docs/  
odoc.support  sherlodoc.js  # missing all html files/folders

Removing the fatal warnings configuration enables the production of our local Foo documentation:

$ tree _build/default/_doc_new/html/docs/local/
_build/default/_doc_new/html/docs/local/foo
├── Foo
│   └── index.html
└── index.html

It appears that warnings from external dependencies were expected to be quietly ignored rather than interpreted as fatal:

@jonludlam : This should already be implemented, modulo bugs - we're supposed to pass the 'quiet' flag to external libs (things that come from opam rather than in your tree), and this should suppress the --warn-error flag: https://github.com/ocaml/dune/blob/main/src/dune_rules/odoc.ml#L237-L246 - if that's not working please file an issue!

(tested with dune 3.14.0 and ocaml 5.1.0)

art-w avatar Feb 16 '24 11:02 art-w

Interestingly that looks like it's the eio.mld file that's causing the warning, but there's a good chance that it's a file generated by dune :-)

jonludlam avatar Feb 16 '24 11:02 jonludlam