blob: 09d161208ae2b586d714d2da316dbc6c71ea4400 [file] [log] [blame]
#!/bin/bash
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
DEFAULT_TAG=${TAG:-$(date +v%Y.%m.%d.$NEXT_VERSION)}
BUCK_ZIP="buck-$DEFAULT_TAG.zip"
DOWNLOAD_BASE="http://repo1.maven.org/maven2/org/onosproject/onos-buck/$DEFAULT_TAG"
if ! curl --output /dev/null --silent --head --fail "$DOWNLOAD_BASE/$BUCK_ZIP"; then
break;
fi
done
NO_BUCKD=1
UPLOAD_BASE="https://oss.sonatype.org/service/local/staging/deploy/maven2/org/onosproject/onos-buck/$DEFAULT_TAG"
BUCK_ZIP="buck-$DEFAULT_TAG.zip"
ZIP_STAGE="buck-bin"
rm -rf $ZIP_STAGE
set -e
set -x
# build plugins
pushd buck
onos-buck build buck
popd #buck
pushd onos
onos-buck build //tools/build/buck-plugin:onos
popd #onos
pushd onos-yang-tools
mvn clean package
popd #onos-yang-tools
# assemble zip
mkdir -p buck-bin/plugins
cp buck/buck-out/gen/programs/buck.pex $ZIP_STAGE/buck
cp onos/buck-out/gen/tools/build/buck-plugin/onos.jar $ZIP_STAGE/plugins/onos.jar
cp onos-yang-tools/compiler/plugin/buck/target/onos-yang-compiler-buck-plugin-*.jar $ZIP_STAGE/plugins/yang.jar
BUCK_VERSION=$(buck/buck-out/gen/programs/buck.pex -V)
echo $BUCK_VERSION > $ZIP_STAGE/.buck_version
chmod 555 $ZIP_STAGE/buck
chmod 444 $ZIP_STAGE/.buck_version
pushd $ZIP_STAGE
zip -r ../$BUCK_ZIP buck .buck_version plugins
popd #$ZIP_STAGE
if [ "$1" != "--dry-run" ]; then
# publish zip
curl -v -u "$SONATYPE_USER:$SONATYPE_PASSWORD" --upload-file $BUCK_ZIP $UPLOAD_BASE/$BUCK_ZIP
echo "New buck release is in " $BUCK_ZIP
fi
# update version in onos-buck
URL="$DOWNLOAD_BASE/$BUCK_ZIP"
SHA=$(shasum $BUCK_ZIP | cut -d' ' -f1)
sed -i "" -E "s#BUCK_URL=.*#BUCK_URL=\"$URL\"#" onos/tools/build/onos-buck
sed -i "" -E "s#BUCK_SHA=.*#BUCK_SHA=\"$SHA\"#" onos/tools/build/onos-buck
set +x
echo
echo "Commit and push change to onos-buck on the onos directory."