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 | |
Brian O'Connor | f5d9363 | 2015-09-04 20:18:31 -0700 | [diff] [blame^] | 6 | set -e |
| 7 | |
Thomas Vachuska | 4533149 | 2014-10-31 11:08:11 -0700 | [diff] [blame] | 8 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 9 | . $ONOS_ROOT/tools/build/envDefaults |
| 10 | |
| 11 | apidocs=onos-apidocs-${ONOS_VERSION%~*} |
| 12 | |
Thomas Vachuska | f906fcf | 2015-08-31 13:33:07 -0700 | [diff] [blame] | 13 | function expandList { |
| 14 | list=""; |
| 15 | while read line; do |
| 16 | [ -n "$line" ] && list="$list:$line" |
| 17 | done < $1 |
| 18 | echo "${list#:*}" |
| 19 | } |
| 20 | |
| 21 | function 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 | |
| 30 | set -e |
| 31 | |
| 32 | trap "rm aux-internal.xml aux-external.xml 2>/dev/null" EXIT |
Thomas Vachuska | 4533149 | 2014-10-31 11:08:11 -0700 | [diff] [blame] | 33 | rm -fr $ONOS_ROOT/docs/target |
| 34 | |
| 35 | cd $ONOS_ROOT/docs |
Thomas Vachuska | f906fcf | 2015-08-31 13:33:07 -0700 | [diff] [blame] | 36 | processPom external.xml |
| 37 | mvn -f aux-external.xml javadoc:aggregate |
| 38 | |
Thomas Vachuska | 4533149 | 2014-10-31 11:08:11 -0700 | [diff] [blame] | 39 | cd target && mv site/apidocs $apidocs |
| 40 | tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz /tmp |
| 41 | |
| 42 | cd $ONOS_ROOT/docs |
Thomas Vachuska | f906fcf | 2015-08-31 13:33:07 -0700 | [diff] [blame] | 43 | processPom internal.xml |
| 44 | mvn -f aux-internal.xml javadoc:aggregate |