Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
better factorization of how examples are displayed in RST
[simgrid.git] / docs / Build.sh
1 #! /bin/sh
2 #
3 # Simplistic script to rebuild our documentation with sphinx-build
4
5 # Python needs to find simgrid on my machine, but not ctest -- sorry for the hack
6 if [ -e /opt/simgrid ] ; then chmod +x /opt/simgrid; fi
7
8 set -e
9
10 if [ "x$1" != 'xdoxy' -a -e build/xml ] ; then
11   echo "Doxygen not rerun: 'doxy' was not provided as an argument"
12 else
13   rm -rf build/xml source/api/
14   cd source; doxygen; cd ..
15 fi
16
17 if [ "x$1" != 'xjava' -a -e source/java ] ; then
18   echo "javasphinx not rerun: 'java' was not provided as an argument"
19 else
20   rm -rf source/java
21   javasphinx-apidoc --force -o source/java/ ../src/bindings/java/org/simgrid/msg
22   rm -f source/java/packages.rst # api_generated/source_java_packages.rst
23   rm -f source/java/org/simgrid/msg/package-index.rst # api_generated/source_java_org_simgrid_msg_package-index.rst
24   for f in source/java/org/simgrid/msg/* ; do
25     # Add the package name to the page titles
26     (echo -n "class org.simgrid.msg."; cat $f )>tmp
27     mv tmp $f
28     sed -i 's/==/========================/' $f # That's the right length knowing that I add 'class org.simgrid.msg.'
29   done
30 #  sed -i 's/^.. java:type:: public class /.. java:type:: public class org.simgrid.msg/' source/java/org/simgrid/msg/*
31   echo "javasphinx relaunched"
32 fi
33
34 PYTHONPATH=../lib sphinx-build -M html source build ${SPHINXOPTS}
35
36 set +x
37
38 perl -pe 's/(xlink:href="(?:http|.*\.html))/target="_top" $1/' \
39      source/img/graphical-toc.svg > build/html/graphical-toc.svg
40
41 echo "List of missing references:"
42 for f in $( (grep '<name>' build/xml/msg_8h.xml; \
43              grep '<name>' build/xml/namespacesimgrid_1_1s4u.xml; \
44 #            grep '<name>' build/xml/actor_8h.xml ; \
45 #            grep '<name>' build/xml/barrier_8h.xml ; \
46              grep '<name>' build/xml/cond_8h.xml ; \
47              grep '<name>' build/xml/engine_8h.xml ; \
48 #            grep '<name>' build/xml/host_8h.xml ; \
49 #            grep '<name>' build/xml/link_8h.xml ; \
50 #            grep '<name>' build/xml/mailbox_8h.xml ; \
51              grep '<name>' build/xml/msg_8h.xml ; \
52 #            grep '<name>' build/xml/mutex_8h.xml ; \
53 #            grep '<name>' build/xml/semaphore_8h.xml ; \
54 #            grep '<name>' build/xml/vm_8h.xml ; \
55 #            grep '<name>' build/xml/zone_8h.xml ; \
56              grep '<innerclass refid=' build/xml/namespacesimgrid_1_1s4u.xml ; \
57             ) | sed 's/<[^>]*>//g' | sort )
58 do
59
60   if grep $f source/*rst | grep -q '.. doxygen[^::]*:: '"$f"'$' ||
61      grep $f source/*rst | grep -q '.. doxygen[^::]*:: simgrid::[^:]*::[^:]*::'"$f"'$'  ; then :   
62 #    echo "$f documented"
63   else 
64     if grep -q $f ignored_symbols ; then : 
65 #      echo "$f ignored" # not documented
66     else
67       echo "$f"
68     fi
69   fi
70 done
71
72 if [ -e /opt/simgrid ] ; then chmod -x /opt/simgrid; fi
73
74 set +e # Don't fail
75 if [ -e /usr/bin/linkchecker ] ; then
76   linkchecker --no-status -o csv --ignore-url='.*\.css$' --ignore-url=public/java/org build/html \
77      | grep -v '^#' \
78      | grep -v 'urlname;parentname;baseref;result;warningstring'
79   echo "done."
80 else
81   echo "Install linkchecker to have it executed when you build the doc."
82 fi
83