compile.sh: make running gradlew optional

fdroid build already calls gradle with the correct arguments after all
other build steps completed so having this flag makes the build process
inside fdroid easier.

Change-Id: Ic5381a26f02febf0ec6d7017b22cec580a94df80
diff --git a/compile.sh b/compile.sh
index a4827e4..2d9b670 100755
--- a/compile.sh
+++ b/compile.sh
@@ -15,6 +15,7 @@
 
 RELEASE=0
 DAEMON_ONLY=0
+NO_GRADLE=0
 for i in ${@}; do
     case "$i" in
         release|--release)
@@ -23,6 +24,9 @@
         daemon|--daemon)
         DAEMON_ONLY=1
         ;;
+        no-gradle|--no-gradle)
+        NO_GRADLE=1
+        ;;
         *)
         ;;
     esac
@@ -39,16 +43,20 @@
     echo "$i build OK"
 done
 
-if [ -z "$RING_BUILD_FIREBASE" ]; then
-    echo "Building without Firebase support"
-else
-    GRADLE_PROPERTIES="-PbuildFirebase"
-    echo "Building with Firebase support"
-fi
-if [[ $DAEMON_ONLY -eq 0 ]]; then
-    if [[ $RELEASE -eq 1 ]]; then
-        cd $TOP && ./gradlew $GRADLE_PROPERTIES assembleRelease
+if [[ $NO_GRADLE -eq 0 ]]; then
+    if [ -z "$RING_BUILD_FIREBASE" ]; then
+        echo "Building without Firebase support"
     else
-        cd $TOP && ./gradlew $GRADLE_PROPERTIES assembleDebug
+        GRADLE_PROPERTIES="-PbuildFirebase"
+        echo "Building with Firebase support"
     fi
+    if [[ $DAEMON_ONLY -eq 0 ]]; then
+        if [[ $RELEASE -eq 1 ]]; then
+            cd $TOP && ./gradlew $GRADLE_PROPERTIES assembleRelease
+        else
+            cd $TOP && ./gradlew $GRADLE_PROPERTIES assembleDebug
+        fi
+    fi
+else
+    echo "Stopping before gradle build as requested."
 fi