From 5550f56115e785b34dadfdf05f8f2e90ffcf9713 Mon Sep 17 00:00:00 2001 From: jrizzoli Date: Fri, 15 Jan 2016 16:08:35 +0100 Subject: gello-build: add clean build Change-Id: I2adf7a5408dd142423e814b6698380c4ae8a1bc5 Signed-off-by: jrizzoli --- README.md | 3 ++- gello_build.sh | 45 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e4a8e8e..eaafbb8 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,10 @@ Documentation Features ---------- +- *--clean* = Make a clean build - *--depot* = Install Depot Tool - *--fast* = Skip sync and runhooks, useful for testing changes -- *--push* = Once everything else is done, install the given apk on a connected device +- *--push* = Once everything else is done, install the given apk on a connected device - *--no-sync* = Skip sync Setup diff --git a/gello_build.sh b/gello_build.sh index caa40f4..ebe13fd 100755 --- a/gello_build.sh +++ b/gello_build.sh @@ -33,12 +33,24 @@ FAST=false PUSH=false NOSYNC=false VERBOSE=false - +CLEAN=false ## # Sync # function sync() { + if [ "$CLEAN" == true ]; then + cd $TOP_GELLO/env + + echo "Cleaning..." + + # Clean out stuffs + rm -rf $SRC_GELLO/out + find $TOP_GELLO -name index.lock -exec rm {} \; + gclient recurse git clean -fdx . + + fi + if [ "$NOSYNC" != true ]; then cd $TOP_GELLO/env @@ -50,7 +62,14 @@ function sync() { echo "Syncing now!" gclient sync -n --no-nag-max - return $? + local SYNCRET=$? + + if [ "$CLEAN" == true ] && [ "$SYNCRET" == 0 ]; then + gclient recurse git clean -fdx . + return $? + else + return $SYNCRET + fi else return 0 fi @@ -128,25 +147,36 @@ function compile() { # function checkflags() { if [ "$1" == "--verbose" ] || [ "$2" == "--verbose" ] || - [ "$3" == "--verbose" ] || [ "$4" == "--verbose" ]; then + [ "$3" == "--verbose" ] || [ "$4" == "--verbose" ] || + [ "$5" == "--verbose" ]; then VERBOSE=true fi if [ "$1" == "--fast" ] || [ "$2" == "--fast" ] || - [ "$3" == "--fast" ] || [ "$4" == "--fast" ]; then + [ "$3" == "--fast" ] || [ "$4" == "--fast" ] || + [ "$5" == "--fast" ]; then NOSYNC=true FAST=true fi if [ "$1" == "--no-sync" ] || [ "$2" == "--no-sync" ] || - [ "$3" == "--no-sync" ] || [ "$4" == "--no-sync" ]; then + [ "$3" == "--no-sync" ] || [ "$4" == "--no-sync" ] || + [ "$5" == "--no-sync" ]; then NOSYNC=true fi if [ "$1" == "--push" ] || [ "$2" == "--push" ] || - [ "$3" == "--push" ] || [ "$4" == "--push" ]; then + [ "$3" == "--push" ] || [ "$4" == "--push" ] || + [ "$5" == "--push" ]; then PUSH=true fi + + if [ "$1" == "--clean" ] || [ "$2" == "--clean" ] || + [ "$3" == "--clean" ] || [ "$4" == "--clean" ] || + [ "$5" == "--clean" ]; then + CLEAN=true + fi + } @@ -158,6 +188,7 @@ function helpgello() { Gello inline build system (c) CyanogenMod 2016 Usage: ./gello_build.sh flags: + --clean = Make a clean build --depot = Install Depot Tool --fast = Skip sync and runhooks, useful for testing local changes --push = Once everything else is done, install the given apk on a connected device @@ -188,7 +219,7 @@ elif [ "$1" == "--help" ]; then helpgello && exit 0 fi -checkflags $1 $2 $3 $4 +checkflags $1 $2 $3 $4 $5 sync && setup && compile -- cgit v1.2.3