Only push maven artifacts that are useful to external apps

Change-Id: I87e077334c69402f0e178aceb14116597760f351
diff --git a/tools/build/check-uploaded-maven-artifacts b/tools/build/check-uploaded-maven-artifacts
index 0db1d04..7b8f003 100755
--- a/tools/build/check-uploaded-maven-artifacts
+++ b/tools/build/check-uploaded-maven-artifacts
@@ -24,7 +24,7 @@
     repoResponse = requests.head(remoteUrl)
 
     if repoResponse.status_code != 200:
-        print 'Cannot find jar file artifact'
+        print 'Cannot find jar file artifact at ' + remoteUrl
         print repoResponse.text
         sys.exit(1)
 
@@ -69,7 +69,10 @@
 
 checkArtifactsForComponent(version, 'onos-api', 'core/api', buildRoot, repoRoot)
 checkArtifactsForComponent(version, 'onos-protocols-openflow-api', 'protocols/openflow/api', buildRoot, repoRoot)
-checkArtifactsForComponent(version, 'onos-drivers-ciena', 'drivers/ciena', buildRoot, repoRoot)
-checkArtifactsForComponent(version, 'onos-providers-lldp', 'providers/lldp', buildRoot, repoRoot)
-checkArtifactsForComponent(version, 'onos-apps-bgprouter', 'apps/bgprouter', buildRoot, repoRoot)
+checkArtifactsForComponent(version, 'onos-core-serializers', 'core/store/serializers', buildRoot, repoRoot)
+checkArtifactsForComponent(version, 'onos-cli', 'cli', buildRoot, repoRoot)
+checkArtifactsForComponent(version, 'onos-apps-optical-model', 'apps/optical-model', buildRoot, repoRoot)
+
+
+
 
diff --git a/tools/build/onos-buck-publish b/tools/build/onos-buck-publish
index f51de05..0d82c1c 100755
--- a/tools/build/onos-buck-publish
+++ b/tools/build/onos-buck-publish
@@ -20,22 +20,19 @@
 set -x
 
 # Prepare artifact publish commands
-onos-buck query "kind('onos_jar', deps('//tools/package:onos-package'))" >> $ARTIFACT_PUB
-
+cat ${ONOS_ROOT}/tools/build/publish-target-list | grep -v '#' >> $ARTIFACT_PUB
 sed -i.bak 's/^/onos-buck publish --to-maven-central --include-source --include-javadoc --sign /g' $ARTIFACT_PUB
 
 # Print commands to be run and then run them
 cat $ARTIFACT_PUB
 bash $ARTIFACT_PUB
 
-# Prepare apps commands
-onos-buck query "filter('.*-oar', deps('//tools/package:onos-package', 1))" >> $ARTIFACT_PUB
 # Prepare feature commands
-onos-buck query "filter('.*-feature', deps(filter('.*-oar', deps('//tools/package:onos-package', 1)),1))" >> $ARTIFACT_PUB
-echo "//tools/package:onos-features" >> $ARTIFACT_PUB
-# Prepare test commands
-onos-buck query "testsof(kind('onos_jar', deps('//tools/package:onos-package')))" >> $TEST_PUB
+onos-buck query "filter('.*-feature', deps(filter('.*-oar', deps('//tools/package:onos-package', 1)),1))" > $TEST_PUB
+echo "//tools/package:onos-features" >> $TEST_PUB
 
+# Prepare test commands
+cat ${ONOS_ROOT}/tools/build/publish-test-target-list | grep -v '#' >> $TEST_PUB
 sed -i.bak 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB
 
 # Print commands to be run and then run them
diff --git a/tools/build/onos-buck-publish-local b/tools/build/onos-buck-publish-local
index d47f72d..6c52db7 100755
--- a/tools/build/onos-buck-publish-local
+++ b/tools/build/onos-buck-publish-local
@@ -3,21 +3,8 @@
 set -e
 onos-buck -V
 
-rm -f /tmp/publish.sh
-trap "rm -f /tmp/publish.sh /tmp/publish.sh.bak" EXIT
+for package in `cat ${ONOS_ROOT}/tools/build/publish-target-list ${ONOS_ROOT}/tools/build/publish-test-target-list | grep -v '#'`; do
+    onos-buck publish --to-local-repo ${package}
+done
 
 
-onos-buck query "kind('onos_jar', deps('//tools/package:onos-package'))" >> /tmp/publish.sh
-
-sed -i.bak 's/^/onos-buck publish --to-local-repo /g' /tmp/publish.sh
-
-bash /tmp/publish.sh
-
-rm /tmp/publish.sh
-rm /tmp/publish.sh.bak
-
-onos-buck query "testsof(kind('onos_jar', deps('//tools/package:onos-package')))" >> /tmp/publish.sh
-sed -i.bak 's#^#onos-buck publish --to-local-repo #g' /tmp/publish.sh
-
-bash /tmp/publish.sh
-rm /tmp/publish.sh.bak
diff --git a/tools/build/onos-prepare-release b/tools/build/onos-prepare-release
index 4088869..8e4ecc6 100755
--- a/tools/build/onos-prepare-release
+++ b/tools/build/onos-prepare-release
@@ -31,10 +31,9 @@
 git tag -l | grep -q "$ONOS_VERSION\$" &&
   { echo "ERROR: Version already exists"; exit -1; }
 
-
+# Copy local buck configuration to new tree
 cp $ONOS_ROOT/.buckconfig.local $DIR/
 
-
 export ONOS_ROOT=$DIR
 . $ONOS_ROOT/tools/build/envDefaults
 exec bash $COMMAND
diff --git a/tools/build/onos-release b/tools/build/onos-release
index d903b0b..42ad942 100755
--- a/tools/build/onos-release
+++ b/tools/build/onos-release
@@ -48,11 +48,17 @@
 
 # Build ONOS archetypes & deploy to staging repo using the release profile.
 # Note that release of the staging repository is a separate manual step.
-export MVN_CLI_OPTS=-Pstaging
-pushd tools/package/archetypes/
-mvn -Pstaging clean install && onos-archetypes-test && mvn -Pstaging -Prelease clean deploy
-popd
-unset MVN_CLI_OPTS
+if [ $dryRun -eq 0 ]; then
+    export MVN_CLI_OPTS=-Pstaging
+    pushd tools/package/archetypes/
+    mvn -Pstaging clean install && onos-archetypes-test && mvn -Pstaging -Prelease clean deploy
+    popd
+    unset MVN_CLI_OPTS
+else
+    pushd tools/package/archetypes/
+    mvn clean install && onos-archetypes-test
+    popd
+fi
 
 # Commit newly versioned artifacts and issue a tag.
 git commit -a -m"Tagging $NEW_VERSION"
diff --git a/tools/build/publish-target-list b/tools/build/publish-target-list
new file mode 100644
index 0000000..685072c
--- /dev/null
+++ b/tools/build/publish-target-list
@@ -0,0 +1,23 @@
+# Targets placed in this list will be published as Maven artifacts
+    //utils/osgi:onlab-osgi
+    //utils/junit:onlab-junit
+    //utils/misc:onlab-misc
+    //utils/rest:onlab-rest
+    //core/api:onos-api
+    //incubator/api:onos-incubator-api
+    //core/net:onos-core-net
+    //core/common:onos-core-common
+    //core/store/dist:onos-core-dist
+    //core/store/serializers:onos-core-serializers
+    //core/store/persistence:onos-core-persistence
+    //incubator/net:onos-incubator-net
+    //incubator/core:onos-incubator-core
+    //incubator/rpc:onos-incubator-rpc
+    //incubator/store:onos-incubator-store
+    //cli:onos-cli
+    //protocols/openflow/api:onos-protocols-openflow-api
+    //protocols/openflow/ctl:onos-protocols-openflow-ctl
+    //apps/optical:onos-apps-optical
+    //apps/optical-model:onos-apps-optical-model
+    //web/api:onos-rest
+    //protocols/netconf/api:onos-protocols-netconf-api
diff --git a/tools/build/publish-test-target-list b/tools/build/publish-test-target-list
new file mode 100644
index 0000000..68f3a88
--- /dev/null
+++ b/tools/build/publish-test-target-list
@@ -0,0 +1,7 @@
+# Targets placed in this list will be published as Maven test artifacts
+    //utils/osgi:onlab-osgi-tests
+    //utils/junit:onlab-junit-tests
+    //utils/misc:onlab-misc-tests
+    //core/api:onos-api-tests
+    //core/net:onos-core-net-tests
+    //core/common:onos-core-common-tests