Extending the versioning to cover BUCK artifacts.

Adding ability to version extraneous stuff.

Change-Id: I2e18dafd6d8705504ab01000d6707037415dfd0c
(cherry picked from commit 251016df5db8f11a14c4856f9b381e85ae1e2631)
diff --git a/tools/build/onos-change-version b/tools/build/onos-change-version
index 1eb328b..0e02590 100755
--- a/tools/build/onos-change-version
+++ b/tools/build/onos-change-version
@@ -17,6 +17,8 @@
 
 # Augment the version of the main pom and the modules nested underneath.
 mvn versions:set -DnewVersion=$NEW_VERSION versions:commit
+mvn -f lib/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
+sed -i "" -E "1,/<version>/s/<version>[^<]*</<version>$NEW_VERSION</g" pom.xml
 
 # Augment the version of the Java API pom files and the overview.html file.
 for pom in docs/internal.xml docs/external.xml; do
@@ -46,3 +48,10 @@
 perl -i -0pe "s#<artifactId>cord-gui<.*\n.*version>#<artifactId>cord-gui</artifactId>\n    <version>$NEW_VERSION</version>#" $ONOS_ROOT/apps/demo/cord-gui/pom.xml
 sed -i "" -E "s#demo/cord-gui/target/cord-gui-.*\.war#demo/cord-gui/target/cord-gui-$NEW_VERSION.war#" $ONOS_ROOT/apps/demo/cord-gui/src/scripts/pullwar.sh
 sed -i "" -E "s#CORD=./cord-gui-.*\.war#CORD=./cord-gui-$NEW_VERSION.war#" $ONOS_ROOT/apps/demo/cord-gui/src/scripts/run.me
+
+# Version the BUCK artifacts
+sed -i "" -E "s#/org/onosproject/onos-features/.*/#/org/onosproject/onos-features/$NEW_VERSION/#" $ONOS_ROOT/buck-tools/onos_stage.py
+sed -i "" -E "s#onos-features-.*-features.xml#onos-features-$NEW_VERSION-features.xml#" $ONOS_ROOT/buck-tools/onos_stage.py
+
+sed -i "" -E "s#ONOS_VERSION = .*#ONOS_VERSION = '$NEW_VERSION'#" $ONOS_ROOT/bucklets/onos.bucklet
+sed -i "" -E "s#ONOS_VERSION = .*#ONOS_VERSION = '$NEW_VERSION'#" $ONOS_ROOT/bucklets/onos_app.bucklet
diff --git a/tools/build/onos-validate-change-version b/tools/build/onos-validate-change-version
index d8f917f..826b693 100755
--- a/tools/build/onos-validate-change-version
+++ b/tools/build/onos-validate-change-version
@@ -9,8 +9,11 @@
 trap "rm -f $aux 2>/dev/null" EXIT
 
 cd $ONOS_ROOT
-grep -r SNAPSHOT . | \
-    egrep -v -f $ONOS_ROOT/tools/build/onos-validate-change-version.excludes >$aux
+find . -type f | \
+    egrep -v -f $ONOS_ROOT/tools/build/onos-validate-change-version.excludes | \
+    xargs grep SNAPSHOT >$aux
+
+    # FIXME: deal properly with files with white-space in them
 
 if [ -s $aux ]; then
     echo "There are files containing SNAPSHOT references:"
diff --git a/tools/build/onos-validate-change-version.excludes b/tools/build/onos-validate-change-version.excludes
index 32fb1e8..de38b8a 100755
--- a/tools/build/onos-validate-change-version.excludes
+++ b/tools/build/onos-validate-change-version.excludes
@@ -1,6 +1,13 @@
 \./build.log
 \./.git
-\./target/
+/target/
+\.iml$
+\./buck-out/
+\./lib/BUCK
+\./lib/deps.json
+\./bucklets/maven_jar\.bucklet
+\./tools/build/libgen
+\./utils/osgiwrap/
 \./tools/build/onos-validate-change-version
 \./tools/build/onos-change-version
 \./tools/build/onos-release
@@ -18,4 +25,7 @@
 \./apps/vrouter/pom.xml
 \./protocols/ospf/
 \./protocols/snmp/
-\./providers/snmp/
\ No newline at end of file
+\./providers/snmp/
+\./providers/bmv2/
+\./drivers/bmv2/
+\./apps/kafka-integration/
\ No newline at end of file