-
Notifications
You must be signed in to change notification settings - Fork 20
/
build-javadocs.sh
executable file
·57 lines (46 loc) · 1.21 KB
/
build-javadocs.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
#!/bin/bash
#
# surely this should be done more properly with only maven, meanwhile ...
#
set -e
##### generate documentation
mvn javadoc:javadoc -Ddoclint=none
##### collect documentation
src=target/site/apidocs
dest=docs/javadoc
for dir in `find . -type d | grep $src$`
do
mkdir -p $dest/${dir%$src}
cp -r $dir/* $dest/${dir%$src}
done
##### generate front index page
pushd $dest
cat > index.html << EOF
<html><body bgcolor="cccccc"><head>
<title>coatjava javadocs</title>
<STYLE TYPE="text/css"></STYLE>
</head>
<p><p align="center"><b><font size="5">CLAS12 Coatjava Javadocs <br></b></font></p>
<br>
<br>
EOF
pages=($(find -name "index.html" | sed 's;^\./;;' | sed 's;/index.html;;' | grep -v index.html | sort))
header=""
for page in ${pages[@]}; do
headerTmp=$(echo $page | sed 's;/.*;;g')
obj=$(echo $page | sed "s;^$headerTmp/;;")
if [ "$header" != "$headerTmp" ]; then
[ "$header" != "" ] && echo "</ul>" >> index.html
header=$headerTmp
echo "<h3>$header</h3>" >> index.html
echo "<ul>" >> index.html
fi
echo "<li><a href=\"$page/index.html\">$obj</a></li>" >> index.html
done
cat >> index.html << EOF
</ul>
</body>
</html>
EOF
popd
echo "Documentation generated: $dest/index.html"