blob: b1928f8d1695ec43346000517603fc97ea1b6405 [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
Yuta HIGUCHIaa0cb502017-01-12 09:57:32 -080017trap "rm -f $ARTIFACT_PUB $ARTIFACT_PUB.bak $TEST_PUB $TEST_PUB.bak" EXIT
18
Brian O'Connor1fce5982016-10-25 00:16:16 -070019set -e
20set -x
21
Brian O'Connordc548792016-11-18 16:57:04 -080022# Prepare artifact publish commands
Ray Milkeyf3aba5f2017-01-09 16:47:14 -080023cat ${ONOS_ROOT}/tools/build/publish-target-list | grep -v '#' >> $ARTIFACT_PUB
Yuta HIGUCHIea8966d2016-12-03 15:04:54 -080024sed -i.bak 's/^/onos-buck publish --to-maven-central --include-source --include-javadoc --sign /g' $ARTIFACT_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070025
Brian O'Connordc548792016-11-18 16:57:04 -080026# Print commands to be run and then run them
27cat $ARTIFACT_PUB
28bash $ARTIFACT_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070029
Ray Milkey033b9f92016-12-09 16:21:55 -080030# Prepare feature commands
Ray Milkeyf3aba5f2017-01-09 16:47:14 -080031onos-buck query "filter('.*-feature', deps(filter('.*-oar', deps('//tools/package:onos-package', 1)),1))" > $TEST_PUB
32echo "//tools/package:onos-features" >> $TEST_PUB
Ray Milkey033b9f92016-12-09 16:21:55 -080033
Ray Milkeyf3aba5f2017-01-09 16:47:14 -080034# Prepare test commands
35cat ${ONOS_ROOT}/tools/build/publish-test-target-list | grep -v '#' >> $TEST_PUB
Yuta HIGUCHIea8966d2016-12-03 15:04:54 -080036sed -i.bak 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070037
Brian O'Connordc548792016-11-18 16:57:04 -080038# Print commands to be run and then run them
39cat $TEST_PUB
40bash $TEST_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070041
Ray Milkey5c5454b2017-01-25 13:26:30 -080042# stage ONOS poms
43onos-buck publish --to-maven-central --sign //:top-level-pom
44onos-buck publish --to-maven-central --sign //lib:onos-dependencies-pom
45
Ray Milkey52e11272017-02-01 17:15:10 -080046if [ ! grep "maven_url" $ONOS_ROOT/.buckconfig.local | grep -v '#' | grep -q snapshots ]; then
47 # Close the staging area
48 onos-close-staging
49fi