Migrating convenience aliases to Buck usage

Change-Id: I01d21e9630625dc6e5200a0d1be625f8d2db7348
diff --git a/tools/build/envDefaults b/tools/build/envDefaults
index f72d3ae..8aa45bd 100644
--- a/tools/build/envDefaults
+++ b/tools/build/envDefaults
@@ -14,8 +14,8 @@
 export PATH="$ONOS_ROOT/tools/dev/bin:$ONOS_ROOT/tools/test/bin:$PATH"
 export PATH="$ONOS_ROOT/tools/build:$PATH"
 
-# Fallback build number us derived from from the user name & time
-export BUILD_NUMBER=${BUILD_NUMBER:-$(id -un)~$(date +'%Y/%m/%d@%H:%M')}
+# Fallback build number us derived from from the user name
+export BUILD_NUMBER=${BUILD_NUMBER:-$(id -un)}
 
 # ONOS Version and onos.tar.gz staging environment
 export ONOS_POM_VERSION="1.8.0-SNAPSHOT"
@@ -39,10 +39,6 @@
 export ONOS_TEST_STAGE=$ONOS_STAGE_ROOT/$ONOS_TEST_BITS
 export ONOS_TEST_TAR=$ONOS_TEST_STAGE.tar.gz
 
-# Defaults for ONOS testing using remote machines.
-# if [ -n "${ONOS_CELL}" -a -f $ONOS_ROOT/tools/test/cells/${ONOS_CELL} ]; then
-#   . $ONOS_ROOT/tools/test/cells/${ONOS_CELL}
-# fi
 export ONOS_INSTALL_DIR="/opt/onos"     # Installation directory on remote
 export OCI="${OCI:-192.168.56.101}"     # ONOS Controller Instance
 export ONOS_USER="${ONOS_USER:-sdn}"    # ONOS user on remote system
diff --git a/tools/build/onos-build b/tools/build/onos-build
index b9c752e..99a48a4 100755
--- a/tools/build/onos-build
+++ b/tools/build/onos-build
@@ -3,9 +3,5 @@
 # Builds the ONOS from source.
 # -----------------------------------------------------------------------------
 
-set -e
-
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
-. $ONOS_ROOT/tools/build/envDefaults
-
-cd $ONOS_ROOT && mvn clean install "$@"
+cd $ONOS_ROOT && onos-buck build onos && onos-buck test
diff --git a/tools/build/onos-build-docs b/tools/build/onos-build-docs
index bc1d912..cdac83f 100755
--- a/tools/build/onos-build-docs
+++ b/tools/build/onos-build-docs
@@ -8,37 +8,4 @@
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
 . $ONOS_ROOT/tools/build/envDefaults
 
-apidocs=onos-apidocs-${ONOS_VERSION%~*}
-
-function expandList {
-    list="";
-    while read line; do
-        [ -n "$line" ] && list="$list:$line"
-    done < $1
-    echo "${list#:*}"
-}
-
-function processPom {
-    cp $1 aux-$1
-    egrep '@[a-zA-Z0-9.-]+' $1 | sed 's:^[^@]*@::g' | sed 's:</.*$::g' | while read line; do
-        packages="$(expandList $line)"
-        sed "s/@$line/$packages/" aux-$1 > aux-$1.aux
-        mv aux-$1.aux aux-$1
-    done
-}
-
-set -e
-
-trap "rm aux-internal.xml aux-external.xml 2>/dev/null" EXIT
-rm -fr $ONOS_ROOT/docs/target
-
-cd $ONOS_ROOT/docs
-processPom external.xml
-mvn -f aux-external.xml javadoc:aggregate "$@"
-
-cd target && mv site/apidocs $apidocs
-tar zcf $apidocs.tar.gz $apidocs && cp $apidocs.tar.gz $ONOS_STAGE_ROOT
-
-cd $ONOS_ROOT/docs
-processPom internal.xml
-mvn -f aux-internal.xml javadoc:aggregate "$@"
+onos-buck build //docs:external //docs:internal --show-output
diff --git a/tools/build/onos-package b/tools/build/onos-package
index 471d25c..4576aa0 100755
--- a/tools/build/onos-package
+++ b/tools/build/onos-package
@@ -3,6 +3,16 @@
 # Packages ONOS distributable into onos.tar.gz, onos.zip or a deb file
 # -----------------------------------------------------------------------------
 
+[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
+cd $ONOS_ROOT && onos-buck build onos --show-output && onos-check-bits
+exit $?
+
+#=============================================================================
+
+# FIXME: This needs to be refactored using Buck; for now it is disabled
+# FIXME: .deb, .rpm, .zip need to be re-implemented
+# FIXME: SM-ONOS packaging flavour needs to be re-implemented
+
 set -e
 
 # Build the staging directory used to produce the packages