Permalink
Browse files

tools: Add script for auto-building

  • Loading branch information...
paulscode committed Jan 2, 2015
1 parent da90f00 commit d02e8472fdc73fc9b65606de429c0df1d8ab0020
Showing with 43 additions and 0 deletions.
  1. +43 −0 tools/auto-build.sh
View
@@ -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

This comment has been minimized.

Show comment
Hide comment
@paulscode

paulscode Jan 2, 2015

Member

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

Member

paulscode replied Jan 2, 2015

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

This comment has been minimized.

Show comment
Hide comment
@littleguy77

littleguy77 Jan 2, 2015

Member

Cool!

Member

littleguy77 replied Jan 2, 2015

Cool!

Please sign in to comment.