Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
moved a line for comprehension
[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 -e
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   javasphinx-apidoc --force -o source/java/ ../src/bindings/java/org/simgrid/msg
25   rm -f source/java/packages.rst # api_generated/source_java_packages.rst
26   rm -f source/java/org/simgrid/msg/package-index.rst # api_generated/source_java_org_simgrid_msg_package-index.rst
27   for f in source/java/org/simgrid/msg/* ; do
28     # Add the package name to the page titles
29     (printf "class org.simgrid.msg."; cat $f )>tmp
30     mv tmp $f
31     sed -i 's/==/========================/' $f # That's the right length knowing that I add 'class org.simgrid.msg.'
32   done
33 #  sed -i 's/^.. java:type:: public class /.. java:type:: public class org.simgrid.msg/' source/java/org/simgrid/msg/*
34   echo "javasphinx relaunched"
35 fi
36
37 PYTHONPATH=../lib sphinx-build -M html source build ${SPHINXOPTS} 2>&1 \
38   | grep -v 'WARNING: cpp:identifier reference target not found: simgrid$' \
39   | grep -v 'WARNING: cpp:identifier reference target not found: simgrid::s4u$' \
40   | grep -v 'WARNING: cpp:identifier reference target not found: boost' 
41
42 set +x
43
44 perl -pe 's/(xlink:href="(?:http|.*\.html))/target="_top" $1/' \
45      source/img/graphical-toc.svg > build/html/graphical-toc.svg
46
47 echo
48 echo "Undocumented examples:"
49 for ex in $( (cd .. ; \
50               find examples/s4u/ -name '*.cpp'; \
51               find examples/c/ -name '*.c'; \
52               find examples/python -name '*.py'; \
53              ) | sort )
54 do
55     if grep -q "example-tab:: $ex" ../examples/README.rst ; then :
56 #        echo "found example-tab:: $ex"
57     elif grep -q "showfile:: $ex" ../examples/README.rst ; then :
58     else
59         echo $ex
60     fi
61 done
62
63 set +e # Don't fail
64 if [ -e /usr/bin/linkchecker ] ; then
65     linkchecker --no-status -o csv --ignore-url='.*\.css$' --ignore-url=build/html/_modules  --ignore-url=public/java/org build/html \
66      | grep -v '^#' \
67      | grep -v 'urlname;parentname;baseref;result;warningstring'
68   echo "done."
69 else
70   echo "Install linkchecker to have it executed when you build the doc."
71 fi
72