blob: 09d161208ae2b586d714d2da316dbc6c71ea4400 [file] [log] [blame]
Brian O'Connord27d4372016-10-12 15:06:21 -07001#!/bin/bash
2
Ray Milkey151af4b2018-01-10 14:27:41 -08003for 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
11done
12
Brian O'Connord27d4372016-10-12 15:06:21 -070013NO_BUCKD=1
14
Ray Milkey151af4b2018-01-10 14:27:41 -080015UPLOAD_BASE="https://oss.sonatype.org/service/local/staging/deploy/maven2/org/onosproject/onos-buck/$DEFAULT_TAG"
Brian O'Connord27d4372016-10-12 15:06:21 -070016BUCK_ZIP="buck-$DEFAULT_TAG.zip"
17ZIP_STAGE="buck-bin"
18
19rm -rf $ZIP_STAGE
20
21set -e
22set -x
23
24# build plugins
25
Brian O'Connor1b42eea2016-10-20 14:21:00 -070026pushd buck
Gaurav Agrawalb1d839f2017-03-15 17:18:46 +053027onos-buck build buck
Brian O'Connor1b42eea2016-10-20 14:21:00 -070028popd #buck
29
Brian O'Connord27d4372016-10-12 15:06:21 -070030pushd onos
Gaurav Agrawalb1d839f2017-03-15 17:18:46 +053031onos-buck build //tools/build/buck-plugin:onos
Brian O'Connord27d4372016-10-12 15:06:21 -070032popd #onos
33
Ray Milkeydfc4ca62017-07-28 13:51:09 -070034pushd onos-yang-tools
Brian O'Connord27d4372016-10-12 15:06:21 -070035mvn clean package
36popd #onos-yang-tools
37
38# assemble zip
39
40mkdir -p buck-bin/plugins
41
42cp buck/buck-out/gen/programs/buck.pex $ZIP_STAGE/buck
Brian O'Connor1b42eea2016-10-20 14:21:00 -070043cp onos/buck-out/gen/tools/build/buck-plugin/onos.jar $ZIP_STAGE/plugins/onos.jar
Brian O'Connor5420e8a2017-03-21 15:50:41 -070044cp onos-yang-tools/compiler/plugin/buck/target/onos-yang-compiler-buck-plugin-*.jar $ZIP_STAGE/plugins/yang.jar
Brian O'Connord27d4372016-10-12 15:06:21 -070045
46BUCK_VERSION=$(buck/buck-out/gen/programs/buck.pex -V)
47echo $BUCK_VERSION > $ZIP_STAGE/.buck_version
48
49chmod 555 $ZIP_STAGE/buck
50chmod 444 $ZIP_STAGE/.buck_version
51
52pushd $ZIP_STAGE
53zip -r ../$BUCK_ZIP buck .buck_version plugins
54popd #$ZIP_STAGE
55
Ray Milkey09e8b8d2017-07-28 12:52:09 -070056if [ "$1" != "--dry-run" ]; then
Ray Milkey48256232017-07-19 15:09:10 -070057 # publish zip
Ray Milkey151af4b2018-01-10 14:27:41 -080058 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 Milkey48256232017-07-19 15:09:10 -070060fi
Brian O'Connord27d4372016-10-12 15:06:21 -070061
62# update version in onos-buck
63URL="$DOWNLOAD_BASE/$BUCK_ZIP"
64SHA=$(shasum $BUCK_ZIP | cut -d' ' -f1)
65
66sed -i "" -E "s#BUCK_URL=.*#BUCK_URL=\"$URL\"#" onos/tools/build/onos-buck
67sed -i "" -E "s#BUCK_SHA=.*#BUCK_SHA=\"$SHA\"#" onos/tools/build/onos-buck
Brian O'Connord27d4372016-10-12 15:06:21 -070068
69set +x
70echo
Brian O'Connor1b42eea2016-10-20 14:21:00 -070071echo "Commit and push change to onos-buck on the onos directory."