From 59f3a3e84c95653720b148ba12b41956566cbdd1 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 18 Nov 2009 19:22:17 +0100 Subject: [PATCH] Updated build script to make patch releases. --- build.sh | 61 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/build.sh b/build.sh index 86696de..df0a4d7 100644 --- a/build.sh +++ b/build.sh @@ -2,7 +2,8 @@ RELEASEDIR=release BUILDDIR=build -ZIPFILE=$(hg id -b)-$(hg id -n).zip +VERSION=$(hg id -b)-$(hg id -n) +ZIPFILE=$VERSION.zip PLUGINFILES="cstrike/*" DOCS="docs/*" @@ -12,17 +13,40 @@ PLUGINDIR=$RELEASEDIR/addons/sourcemod/plugins ZRTOOLS_SOURCE=/home/zrdev/archive/zrtools EXTENSIONDIR=$RELEASEDIR/addons/sourcemod/extensions -# Clean release directory if specified and exit. +MAKEPATCH=false + + +# Clean release directory. +rm -rf $RELEASEDIR +echo "Cleaned release directory." + + +# Exit if cleaning only. if [ "$1" = "clean" ] then - rm -rf $RELEASEDIR - echo "Cleaned release directory." exit 0 fi + +# Check if patch mode is enabled. +if [ "$1" = "patch" ] +then + if [ "$2" ] + then + MAKEPATCH=true + PATCHREV="$2" + ZIPFILE=$VERSION-patch.zip + else + echo "Missing base revision number. Usage: build.sh patch " + exit 1 + fi +fi + + # Make release directory. mkdir -p $RELEASEDIR + # Check if the plugin is built. if [ ! -e $BUILDDIR/$PLUGINFILE ] then @@ -30,22 +54,35 @@ then exit 1 fi -# Copy files. -echo "Copying plugin files..." -cp -r $PLUGINFILES $RELEASEDIR +# Copy files. echo "Copying documentation..." mkdir -p $DOCS_DEST cp -r $DOCS $DOCS_DEST -echo "Copying plugin binaries..." +echo "Copying plugin binary..." mkdir -p $PLUGINDIR cp -r $BUILDDIR/$PLUGINFILE $PLUGINDIR/$PLUGINFILE -echo "Copying extension binaries..." -mkdir -p $EXTENSIONDIR -cp $ZRTOOLS_SOURCE/zrtools.ext.so $EXTENSIONDIR -cp $ZRTOOLS_SOURCE/zrtools.ext.dll $EXTENSIONDIR +if [ $MAKEPATCH = "false" ] +then + echo "Copying plugin files..." + cp -r $PLUGINFILES $RELEASEDIR + + echo "Copying extension binaries..." + mkdir -p $EXTENSIONDIR + cp $ZRTOOLS_SOURCE/zrtools.ext.so $EXTENSIONDIR + cp $ZRTOOLS_SOURCE/zrtools.ext.dll $EXTENSIONDIR +else + # Copy only plugin binary and changed files. + CHANGEDFILES=$(hg status --rev $PATCHREV | grep "cstrike/" | cut -d ' ' -f2 | cut -d '/' -f2-) + + echo "Copying plugin files..." + cd cstrike + cp --parents $CHANGEDFILES "../$RELEASEDIR" + cd .. +fi + # Make release package. echo "Compressing files..."