blob: 61a10fdd08923f29419596f3ba64887c76e8be70 [file] [log] [blame]
Brian O'Connord27d4372016-10-12 15:06:21 -07001#!/bin/bash
2
3DEFAULT_TAG=${TAG:-$(date +v%Y.%m.%d.01)}
4NO_BUCKD=1
5
6DOWNLOAD_BASE="http://onlab.vicci.org/onos/third-party"
7BUCK_ZIP="buck-$DEFAULT_TAG.zip"
8ZIP_STAGE="buck-bin"
9
10rm -rf $ZIP_STAGE
11
12set -e
13set -x
14
15# build plugins
16
Brian O'Connor1b42eea2016-10-20 14:21:00 -070017pushd buck
Gaurav Agrawalb1d839f2017-03-15 17:18:46 +053018onos-buck build buck
Brian O'Connor1b42eea2016-10-20 14:21:00 -070019popd #buck
20
Brian O'Connord27d4372016-10-12 15:06:21 -070021pushd onos
Gaurav Agrawalb1d839f2017-03-15 17:18:46 +053022onos-buck build //tools/build/buck-plugin:onos
Brian O'Connord27d4372016-10-12 15:06:21 -070023popd #onos
24
Gaurav Agrawalb1d839f2017-03-15 17:18:46 +053025pushd onos-yang-tools/compiler
Brian O'Connord27d4372016-10-12 15:06:21 -070026mvn clean package
27popd #onos-yang-tools
28
29# assemble zip
30
31mkdir -p buck-bin/plugins
32
33cp buck/buck-out/gen/programs/buck.pex $ZIP_STAGE/buck
Brian O'Connor1b42eea2016-10-20 14:21:00 -070034cp onos/buck-out/gen/tools/build/buck-plugin/onos.jar $ZIP_STAGE/plugins/onos.jar
Brian O'Connor5420e8a2017-03-21 15:50:41 -070035cp 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 -070036
37BUCK_VERSION=$(buck/buck-out/gen/programs/buck.pex -V)
38echo $BUCK_VERSION > $ZIP_STAGE/.buck_version
39
40chmod 555 $ZIP_STAGE/buck
41chmod 444 $ZIP_STAGE/.buck_version
42
43pushd $ZIP_STAGE
44zip -r ../$BUCK_ZIP buck .buck_version plugins
45popd #$ZIP_STAGE
46
47# publish zip
48#FIXME check for s3 credentials
49uploadToS3.py --dest third-party/ $BUCK_ZIP
50
51# update version in onos-buck
52URL="$DOWNLOAD_BASE/$BUCK_ZIP"
53SHA=$(shasum $BUCK_ZIP | cut -d' ' -f1)
54
55sed -i "" -E "s#BUCK_URL=.*#BUCK_URL=\"$URL\"#" onos/tools/build/onos-buck
56sed -i "" -E "s#BUCK_SHA=.*#BUCK_SHA=\"$SHA\"#" onos/tools/build/onos-buck
Brian O'Connord27d4372016-10-12 15:06:21 -070057
58set +x
59echo
Brian O'Connor1b42eea2016-10-20 14:21:00 -070060echo "Commit and push change to onos-buck on the onos directory."