blob: 53af0e43110f8186f68ee052e5c148aba4a90a26 [file] [log] [blame]
Brian O'Connor1fce5982016-10-25 00:16:16 -07001#!/bin/bash
Brian O'Connordc548792016-11-18 16:57:04 -08002#
3# Script that queries buck for main and test artifacts and publishes them to
4# a remote Maven repository. Main artifacts are published with javadoc and sources
5# jars and auto-generated pom.xml files. Test artifacts are published as compiled
6# jars only. All artifacts are signed.
7#
Brian O'Connor1fce5982016-10-25 00:16:16 -07008
Brian O'Connordc548792016-11-18 16:57:04 -08009ARTIFACT_PUB=$(mktemp /tmp/onos-publish.XXXXX) &&
10 echo "Created temp file for artifact publish: $ARTIFACT_PUB" ||
11 { echo "Failed to create temp file"; exit 1; }
12
13TEST_PUB=$(mktemp /tmp/onos-publish-tests.XXXXX) &&
14 echo "Created temp file for test artifact publish: $TEST_PUB" ||
15 { echo "Failed to create temp file"; exit 1; }
Brian O'Connor1fce5982016-10-25 00:16:16 -070016
17set -e
18set -x
19
Brian O'Connordc548792016-11-18 16:57:04 -080020# Prepare artifact publish commands
21onos-buck query "kind('onos_jar', deps('//tools/package:onos-package'))" >> $ARTIFACT_PUB
22onos-buck query "filter('.*-oar', deps('//tools/package:onos-package', 1))" >> $ARTIFACT_PUB
23echo "//tools/package:onos-features" >> $ARTIFACT_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070024
Brian O'Connordc548792016-11-18 16:57:04 -080025sed -i "" -E 's/^/onos-buck publish --to-maven-central --include-source --include-javadoc --sign /g' $ARTIFACT_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070026
Brian O'Connordc548792016-11-18 16:57:04 -080027# Print commands to be run and then run them
28cat $ARTIFACT_PUB
29bash $ARTIFACT_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070030
Brian O'Connordc548792016-11-18 16:57:04 -080031# Prepare test publish commands
32onos-buck query "testsof(kind('onos_jar', deps('//tools/package:onos-package')))" >> $TEST_PUB
33sed -i "" -E 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070034
Brian O'Connordc548792016-11-18 16:57:04 -080035# Print commands to be run and then run them
36cat $TEST_PUB
37bash $TEST_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070038
Brian O'Connordc548792016-11-18 16:57:04 -080039# FIXME Close the staging area