blob: 93a73c14cbfd54c40cb4bd291ae5a1d634484bd3 [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
Brian O'Connorf5d93632015-09-04 20:18:31 -07006set -e
7
Thomas Vachuska45331492014-10-31 11:08:11 -07008[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
9. $ONOS_ROOT/tools/build/envDefaults
10
11apidocs=onos-apidocs-${ONOS_VERSION%~*}
12
Thomas Vachuskaf906fcf2015-08-31 13:33:07 -070013function expandList {
14 list="";
15 while read line; do
16 [ -n "$line" ] && list="$list:$line"
17 done < $1
18 echo "${list#:*}"
19}
20
21function processPom {
22 cp $1 aux-$1
23 egrep '@[a-zA-Z0-9.-]+' $1 | sed 's:^[^@]*@::g' | sed 's:</.*$::g' | while read line; do
24 packages="$(expandList $line)"
25 sed "s/@$line/$packages/" aux-$1 > aux-$1.aux
26 mv aux-$1.aux aux-$1
27 done
28}
29
30set -e
31
32trap "rm aux-internal.xml aux-external.xml 2>/dev/null" EXIT
Thomas Vachuska45331492014-10-31 11:08:11 -070033rm -fr $ONOS_ROOT/docs/target
34
35cd $ONOS_ROOT/docs
Thomas Vachuskaf906fcf2015-08-31 13:33:07 -070036processPom external.xml
37mvn -f aux-external.xml javadoc:aggregate
38
Thomas Vachuska45331492014-10-31 11:08:11 -070039cd target && mv site/apidocs $apidocs
40tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz /tmp
41
42cd $ONOS_ROOT/docs
Thomas Vachuskaf906fcf2015-08-31 13:33:07 -070043processPom internal.xml
44mvn -f aux-internal.xml javadoc:aggregate