blob: 10feacce735dcf69d92952ec9500d00a3874f3d3 [file] [log] [blame]
Thomas Vachuska45331492014-10-31 11:08:11 -07001#!/bin/bash
2# -----------------------------------------------------------------------------
Thomas Vachuska683b31b2015-01-26 11:54:31 -08003# Builds the ONOS Java API docs.
Thomas Vachuska45331492014-10-31 11:08:11 -07004# -----------------------------------------------------------------------------
5
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
9apidocs=onos-apidocs-${ONOS_VERSION%~*}
10
Thomas Vachuskaf906fcf2015-08-31 13:33:07 -070011function expandList {
12 list="";
13 while read line; do
14 [ -n "$line" ] && list="$list:$line"
15 done < $1
16 echo "${list#:*}"
17}
18
19function processPom {
20 cp $1 aux-$1
21 egrep '@[a-zA-Z0-9.-]+' $1 | sed 's:^[^@]*@::g' | sed 's:</.*$::g' | while read line; do
22 packages="$(expandList $line)"
23 sed "s/@$line/$packages/" aux-$1 > aux-$1.aux
24 mv aux-$1.aux aux-$1
25 done
26}
27
28set -e
29
30trap "rm aux-internal.xml aux-external.xml 2>/dev/null" EXIT
Thomas Vachuska45331492014-10-31 11:08:11 -070031rm -fr $ONOS_ROOT/docs/target
32
33cd $ONOS_ROOT/docs
Thomas Vachuskaf906fcf2015-08-31 13:33:07 -070034processPom external.xml
35mvn -f aux-external.xml javadoc:aggregate
36
Thomas Vachuska45331492014-10-31 11:08:11 -070037cd target && mv site/apidocs $apidocs
38tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz /tmp
39
40cd $ONOS_ROOT/docs
Thomas Vachuskaf906fcf2015-08-31 13:33:07 -070041processPom internal.xml
42mvn -f aux-internal.xml javadoc:aggregate