Added options to allow publishing only the library jars.

Change-Id: I9d90d6e807bca1a36356f2bd5ea99238e81d72eb
diff --git a/tools/build/onos-publish b/tools/build/onos-publish
index 482b828..bdcf02f 100755
--- a/tools/build/onos-publish
+++ b/tools/build/onos-publish
@@ -3,7 +3,17 @@
 # Publishes ONOS artifacts to a Maven repository (local or remote)
 # -----------------------------------------------------------------------------
 
+options=""
+while getopts lh? o; do
+    case "$o" in
+        l) options="$options -l";;
+        *) echo "usage: $(basename $0) [-l] [repoURL]" >&2; exit 1;;
+    esac
+done
+let OPC=$OPTIND-1
+shift $OPC
+
 REPO_URL=$1
 CATALOG=/tmp/onos.$$.catalog
 
-onos-publish-catalog $CATALOG && onos-upload-artifacts.py $CATALOG $REPO_URL
\ No newline at end of file
+onos-publish-catalog $options $CATALOG && onos-upload-artifacts.py $CATALOG $REPO_URL
\ No newline at end of file
diff --git a/tools/build/onos-publish-catalog b/tools/build/onos-publish-catalog
index bf16418..ca27f92 100755
--- a/tools/build/onos-publish-catalog
+++ b/tools/build/onos-publish-catalog
@@ -3,6 +3,18 @@
 # Generates a catalog for publishing ONOS artifacts to a Maven repository.
 # -----------------------------------------------------------------------------
 
+libsOnly=false
+
+# Process any usage options
+while getopts lh? o; do
+    case "$o" in
+        l) libsOnly=true;;
+        *) echo "usage: $(basename $0) [-l]" >&2; exit 1;;
+    esac
+done
+let OPC=$OPTIND-1
+shift $OPC
+
 set -e -o pipefail
 
 CATALOG=${1:-/tmp/onos.catalog}
@@ -25,6 +37,24 @@
     egrep -v '(# |grpc/api|build/conf)' tools/build/publish-test-target-list
 }
 
+echo "Cataloging jar files..."
+writeCatalog $(jars)
+
+echo "Cataloging test jars..."
+writeCatalog $(testJars)
+
+[ $libsOnly = true ] && exit 0
+
+echo "Cataloging source jars..."
+writeCatalog $(jars | sed 's/$/-sources/')
+echo "Cataloging javadoc jars..."
+writeCatalog $(jars | sed 's/$/-javadoc/')
+echo "Cataloging pom files..."
+writeCatalog $(jars | sed 's/$/-pom/')
+
+echo "Cataloging oar files..."
+writeCatalog $(bazel query 'kind("_onos_oar rule", //...)')
+
 # Extract the version from the Bazel variables file
 VERSION=$(egrep ONOS_VERSION tools/build/bazel/variables.bzl | cut -d\" -f2)
 
@@ -37,19 +67,3 @@
 bazel-bin/onos-test.tar.gz	org/onosproject/onos-releases/$VERSION/onos-test-$VERSION.tar.gz
 bazel-bin/tools/build/conf/libonos-build-conf.jar	org/onosproject/onos-build-conf/$VERSION/onos-build-conf-$VERSION.jar
 EOF
-
-echo "Cataloging jar files..."
-writeCatalog $(jars)
-
-echo "Cataloging test jars..."
-writeCatalog $(testJars)
-
-echo "Cataloging source jars..."
-writeCatalog $(jars | sed 's/$/-sources/')
-echo "Cataloging javadoc jars..."
-writeCatalog $(jars | sed 's/$/-javadoc/')
-echo "Cataloging pom files..."
-writeCatalog $(jars | sed 's/$/-pom/')
-
-echo "Cataloging oar files..."
-writeCatalog $(bazel query 'kind("_onos_oar rule", //...)')