Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Ray Milkey | 151af4b | 2018-01-10 14:27:41 -0800 | [diff] [blame] | 3 | for NEXT_VERSION in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20; do |
| 4 | DEFAULT_TAG=${TAG:-$(date +v%Y.%m.%d.$NEXT_VERSION)} |
| 5 | BUCK_ZIP="buck-$DEFAULT_TAG.zip" |
| 6 | DOWNLOAD_BASE="http://repo1.maven.org/maven2/org/onosproject/onos-buck/$DEFAULT_TAG" |
| 7 | |
| 8 | if ! curl --output /dev/null --silent --head --fail "$DOWNLOAD_BASE/$BUCK_ZIP"; then |
| 9 | break; |
| 10 | fi |
| 11 | done |
| 12 | |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 13 | NO_BUCKD=1 |
| 14 | |
Ray Milkey | 151af4b | 2018-01-10 14:27:41 -0800 | [diff] [blame] | 15 | UPLOAD_BASE="https://oss.sonatype.org/service/local/staging/deploy/maven2/org/onosproject/onos-buck/$DEFAULT_TAG" |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 16 | BUCK_ZIP="buck-$DEFAULT_TAG.zip" |
| 17 | ZIP_STAGE="buck-bin" |
| 18 | |
| 19 | rm -rf $ZIP_STAGE |
| 20 | |
| 21 | set -e |
| 22 | set -x |
| 23 | |
| 24 | # build plugins |
| 25 | |
Brian O'Connor | 1b42eea | 2016-10-20 14:21:00 -0700 | [diff] [blame] | 26 | pushd buck |
Gaurav Agrawal | b1d839f | 2017-03-15 17:18:46 +0530 | [diff] [blame] | 27 | onos-buck build buck |
Brian O'Connor | 1b42eea | 2016-10-20 14:21:00 -0700 | [diff] [blame] | 28 | popd #buck |
| 29 | |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 30 | pushd onos |
Gaurav Agrawal | b1d839f | 2017-03-15 17:18:46 +0530 | [diff] [blame] | 31 | onos-buck build //tools/build/buck-plugin:onos |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 32 | popd #onos |
| 33 | |
Ray Milkey | dfc4ca6 | 2017-07-28 13:51:09 -0700 | [diff] [blame] | 34 | pushd onos-yang-tools |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 35 | mvn clean package |
| 36 | popd #onos-yang-tools |
| 37 | |
| 38 | # assemble zip |
| 39 | |
| 40 | mkdir -p buck-bin/plugins |
| 41 | |
| 42 | cp buck/buck-out/gen/programs/buck.pex $ZIP_STAGE/buck |
Brian O'Connor | 1b42eea | 2016-10-20 14:21:00 -0700 | [diff] [blame] | 43 | 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] | 44 | 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] | 45 | |
| 46 | BUCK_VERSION=$(buck/buck-out/gen/programs/buck.pex -V) |
| 47 | echo $BUCK_VERSION > $ZIP_STAGE/.buck_version |
| 48 | |
| 49 | chmod 555 $ZIP_STAGE/buck |
| 50 | chmod 444 $ZIP_STAGE/.buck_version |
| 51 | |
| 52 | pushd $ZIP_STAGE |
| 53 | zip -r ../$BUCK_ZIP buck .buck_version plugins |
| 54 | popd #$ZIP_STAGE |
| 55 | |
Ray Milkey | 09e8b8d | 2017-07-28 12:52:09 -0700 | [diff] [blame] | 56 | if [ "$1" != "--dry-run" ]; then |
Ray Milkey | 4825623 | 2017-07-19 15:09:10 -0700 | [diff] [blame] | 57 | # publish zip |
Ray Milkey | 151af4b | 2018-01-10 14:27:41 -0800 | [diff] [blame] | 58 | curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $BUCK_ZIP $UPLOAD_BASE/$BUCK_ZIP |
| 59 | echo "New buck release is in " $BUCK_ZIP |
Ray Milkey | 4825623 | 2017-07-19 15:09:10 -0700 | [diff] [blame] | 60 | fi |
Brian O'Connor | d27d437 | 2016-10-12 15:06:21 -0700 | [diff] [blame] | 61 | |
| 62 | # update version in onos-buck |
| 63 | URL="$DOWNLOAD_BASE/$BUCK_ZIP" |
| 64 | SHA=$(shasum $BUCK_ZIP | cut -d' ' -f1) |
| 65 | |
| 66 | sed -i "" -E "s#BUCK_URL=.*#BUCK_URL=\"$URL\"#" onos/tools/build/onos-buck |
| 67 | 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] | 68 | |
| 69 | set +x |
| 70 | echo |
Brian O'Connor | 1b42eea | 2016-10-20 14:21:00 -0700 | [diff] [blame] | 71 | echo "Commit and push change to onos-buck on the onos directory." |