Add ad hoc script doc.sh to help read the output of [make doc].

This commit is contained in:
François Pottier 2022-04-06 08:36:52 +02:00
parent d6b05d1687
commit b1f46e1599
2 changed files with 67 additions and 1 deletions

View File

@ -118,7 +118,7 @@ DOC = $(DOCDIR)/inferno/index.html
doc:
@ rm -rf _build/default/_doc
@ dune clean
@ dune build @doc
@ dune build @doc 2>&1 | ./doc.sh
@ echo "You can view the documentation by typing 'make view'".
.PHONY: view

66
doc.sh Executable file
View File

@ -0,0 +1,66 @@
#!/bin/bash
set -euo pipefail
shopt -s extglob
# This script helps make sense of the error messages produced by odoc.
# A list of missing modules.
missing=""
while read line
do
buffer="$line"
case "$line" in
File*client*:)
# A warning about the directory client/. Stop.
echo "Skipping all warnings about client/."
break
;;
File*:)
read line
buffer="$buffer$line"
case "$line" in
"Warning: Couldn't find the following modules:")
read line
# A warning that some modules could not be found.
# Accumulate the names of the missing modules.
missing="$missing $line"
;;
"Warning: Failed to lookup type unresolvedroot(Stdlib)"*)
# A warning about Stdlib. Skip.
echo "Skipping warnings about Stdlib."
;;
"Warning: While"*)
read line
buffer="$buffer$line"
case "$line" in
"Failed to lookup type unresolvedroot(Stdlib)"*)
# A multi-line warning about Stdlib. Skip.
echo "Skipping warnings about Stdlib."
;;
*)
# Another kind of warning. Echo.
echo "$buffer"
;;
esac
;;
*)
# Another kind of warning. Echo.
echo "$buffer"
;;
esac
;;
*)
echo "$buffer"
;;
esac
done
# Show the missing modules.
echo "Missing modules:"
echo "$missing" | sed -e 's/^ *//' | tr " " "\n" | sort | uniq