[Android] [PATCH 5/5] compile.sh: earlier abort in case of invalid option

Filip Roséen filip at atch.se
Tue Aug 9 04:01:51 CEST 2016


If an invalid option is passed to "-a" it make sense for us to abort
as early as possible. These changes can be summerized with;

  - do not rely on compile-libvlc.sh to diagnose invalid usage, and;
  - abort before any work is done if an invalid option is present.
---
 compile.sh | 45 ++++++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 21 deletions(-)

diff --git a/compile.sh b/compile.sh
index 5217983..560c46c 100755
--- a/compile.sh
+++ b/compile.sh
@@ -80,6 +80,30 @@ if [ -z "$ANDROID_ABI" ]; then
    ANDROID_ABI="armeabi-v7a"
 fi
 
+if [ "$ANDROID_ABI" = "armeabi-v7a" ]; then
+    GRADLE_ABI="ARMv7"
+elif [ "$ANDROID_ABI" = "armeabi-v5" ]; then
+    GRADLE_ABI="ARMv5"
+elif [ "$ANDROID_ABI" = "armeabi" ]; then
+    GRADLE_ABI="ARMv6fpu"
+elif [ "$ANDROID_ABI" = "armeabi-nofpu" ]; then
+    GRADLE_ABI="ARMv6nofpu"
+elif [ "$ANDROID_ABI" = "arm64-v8a" ]; then
+    GRADLE_ABI="ARMv8"
+elif [ "$ANDROID_ABI" = "x86" ]; then
+    GRADLE_ABI="x86"
+elif [ "$ANDROID_ABI" = "x86_64" ]; then
+    GRADLE_ABI="x86_64"
+elif [ "$ANDROID_ABI" = "mips" ]; then
+    GRADLE_ABI="MIPS"
+elif [ "$ANDROID_ABI" = "mips64" ]; then
+    GRADLE_ABI="MIPS64"
+else
+    diagnostic "Invalid arch specified: '$ANDROID_ABI'."
+    diagnostic "Try --help for more information"
+    exit 1
+fi
+
 ##########
 # GRADLE #
 ##########
@@ -208,27 +232,6 @@ fi
 if [ "$CHROME_OS" = 1 ]; then
     PLATFORM="Chrome"
 fi
-
-if [ "$ANDROID_ABI" = "armeabi-v5" ]; then
-    GRADLE_ABI="ARMv5"
-elif [ "$ANDROID_ABI" = "armeabi" ]; then
-    GRADLE_ABI="ARMv6fpu"
-elif [ "$ANDROID_ABI" = "armeabi-nofpu" ]; then
-    GRADLE_ABI="ARMv6nofpu"
-elif [ "$ANDROID_ABI" = "arm64-v8a" ]; then
-    GRADLE_ABI="ARMv8"
-elif [ "$ANDROID_ABI" = "x86" ]; then
-    GRADLE_ABI="x86"
-elif [ "$ANDROID_ABI" = "x86_64" ]; then
-    GRADLE_ABI="x86_64"
-elif [ "$ANDROID_ABI" = "mips" ]; then
-    GRADLE_ABI="MIPS"
-elif [ "$ANDROID_ABI" = "mips64" ]; then
-    GRADLE_ABI="MIPS64"
-else
-    GRADLE_ABI="ARMv7"
-fi
-
 if [ "$BUILD_LIBVLC" = 1 ];then
     ./gradlew -p libvlc assemble${BUILDTYPE}
     RUN=0
-- 
2.9.2



More information about the Android mailing list