| #!/bin/bash |
| # |
| # Script that queries buck for main and test artifacts and publishes them to |
| # a remote Maven repository. Main artifacts are published with javadoc and sources |
| # jars and auto-generated pom.xml files. Test artifacts are published as compiled |
| # jars only. All artifacts are signed. |
| # |
| |
| ARTIFACT_PUB=$(mktemp /tmp/onos-publish.XXXXX) && |
| echo "Created temp file for artifact publish: $ARTIFACT_PUB" || |
| { echo "Failed to create temp file"; exit 1; } |
| |
| TEST_PUB=$(mktemp /tmp/onos-publish-tests.XXXXX) && |
| echo "Created temp file for test artifact publish: $TEST_PUB" || |
| { echo "Failed to create temp file"; exit 1; } |
| |
| trap "rm -f $ARTIFACT_PUB $ARTIFACT_PUB.bak $TEST_PUB $TEST_PUB.bak" EXIT |
| |
| set -e |
| set -x |
| |
| # Prepare artifact publish commands |
| cat ${ONOS_ROOT}/tools/build/publish-target-list | grep -v '#' >> $ARTIFACT_PUB |
| sed -i.bak 's/^/onos-buck publish --to-maven-central --include-source --include-javadoc --sign /g' $ARTIFACT_PUB |
| |
| # Print commands to be run and then run them |
| cat $ARTIFACT_PUB |
| bash $ARTIFACT_PUB |
| |
| # Prepare feature commands |
| onos-buck query "filter('.*-feature', deps(filter('.*-oar', deps('//tools/package:onos-package', 1)),1))" > $TEST_PUB |
| echo "//tools/package:onos-features" >> $TEST_PUB |
| |
| # Prepare test commands |
| cat ${ONOS_ROOT}/tools/build/publish-test-target-list | grep -v '#' >> $TEST_PUB |
| sed -i.bak 's#^#onos-buck publish --to-maven-central --sign #g' $TEST_PUB |
| |
| # Print commands to be run and then run them |
| cat $TEST_PUB |
| bash $TEST_PUB |
| |
| # Close the staging area |
| onos-close-staging |