Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 2 | # |
| 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'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 8 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 9 | ARTIFACT_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 | |
| 13 | TEST_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'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 16 | |
Yuta HIGUCHI | aa0cb50 | 2017-01-12 09:57:32 -0800 | [diff] [blame] | 17 | trap "rm -f $ARTIFACT_PUB $ARTIFACT_PUB.bak $TEST_PUB $TEST_PUB.bak" EXIT |
| 18 | |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 19 | set -e |
| 20 | set -x |
| 21 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 22 | # Prepare artifact publish commands |
Ray Milkey | f3aba5f | 2017-01-09 16:47:14 -0800 | [diff] [blame] | 23 | cat ${ONOS_ROOT}/tools/build/publish-target-list | grep -v '#' >> $ARTIFACT_PUB |
Yuta HIGUCHI | ea8966d | 2016-12-03 15:04:54 -0800 | [diff] [blame] | 24 | sed -i.bak 's/^/onos-buck publish --to-maven-central --include-source --include-javadoc --sign /g' $ARTIFACT_PUB |
Ray Milkey | a3b7f5d | 2017-02-02 10:37:35 -0800 | [diff] [blame] | 25 | cp $ARTIFACT_PUB $ARTIFACT_PUB.bak |
| 26 | ( echo "set -e"; cat $ARTIFACT_PUB.bak ) >$ARTIFACT_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 27 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 28 | # Print commands to be run and then run them |
| 29 | cat $ARTIFACT_PUB |
| 30 | bash $ARTIFACT_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 31 | |
Ray Milkey | 033b9f9 | 2016-12-09 16:21:55 -0800 | [diff] [blame] | 32 | # Prepare feature commands |
Ray Milkey | f3aba5f | 2017-01-09 16:47:14 -0800 | [diff] [blame] | 33 | onos-buck query "filter('.*-feature', deps(filter('.*-oar', deps('//tools/package:onos-package', 1)),1))" > $TEST_PUB |
| 34 | echo "//tools/package:onos-features" >> $TEST_PUB |
Ray Milkey | 033b9f9 | 2016-12-09 16:21:55 -0800 | [diff] [blame] | 35 | |
Ray Milkey | f3aba5f | 2017-01-09 16:47:14 -0800 | [diff] [blame] | 36 | # Prepare test commands |
| 37 | cat ${ONOS_ROOT}/tools/build/publish-test-target-list | grep -v '#' >> $TEST_PUB |
Yuta HIGUCHI | ea8966d | 2016-12-03 15:04:54 -0800 | [diff] [blame] | 38 | sed -i.bak 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB |
Ray Milkey | a3b7f5d | 2017-02-02 10:37:35 -0800 | [diff] [blame] | 39 | cp $TEST_PUB $TEST_PUB.bak |
| 40 | ( echo "set -e"; cat $TEST_PUB.bak ) >$TEST_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 41 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 42 | # Print commands to be run and then run them |
| 43 | cat $TEST_PUB |
| 44 | bash $TEST_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 45 | |
Ray Milkey | 5c5454b | 2017-01-25 13:26:30 -0800 | [diff] [blame] | 46 | # stage ONOS poms |
| 47 | onos-buck publish --to-maven-central --sign //:top-level-pom |
| 48 | onos-buck publish --to-maven-central --sign //lib:onos-dependencies-pom |
| 49 | |
Ray Milkey | 5b03201 | 2017-02-08 13:32:56 -0800 | [diff] [blame^] | 50 | if ! grep "maven_url" $ONOS_ROOT/.buckconfig.local | grep -v '#' | grep -q snapshots ; then |
Ray Milkey | 52e1127 | 2017-02-01 17:15:10 -0800 | [diff] [blame] | 51 | # Close the staging area |
| 52 | onos-close-staging |
| 53 | fi |