blob: a4db536f88726b8fd35f424f676e5a551b47528f [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; }
trap "rm -f $ARTIFACT_PUB $ARTIFACT_PUB.bak $TEST_PUB $TEST_PUB.bak" EXIT
set -e
set -x
# Prepare artifact publish commands
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
cp $ARTIFACT_PUB $ARTIFACT_PUB.bak
( echo "set -e"; cat $ARTIFACT_PUB.bak ) >$ARTIFACT_PUB
# Print commands to be run and then run them
cat $ARTIFACT_PUB
bash $ARTIFACT_PUB
# Prepare feature commands
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
cp $TEST_PUB $TEST_PUB.bak
( echo "set -e"; cat $TEST_PUB.bak ) >$TEST_PUB
# Print commands to be run and then run them
cat $TEST_PUB
bash $TEST_PUB
# stage ONOS poms
onos-buck publish --to-maven-central --sign //:top-level-pom
onos-buck publish --to-maven-central --sign //lib:onos-dependencies-pom
if ! grep "maven_url" $ONOS_ROOT/.buckconfig.local | grep -v '#' | grep -q snapshots ; then
# Close the staging area
onos-close-staging
fi