Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | DEFAULT_TAG=${TAG:-$(date +v%Y.%m.%d.01)} |
| 4 | NO_BUCKD=1 |
| 5 | |
| 6 | DOWNLOAD_BASE="http://onlab.vicci.org/onos/third-party" |
| 7 | BUCK_ZIP="buck-$DEFAULT_TAG.zip" |
| 8 | ZIP_STAGE="buck-bin" |
| 9 | |
| 10 | rm -rf $ZIP_STAGE |
| 11 | |
| 12 | set -e |
| 13 | set -x |
| 14 | |
| 15 | # build plugins |
| 16 | |
| 17 | pushd onos |
| 18 | buck build //tools/build/buck-plugin:onosjar |
| 19 | popd #onos |
| 20 | |
| 21 | pushd onos-yang-tools |
| 22 | mvn clean package |
| 23 | popd #onos-yang-tools |
| 24 | |
| 25 | # assemble zip |
| 26 | |
| 27 | mkdir -p buck-bin/plugins |
| 28 | |
| 29 | cp buck/buck-out/gen/programs/buck.pex $ZIP_STAGE/buck |
| 30 | cp onos/buck-out/gen/tools/build/buck-plugin/onosjar.jar $ZIP_STAGE/plugins/onos.jar |
| 31 | cp onos-yang-tools/plugin/buck/target/onos-yang-buck-plugin-1.9-SNAPSHOT.jar $ZIP_STAGE/plugins/yang.jar |
| 32 | |
| 33 | BUCK_VERSION=$(buck/buck-out/gen/programs/buck.pex -V) |
| 34 | echo $BUCK_VERSION > $ZIP_STAGE/.buck_version |
| 35 | |
| 36 | chmod 555 $ZIP_STAGE/buck |
| 37 | chmod 444 $ZIP_STAGE/.buck_version |
| 38 | |
| 39 | pushd $ZIP_STAGE |
| 40 | zip -r ../$BUCK_ZIP buck .buck_version plugins |
| 41 | popd #$ZIP_STAGE |
| 42 | |
| 43 | # publish zip |
| 44 | #FIXME check for s3 credentials |
| 45 | uploadToS3.py --dest third-party/ $BUCK_ZIP |
| 46 | |
| 47 | # update version in onos-buck |
| 48 | URL="$DOWNLOAD_BASE/$BUCK_ZIP" |
| 49 | SHA=$(shasum $BUCK_ZIP | cut -d' ' -f1) |
| 50 | |
| 51 | sed -i "" -E "s#BUCK_URL=.*#BUCK_URL=\"$URL\"#" onos/tools/build/onos-buck |
| 52 | sed -i "" -E "s#BUCK_SHA=.*#BUCK_SHA=\"$SHA\"#" onos/tools/build/onos-buck |
| 53 | sed -i "" -E "s#REQUIRED_VERSION=.*#REQUIRED_VERSION=\"$BUCK_VERSION\"#" onos/tools/build/onos-buck |
| 54 | |
| 55 | set +x |
| 56 | echo |
| 57 | echo "Commit and push change to onos-buck on the onos directory." |