blob: d7d0202b6ac2c101596c9358b7c7a57490c2d105 [file] [log] [blame]
#!/bin/bash
#
# Script that queries buck for main and test artifacts and publishes them to
# a remote Maven repository. Main artifacts are published with javadoc and sources
# jars and auto-generated pom.xml files. Test artifacts are published as compiled
# jars only. All artifacts are signed.
#
ARTIFACT_PUB=$(mktemp /tmp/onos-publish.XXXXX) &&
echo "Created temp file for artifact publish: $ARTIFACT_PUB" ||
{ echo "Failed to create temp file"; exit 1; }
TEST_PUB=$(mktemp /tmp/onos-publish-tests.XXXXX) &&
echo "Created temp file for test artifact publish: $TEST_PUB" ||
{ echo "Failed to create temp file"; exit 1; }
set -e
set -x
# Prepare artifact publish commands
onos-buck query "kind('onos_jar', deps('//tools/package:onos-package'))" >> $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
sed -i.bak 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB
# Print commands to be run and then run them
cat $TEST_PUB
bash $TEST_PUB
# Close the staging area
onos-close-staging