Skip to content

Instantly share code, notes, and snippets.

@danybony
Created November 29, 2014 18:25
Show Gist options
  • Save danybony/b7390d55bf58507a9314 to your computer and use it in GitHub Desktop.
Save danybony/b7390d55bf58507a9314 to your computer and use it in GitHub Desktop.
Setup and start AOSP build with ccache and build target passed as parameter
#!/bin/bash
function show_help {
echo "Usage:"
echo "./startbuild.sh -t <build_target> [-c -h]"
echo
echo "Parameters:"
echo "-t: specify the build target as per lunch (required)"
echo "-c: perform a clean build, calling make clean"
echo "-h: show this"
}
CLEAN=false
THREADS=16
while getopts "cjh?t:" opt; do
case "$opt" in
h|\?)
show_help
exit 0
;;
c) CLEAN=true
;;
t) TARGET=$OPTARG
;;
esac
done
if [ -z "$TARGET" ]; then
echo "Error: Target required"
show_help
exit 0
fi
export USE_CCACHE=1
. build/envsetup.sh
lunch $TARGET
if $CLEAN; then
echo "Cleaning..."
make clean
fi
echo "Starting build in backgroud"
nohup make -j$THREADS &
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment