blob: bc1d912306f01e59bad87d89361f9c390490d179 [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
HIGUCHI Yuta6fbf0d32015-11-10 11:15:36 -080037mvn -f aux-external.xml javadoc:aggregate "$@"
Thomas Vachuskaf906fcf2015-08-31 13:33:07 -070038
Thomas Vachuska45331492014-10-31 11:08:11 -070039cd target && mv site/apidocs $apidocs
HIGUCHI Yutac343f7a2016-02-25 18:28:39 -080040tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz $ONOS_STAGE_ROOT
Thomas Vachuska45331492014-10-31 11:08:11 -070041
42cd $ONOS_ROOT/docs
Thomas Vachuskaf906fcf2015-08-31 13:33:07 -070043processPom internal.xml
HIGUCHI Yuta6fbf0d32015-11-10 11:15:36 -080044mvn -f aux-internal.xml javadoc:aggregate "$@"