Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
d02e847
There was a problem hiding this comment.
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
d02e847
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool!