Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
docs/Build.sh: get verbose to see what's failing on CI
[simgrid.git] / docs / Build.sh
1 #! /bin/bash
2 #
3 # Simplistic script to rebuild our documentation with sphinx-build
4
5 # If you are missing some dependencies, try: pip3 install --requirement docs/requirements.txt
6
7 # Python needs to find simgrid on my machine, but not ctest -- sorry for the hack
8 if [ -e /opt/simgrid ] ; then chmod +x /opt/simgrid; fi
9
10 set -ex
11 set -o pipefail
12
13 if [ "x$1" != 'xdoxy' ] && [ -e build/xml ] ; then
14   echo "Doxygen not rerun: 'doxy' was not provided as an argument"
15 else
16   rm -rf build/xml source/api/
17   (cd source; doxygen 2>&1; cd ..) | grep -v "is not documented." #   XXXXX Reduce the verbosity for now
18 fi
19
20 if [ "x$1" != 'xjava' ] && [ -e source/java ] ; then
21   echo "javasphinx not rerun: 'java' was not provided as an argument"
22 else
23   rm -rf source/java
24   
25   # Use that script without installing javasphinx: javasphinx-apidoc --force -o source/java/ ../src/bindings/java/org/simgrid/msg
26   PYTHONPATH=${PYTHONPATH}:source/_ext/javasphinx python3 - --force -o source/java/ ../src/bindings/java/org/simgrid/msg <<EOF
27 import re
28 import sys
29 from javasphinx.apidoc import main
30 if __name__ == '__main__':
31     sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
32     sys.exit(main())
33 EOF
34
35   rm -f source/java/packages.rst # api_generated/source_java_packages.rst
36   rm -f source/java/org/simgrid/msg/package-index.rst # api_generated/source_java_org_simgrid_msg_package-index.rst
37   for f in source/java/org/simgrid/msg/* ; do
38     # Add the package name to the page titles
39     (printf "class org.simgrid.msg."; cat $f )>tmp
40     mv tmp $f
41     sed -i 's/==/========================/' $f # That's the right length knowing that I add 'class org.simgrid.msg.'
42   done
43 #  sed -i 's/^.. java:type:: public class /.. java:type:: public class org.simgrid.msg/' source/java/org/simgrid/msg/*
44   echo "javasphinx relaunched"
45 fi
46
47 PYTHONPATH=../lib:source/_ext/javasphinx sphinx-build -M html source build ${SPHINXOPTS} 2>&1 \
48   | grep -v 'WARNING: cpp:identifier reference target not found: simgrid$' \
49   | grep -v 'WARNING: cpp:identifier reference target not found: simgrid::s4u$' \
50   | grep -v 'WARNING: cpp:identifier reference target not found: boost' 
51
52 set +x
53
54 perl -pe 's/(xlink:href="(?:http|.*\.html))/target="_top" $1/' \
55      source/img/graphical-toc.svg > build/html/graphical-toc.svg
56
57 echo
58 echo "Undocumented examples:"
59 for ex in $( (cd .. ; \
60               find examples/s4u/ -name '*.cpp'; \
61               find examples/c/ -name '*.c'; \
62               find examples/python -name '*.py'; \
63              ) | sort )
64 do
65     if grep -q "example-tab:: $ex" ../examples/README.rst ; then :
66 #        echo "found example-tab:: $ex"
67     elif grep -q "showfile:: $ex" ../examples/README.rst ; then :
68     else
69         echo $ex
70     fi
71 done
72
73 set +e # Don't fail
74 if [ -e /usr/bin/linkchecker ] ; then
75     linkchecker --no-status -o csv --ignore-url='.*\.css$' --ignore-url=build/html/_modules  --ignore-url=public/java/org build/html \
76      | grep -v '^#' \
77      | grep -v 'urlname;parentname;baseref;result;warningstring'
78   echo "done."
79 else
80   echo "Install linkchecker to have it executed when you build the doc."
81 fi
82