-
Notifications
You must be signed in to change notification settings - Fork 6
/
build-documentation.sh
executable file
·132 lines (101 loc) · 3.18 KB
/
build-documentation.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/bin/bash
top_level=$(git rev-parse --show-toplevel)
branch=$(git rev-parse --abbrev-ref HEAD)
version=$(git describe --always --tags --match "Release_*")
function Passed {
cp "$top_level/tools/JU_Passed.xml" "$top_level/tools/unit-testing/"
exit 0
}
function Failed {
cp "$top_level/tools/JU_Failed.xml" "$top_level/tools/unit-testing/"
exit 1
}
case $(uname) in
Linux)
ZIP_EXE=zip
;;
*)
ZIP_EXE="$top_level/tools/zip.exe"
;;
esac
echo "Start building the documentation"
cd "$top_level/Packages/doc"
output=$( (cat Doxyfile ; echo "HAVE_DOT = NO" ; echo "GENERATE_HTML = NO") | doxygen - 2>&1 >/dev/null | grep -v "warning: ignoring unsupported tag" )
if [ ! -z "$output" ]
then
echo "Errors building the documentation" 1>&2
echo "Doxygen says: " 1>&2
echo "$output" 1>&2
Failed
fi
if hash dot 2>/dev/null; then
echo "Start converting dot files to svg"
for i in $(ls *.dot)
do
dot -Tsvg -O "$i"
done
else
echo "Errors building the documentation" 1>&2
echo "dot/graphviz could not be found" 1>&2
Failed
fi
ln -s "${top_level}/Packages/IPNWB" "${top_level}/Packages/doc/"
trap "rm ${top_level}/Packages/doc/IPNWB" EXIT
# IPNWB script has dependencies. Disabling it for CI.
#
# cd "${top_level}/Packages/IPNWB"
# bash "${top_level}/Packages/IPNWB/update_doc.sh"
# cd "${top_level}/Packages/doc" # submodule rev-parse
cp "$top_level/Packages/ZeroMQ/Readme.rst" "$top_level/Packages/doc/ZeroMQ-XOP-Readme.rst"
if hash breathe-apidoc 2>/dev/null; then
echo "Start breathe-apidoc"
breathe-apidoc -f -o . xml
else
echo "Errors building the documentation" 1>&2
echo "breathe-apidoc could not be found" 1>&2
Failed
fi
# Add labels to each group and each file
# can be referenced via :ref:`Group LabnotebookQueryFunctions`
# or :ref:`File MIES_Utilities.ipf`
for i in `ls group/group_*.rst`
do
name=$(sed -e '$!d' -e 's/.*doxygengroup:: \(.*\)$/\1/' $i)
sed -i "1s/^/.. _Group ${name}:\n\n/" $i
done
for i in `ls file/*.rst`
do
name=$(sed -e '$!d' -e 's/.*doxygenfile:: \(.*\)$/\1/' $i)
sed -i "1s/^/.. _File ${name}:\n\n/" $i
done
if hash sphinx-build 2>/dev/null; then
echo "Start sphinx-build"
sphinx_version=$(sphinx-build --version 2>&1 | cut -f 2 -d " ")
sphinx_version_required=1.8.3
if [[ "$sphinx_version" != "$sphinx_version_required" ]]; then
echo "Errors building the documentation" 1>&2
echo "sphinx-build version is wrong, we require exactly $sphinx_version_required but got $sphinx_version" 1>&2
Failed
fi
rm -f sphinx-output.log
sphinx-build -q -w sphinx-output.log . html
sed -i -e '/WARNING: Duplicate declaration./d' sphinx-output.log
if [ -s "sphinx-output.log" ]
then
echo "Errors building the documentation" 1>&2
echo "sphinx-build says: " 1>&2
cat sphinx-output.log 1>&2
Failed
fi
else
echo "Errors building the documentation" 1>&2
echo "sphinx-build could not be found" 1>&2
Failed
fi
echo "Start zipping the results"
rm -f mies-docu*.zip
"$ZIP_EXE" -qr0 mies-docu-$version.zip html
Passed
# handle cases where we are called with plain sh
# which does not know about functions
exit 1