[Android] compile.sh: introduce diagnostic helper

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


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

compile.sh: introduce diagnostic helper

Given that diagnostic output should be written to stderr and not
stdout, a function named "diagnostic" is introduced that echo's
whatever is passed to stderr.

Usage of "echo" in terms of diagnostics has been replaced by usage of
this newly added function.

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

> https://code.videolan.org/videolan/vlc-android/commit/9133085dcbb865a681fdd09420c909cfab7756fb
---

 compile.sh | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/compile.sh b/compile.sh
index 3e92ae3..029464f 100755
--- a/compile.sh
+++ b/compile.sh
@@ -1,6 +1,11 @@
 #! /bin/sh
 set -e
 
+diagnostic()
+{
+    echo "$@" 1>&2;
+}
+
 # Read the Android Wiki http://wiki.videolan.org/AndroidCompile
 # Setup all that stuff correctly.
 # Get the latest Android SDK Platform or modify numbers in configure.sh and libvlc/default.properties.
@@ -44,8 +49,8 @@ while [ $# -gt 0 ]; do
             RUN=1
             ;;
         *)
-            echo "$0: Invalid option '$1'." 1>&2
-            echo "$0: Try --help for more information." 1>&2
+            diagnostic "$0: Invalid option '$1'."
+            diagnostic "$0: Try --help for more information."
             exit 1
             ;;
     esac
@@ -53,13 +58,13 @@ while [ $# -gt 0 ]; do
 done
 
 if [ -z "$ANDROID_NDK" -o -z "$ANDROID_SDK" ]; then
-   echo "You must define ANDROID_NDK, ANDROID_SDK before starting."
-   echo "They must point to your NDK and SDK directories.\n"
+   diagnostic "You must define ANDROID_NDK, ANDROID_SDK before starting."
+   diagnostic "They must point to your NDK and SDK directories."
    exit 1
 fi
 
 if [ -z "$ANDROID_ABI" ]; then
-   echo "*** No ANDROID_ABI defined architecture: using ARMv7"
+   diagnostic "*** No ANDROID_ABI defined architecture: using ARMv7"
    ANDROID_ABI="armeabi-v7a"
 fi
 
@@ -80,7 +85,7 @@ checkfail()
 ##########
 
 if [ ! -d "gradle/wrapper" ]; then
-    echo "Downloading gradle"
+    diagnostic "Downloading gradle"
     GRADLE_VERSION=2.10
     GRADLE_URL=https://download.videolan.org/pub/contrib/gradle-${GRADLE_VERSION}-all.zip
     wget ${GRADLE_URL} 2>/dev/null || curl -O ${GRADLE_URL}
@@ -135,7 +140,7 @@ if [ -z "$KEYSTORE_FILE" ]; then
     STOREALIAS="androiddebugkey"
 else
     if [ -z "$PASSWORD_KEYSTORE" ]; then
-        echo "No password"
+        diagnostic "No password"
         exit 1
     fi
     rm -f gradle.properties
@@ -160,11 +165,11 @@ fi
 
 TESTED_HASH=4e213ff
 if [ ! -d "vlc" ]; then
-    echo "VLC source not found, cloning"
+    diagnostic "VLC source not found, cloning"
     git clone git://git.videolan.org/vlc.git vlc
     checkfail "vlc source: git clone failed"
 else
-    echo "VLC source found"
+    diagnostic "VLC source found"
     cd vlc
     if ! git cat-file -e ${TESTED_HASH}; then
         cat << EOF
@@ -181,7 +186,7 @@ fi
 # Make VLC #
 ############
 
-echo "Configuring"
+diagnostic "Configuring"
 OPTS="-a ${ANDROID_ABI}"
 if [ "$RELEASE" = 1 ]; then
     OPTS="$OPTS release"



More information about the Android mailing list