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 | |
Brian O'Connor | 1b42eea | 2016-10-20 14:21:00 -0700 | [diff] [blame] | 17 | pushd buck |
Gaurav Agrawal | b1d839f | 2017-03-15 17:18:46 +0530 | [diff] [blame] | 18 | onos-buck build buck |
Brian O'Connor | 1b42eea | 2016-10-20 14:21:00 -0700 | [diff] [blame] | 19 | popd #buck |
| 20 | |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 21 | pushd onos |
Gaurav Agrawal | b1d839f | 2017-03-15 17:18:46 +0530 | [diff] [blame] | 22 | onos-buck build //tools/build/buck-plugin:onos |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 23 | popd #onos |
| 24 | |
Ray Milkey | dfc4ca6 | 2017-07-28 13:51:09 -0700 | [diff] [blame] | 25 | pushd onos-yang-tools |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 26 | mvn clean package |
| 27 | popd #onos-yang-tools |
| 28 | |
| 29 | # assemble zip |
| 30 | |
| 31 | mkdir -p buck-bin/plugins |
| 32 | |
| 33 | cp buck/buck-out/gen/programs/buck.pex $ZIP_STAGE/buck |
Brian O'Connor | 1b42eea | 2016-10-20 14:21:00 -0700 | [diff] [blame] | 34 | cp onos/buck-out/gen/tools/build/buck-plugin/onos.jar $ZIP_STAGE/plugins/onos.jar |
Brian O'Connor | 5420e8a | 2017-03-21 15:50:41 -0700 | [diff] [blame] | 35 | cp onos-yang-tools/compiler/plugin/buck/target/onos-yang-compiler-buck-plugin-*.jar $ZIP_STAGE/plugins/yang.jar |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 36 | |
| 37 | BUCK_VERSION=$(buck/buck-out/gen/programs/buck.pex -V) |
| 38 | echo $BUCK_VERSION > $ZIP_STAGE/.buck_version |
| 39 | |
| 40 | chmod 555 $ZIP_STAGE/buck |
| 41 | chmod 444 $ZIP_STAGE/.buck_version |
| 42 | |
| 43 | pushd $ZIP_STAGE |
| 44 | zip -r ../$BUCK_ZIP buck .buck_version plugins |
| 45 | popd #$ZIP_STAGE |
| 46 | |
Ray Milkey | 09e8b8d | 2017-07-28 12:52:09 -0700 | [diff] [blame] | 47 | if [ "$1" != "--dry-run" ]; then |
Ray Milkey | 4825623 | 2017-07-19 15:09:10 -0700 | [diff] [blame] | 48 | # publish zip |
| 49 | #FIXME check for s3 credentials |
| 50 | uploadToS3.py --dest third-party/ $BUCK_ZIP |
| 51 | fi |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 52 | |
| 53 | # update version in onos-buck |
| 54 | URL="$DOWNLOAD_BASE/$BUCK_ZIP" |
| 55 | SHA=$(shasum $BUCK_ZIP | cut -d' ' -f1) |
| 56 | |
| 57 | sed -i "" -E "s#BUCK_URL=.*#BUCK_URL=\"$URL\"#" onos/tools/build/onos-buck |
| 58 | sed -i "" -E "s#BUCK_SHA=.*#BUCK_SHA=\"$SHA\"#" onos/tools/build/onos-buck |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 59 | |
| 60 | set +x |
| 61 | echo |
Brian O'Connor | 1b42eea | 2016-10-20 14:21:00 -0700 | [diff] [blame] | 62 | echo "Commit and push change to onos-buck on the onos directory." |