blob: f51de052a371c7aea9d0e7a9296015212321b967 [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
23onos-buck query "kind('onos_jar', deps('//tools/package:onos-package'))" >> $ARTIFACT_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070024
Yuta HIGUCHIea8966d2016-12-03 15:04:54 -080025sed -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 -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
Ray Milkey033b9f92016-12-09 16:21:55 -080031# Prepare apps commands
32onos-buck query "filter('.*-oar', deps('//tools/package:onos-package', 1))" >> $ARTIFACT_PUB
33# Prepare feature commands
34onos-buck query "filter('.*-feature', deps(filter('.*-oar', deps('//tools/package:onos-package', 1)),1))" >> $ARTIFACT_PUB
35echo "//tools/package:onos-features" >> $ARTIFACT_PUB
36# Prepare test commands
Brian O'Connordc548792016-11-18 16:57:04 -080037onos-buck query "testsof(kind('onos_jar', deps('//tools/package:onos-package')))" >> $TEST_PUB
Ray Milkey033b9f92016-12-09 16:21:55 -080038
Yuta HIGUCHIea8966d2016-12-03 15:04:54 -080039sed -i.bak 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070040
Brian O'Connordc548792016-11-18 16:57:04 -080041# Print commands to be run and then run them
42cat $TEST_PUB
43bash $TEST_PUB
Brian O'Connor1fce5982016-10-25 00:16:16 -070044
Brian O'Connord89bfd02016-11-22 15:39:49 -080045# Close the staging area
Yuta HIGUCHIea8966d2016-12-03 15:04:54 -080046onos-close-staging