Updated build script to make patch releases.

This commit is contained in:
richard 2009-11-18 19:22:17 +01:00
parent f784b10c87
commit 59f3a3e84c

View File

@ -2,7 +2,8 @@
RELEASEDIR=release RELEASEDIR=release
BUILDDIR=build BUILDDIR=build
ZIPFILE=$(hg id -b)-$(hg id -n).zip VERSION=$(hg id -b)-$(hg id -n)
ZIPFILE=$VERSION.zip
PLUGINFILES="cstrike/*" PLUGINFILES="cstrike/*"
DOCS="docs/*" DOCS="docs/*"
@ -12,17 +13,40 @@ PLUGINDIR=$RELEASEDIR/addons/sourcemod/plugins
ZRTOOLS_SOURCE=/home/zrdev/archive/zrtools ZRTOOLS_SOURCE=/home/zrdev/archive/zrtools
EXTENSIONDIR=$RELEASEDIR/addons/sourcemod/extensions EXTENSIONDIR=$RELEASEDIR/addons/sourcemod/extensions
# Clean release directory if specified and exit. MAKEPATCH=false
if [ "$1" = "clean" ]
then
# Clean release directory.
rm -rf $RELEASEDIR rm -rf $RELEASEDIR
echo "Cleaned release directory." echo "Cleaned release directory."
# Exit if cleaning only.
if [ "$1" = "clean" ]
then
exit 0 exit 0
fi 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 <base rev>"
exit 1
fi
fi
# Make release directory. # Make release directory.
mkdir -p $RELEASEDIR mkdir -p $RELEASEDIR
# Check if the plugin is built. # Check if the plugin is built.
if [ ! -e $BUILDDIR/$PLUGINFILE ] if [ ! -e $BUILDDIR/$PLUGINFILE ]
then then
@ -30,22 +54,35 @@ then
exit 1 exit 1
fi fi
# Copy files.
echo "Copying plugin files..."
cp -r $PLUGINFILES $RELEASEDIR
# Copy files.
echo "Copying documentation..." echo "Copying documentation..."
mkdir -p $DOCS_DEST mkdir -p $DOCS_DEST
cp -r $DOCS $DOCS_DEST cp -r $DOCS $DOCS_DEST
echo "Copying plugin binaries..." echo "Copying plugin binary..."
mkdir -p $PLUGINDIR mkdir -p $PLUGINDIR
cp -r $BUILDDIR/$PLUGINFILE $PLUGINDIR/$PLUGINFILE cp -r $BUILDDIR/$PLUGINFILE $PLUGINDIR/$PLUGINFILE
if [ $MAKEPATCH = "false" ]
then
echo "Copying plugin files..."
cp -r $PLUGINFILES $RELEASEDIR
echo "Copying extension binaries..." echo "Copying extension binaries..."
mkdir -p $EXTENSIONDIR mkdir -p $EXTENSIONDIR
cp $ZRTOOLS_SOURCE/zrtools.ext.so $EXTENSIONDIR cp $ZRTOOLS_SOURCE/zrtools.ext.so $EXTENSIONDIR
cp $ZRTOOLS_SOURCE/zrtools.ext.dll $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. # Make release package.
echo "Compressing files..." echo "Compressing files..."