Ensure symbolic link to buck artifacts are present
- stc, etc. relied on the behavior that source-ing
envDefaults will create symlink to buck artifacts
Change-Id: Ic5039dbaf18f0eb36b1bb7a41dbecc8a5f974f19
diff --git a/tools/build/envDefaults b/tools/build/envDefaults
index 937f9af..8a5913f 100644
--- a/tools/build/envDefaults
+++ b/tools/build/envDefaults
@@ -33,6 +33,12 @@
export ONOS_TAR=$ONOS_STAGE.tar.gz
export ONOS_ZIP=$ONOS_STAGE.zip
+# If the BUCK-built bits are newer than the Maven-built bits, use the former.
+BUCK_TAR=$ONOS_ROOT/buck-out/gen/tools/package/onos-package/onos.tar.gz
+if [ -f $BUCK_TAR -a $BUCK_TAR -nt $ONOS_TAR ]; then
+ rm -f $ONOS_TAR >/dev/null; ln -s $BUCK_TAR $ONOS_TAR
+fi
+
# ONOS test bits (onos-test.tar.gz) staging environment
export ONOS_TEST_BITS=onos-test-${ONOS_VERSION%~*}
export ONOS_TEST_STAGE_ROOT=${ONOS_TEST_STAGE_ROOT:-/tmp}