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

Filip Roséen git at videolan.org
Tue Aug 9 07:19:09 CEST 2016


vlc-android | branch: master | Filip Roséen <filip at atch.se> | Tue Aug  9 04:01:51 2016 +0200| [9b15d214cdb5f7eb10b8f2cf216b0d7d02980de5] | committer: Jean-Baptiste Kempf

compile.sh: earlier abort in case of invalid option

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.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> https://code.videolan.org/videolan/vlc-android/commit/9b15d214cdb5f7eb10b8f2cf216b0d7d02980de5
---

 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



More information about the Android mailing list