Logo AND Algorithmique Numérique Distribuée

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