Skip to content

Commit

Permalink
tools: Add script for auto-building
Browse files Browse the repository at this point in the history
  • Loading branch information
paulscode committed Jan 2, 2015
1 parent da90f00 commit d02e847
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tools/auto-build.sh
@@ -0,0 +1,43 @@
#!/bin/bash

if [ "$#" -ne 2 ]; then
echo "Usage:"
echo "tools/auto-build.sh username@hostname.ext path/to/destination/folder"
exit 1
fi

#TODO: Loop through all branches
currentBranch="master"

echo "Checking out branch '""$currentBranch""'"
cmd="git checkout ""$currentBranch"; $cmd
oldRevision=`git rev-parse --short HEAD`

echo "Executing git pull"
git pull
newRevision=`git rev-parse --short HEAD`

if [ "$oldRevision" == "$newRevision" ]; then
echo "Nothing new to build"
exit 0
else
echo "Cleaning previous build"
ant clean
ndk-build clean
echo "Building APK"
ndk-build -j4
ant debug
if [ ! -f "bin/Mupen64Plus-debug.apk" ]; then
echo "Error: Build failed"
exit 1
else
#TODO: Sanitize branch name for use in filename
sanitizedBranchName="$currentBranch"

echo "Uploading APK to host"
cmd="scp bin/Mupen64Plus-debug.apk ""$1"":""$2""/Mupen64PlusAE_""$sanitizedBranchName""_""$(date +'%Y%m%d%H%M')""_""$newRevision"".apk"; $cmd
echo "Done"
exit 0
fi
fi

2 comments on commit d02e847

@paulscode
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To auto-build hourly, use a crontab entry like this:

0 * * * * user cd /path/to/mupen64plus-ae; tools/auto-build.sh user@host.ext path/to/destination

@littleguy77
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool!

Please sign in to comment.