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 | |
| 17 | set -e |
| 18 | set -x |
| 19 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 20 | # Prepare artifact publish commands |
| 21 | onos-buck query "kind('onos_jar', deps('//tools/package:onos-package'))" >> $ARTIFACT_PUB |
| 22 | onos-buck query "filter('.*-oar', deps('//tools/package:onos-package', 1))" >> $ARTIFACT_PUB |
| 23 | echo "//tools/package:onos-features" >> $ARTIFACT_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 24 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 25 | sed -i "" -E 's/^/onos-buck publish --to-maven-central --include-source --include-javadoc --sign /g' $ARTIFACT_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 26 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 27 | # Print commands to be run and then run them |
| 28 | cat $ARTIFACT_PUB |
| 29 | bash $ARTIFACT_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 30 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 31 | # Prepare test publish commands |
| 32 | onos-buck query "testsof(kind('onos_jar', deps('//tools/package:onos-package')))" >> $TEST_PUB |
| 33 | sed -i "" -E 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 34 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 35 | # Print commands to be run and then run them |
| 36 | cat $TEST_PUB |
| 37 | bash $TEST_PUB |
Brian O'Connor | 1fce598 | 2016-10-25 00:16:16 -0700 | [diff] [blame] | 38 | |
Brian O'Connor | dc54879 | 2016-11-18 16:57:04 -0800 | [diff] [blame] | 39 | # FIXME Close the staging area |