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
diff --git a/tools/dev/bash_profile b/tools/dev/bash_profile
index b0c6133..4999963 100644
--- a/tools/dev/bash_profile
+++ b/tools/dev/bash_profile
@@ -45,25 +45,27 @@
egrep "${1:-$ONOS_ROOT}" | head -n 1)
}
-# Short-hand for 'mvn clean install' for us lazy folk
-alias mci='mvn clean install'
-alias mcis='mvn clean install -DskipTests -Dcheckstyle.skip'
-alias mis='mvn install -DskipTests -Dcheckstyle.skip'
+# Buck (if "buck" is not on the PATH)
+[ -z "$(which buck)" ] && alias buck="onos-buck"
# Short-hand for ONOS build, package and test.
alias ob='onos-build'
-alias obf='ob -DskipTests -Dcheckstyle.skip'
-alias obi='onos-build -Dmaven.test.failure.ignore=true'
-alias obs='onos-build-selective'
+alias obf='(cd $ONOS_ROOT && buck build onos)'
alias obd='onos-build-docs'
alias op='onos-package'
-alias ok='onos-karaf'
alias ot='onos-test'
+
+alias deprecatedAlias='echo "This alias has been deprecated."'
+alias obi=deprecatedAlias
+alias obs=deprecatedAlias
+
+alias ok='buck run onos-local'
+alias oh='onos localhost halt'
+
alias ol='onos-log'
alias ow='onos-watch'
alias ocl='onos-check-logs'
alias oi='setPrimaryInstance'
-alias pub='onos-push-update-bundle'
# Short-hand for tailing and searching the ONOS (karaf) log
alias tl='$ONOS_ROOT/tools/dev/bin/onos-local-log'
@@ -89,6 +91,13 @@
alias rsdocs='onos-rsdocs'
alias gui='onos-gui'
+# Short-hand for 'mvn clean install' for us lazy folk
+alias mci='mvn clean install'
+alias mcis='mvn clean install -DskipTests -Dcheckstyle.skip'
+alias mis='mvn install -DskipTests -Dcheckstyle.skip'
+
+# Git annotated one-line log
+alias gil='git log --oneline --decorate=short'
# Test related conveniences
@@ -97,7 +106,6 @@
alias sshnet='onos-ssh $OCN'
-
# Applies the settings in the specified topology recipe file or lists current
# topo recipe definition if no topo recipe file is given.
function topo {
@@ -276,9 +284,3 @@
# Load UK topo GEO data
alias uktopo='onos-netcfg $OCI $ONOS_ROOT/tools/test/topos/uk-cfg.json'
-
-# Git annotated one-line log
-alias gil='git log --oneline --decorate=short'
-
-# Buck (if "buck" is not on the PATH)
-[ -z "$(which buck)" ] && alias buck="onos-buck"
diff --git a/tools/test/bin/onos-check-bits b/tools/test/bin/onos-check-bits
index 6b91a48..98ce3f5 100755
--- a/tools/test/bin/onos-check-bits
+++ b/tools/test/bin/onos-check-bits
@@ -22,7 +22,7 @@
echo "ONOS archive is not a valid tar file" && exit 1
fi
-tar tzf ${ONOS_TAR} | grep -q onos-${ONOS_VERSION}.*/VERSION
+tar tzf ${ONOS_TAR} | grep -q onos-${ONOS_POM_VERSION}.*/VERSION
if [ $? -ne 0 ]; then
echo "ONOS archive does not contain the proper version file" && exit 1
fi
diff --git a/tools/test/bin/onos-push-update-bundle b/tools/test/bin/onos-push-update-bundle
deleted file mode 100755
index a75769a..0000000
--- a/tools/test/bin/onos-push-update-bundle
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-# -----------------------------------------------------------------------------
-# Pushes the specified bundle to the remote ONOS cell machines and updates it.
-# -----------------------------------------------------------------------------
-
-[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
-. $ONOS_ROOT/tools/build/envDefaults
-
-cd ~/.m2/repository
-jar=$(find org/onosproject -type f -name '*.jar' | grep -e $1 | grep -v -e -tests | head -n 1)
-
-[ -z "$jar" ] && echo "No bundle $1 found for" && exit 1
-
-bundle=$(echo $(basename $jar .jar) | sed 's/-[0-9].*//g')
-
-echo "pushing bundle: $bundle"
-
-nodes=$(env | sort | egrep "^OC[0-9]+" | cut -d= -f2)
-for node in $nodes; do
- scp -q $jar $ONOS_USER@$node:.m2/repository/$jar
- scp -q $jar $ONOS_USER@$node:$ONOS_INSTALL_DIR/$KARAF_DIST/system/$jar
- ssh $ONOS_USER@$node "
- $ONOS_INSTALL_DIR/bin/onos \"bundle:stop -f $bundle\"
- $ONOS_INSTALL_DIR/bin/onos \"bundle:update -f $bundle\"
- $ONOS_INSTALL_DIR/bin/onos \"bundle:start -f $bundle\"
- " 2>/dev/null
-done