Thomas Vachuska | 4533149 | 2014-10-31 11:08:11 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
Thomas Vachuska | 683b31b | 2015-01-26 11:54:31 -0800 | [diff] [blame] | 3 | # Builds the ONOS Java API docs. |
Thomas Vachuska | 4533149 | 2014-10-31 11:08:11 -0700 | [diff] [blame] | 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | . $ONOS_ROOT/tools/build/envDefaults |
| 8 | |
| 9 | apidocs=onos-apidocs-${ONOS_VERSION%~*} |
| 10 | |
Thomas Vachuska | f906fcf | 2015-08-31 13:33:07 -0700 | [diff] [blame] | 11 | function expandList { |
| 12 | list=""; |
| 13 | while read line; do |
| 14 | [ -n "$line" ] && list="$list:$line" |
| 15 | done < $1 |
| 16 | echo "${list#:*}" |
| 17 | } |
| 18 | |
| 19 | function 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 | |
| 28 | set -e |
| 29 | |
| 30 | trap "rm aux-internal.xml aux-external.xml 2>/dev/null" EXIT |
Thomas Vachuska | 4533149 | 2014-10-31 11:08:11 -0700 | [diff] [blame] | 31 | rm -fr $ONOS_ROOT/docs/target |
| 32 | |
| 33 | cd $ONOS_ROOT/docs |
Thomas Vachuska | f906fcf | 2015-08-31 13:33:07 -0700 | [diff] [blame] | 34 | processPom external.xml |
| 35 | mvn -f aux-external.xml javadoc:aggregate |
| 36 | |
Thomas Vachuska | 4533149 | 2014-10-31 11:08:11 -0700 | [diff] [blame] | 37 | cd target && mv site/apidocs $apidocs |
| 38 | tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz /tmp |
| 39 | |
| 40 | cd $ONOS_ROOT/docs |
Thomas Vachuska | f906fcf | 2015-08-31 13:33:07 -0700 | [diff] [blame] | 41 | processPom internal.xml |
| 42 | mvn -f aux-internal.xml javadoc:aggregate |