[Android] Pass keystore password to gradlew env

Geoffrey Métais git at videolan.org
Fri Feb 6 18:05:02 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb  6 18:03:59 2015 +0100| [29db1bb5adbb0901b00015bbf3bd1131b6f7387b] | committer: Geoffrey Métais

Pass keystore password to gradlew env

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=29db1bb5adbb0901b00015bbf3bd1131b6f7387b
---

 compile.sh               |   31 ++++++++++++++++---------------
 vlc-android/build.gradle |    9 +++++++--
 2 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/compile.sh b/compile.sh
index e9b34c8..8c76331 100755
--- a/compile.sh
+++ b/compile.sh
@@ -49,19 +49,6 @@ if [ -z "$ANDROID_ABI" ]; then
    ANDROID_ABI="armeabi-v7a"
 fi
 
-if [ -z "$KEYSTORE_FILE" ]; then
-    KEYSTORE_FILE="$HOME/.android/debug.keystore"
-    PASSWORD_KEYSTORE="android"
-    STOREALIAS="androiddebugkey"
-else
-    if [ -z "$PASSWORD_KEYSTORE" ]; then
-        echo "No password"
-        exit 1
-    fi
-    rm -f gradle.properties
-    STOREALIAS="vlc"
-fi
-
 #############
 # FUNCTIONS #
 #############
@@ -105,10 +92,24 @@ fi
 # Configure gradle #
 ####################
 
+if [ -z "$KEYSTORE_FILE" ]; then
+    KEYSTORE_FILE="$HOME/.android/debug.keystore"
+    STOREALIAS="androiddebugkey"
+else
+    if [ -z "$PASSWORD_KEYSTORE" ]; then
+        echo "No password"
+        exit 1
+    fi
+    rm -f gradle.properties
+    STOREALIAS="vlc"
+fi
+
 if [ ! -f gradle.properties ]; then
     echo keyStoreFile=$KEYSTORE_FILE > gradle.properties
     echo storealias=$STOREALIAS >> gradle.properties
-    echo storepwd=$PASSWORD_KEYSTORE >> gradle.properties
+    if [ -z PASSWORD_KEYSTORE ]; then
+        echo storepwd=android >> gradle.properties
+    fi
 fi
 if [ ! -f local.properties ]; then
     echo sdk.dir=$ANDROID_SDK > local.properties
@@ -168,7 +169,7 @@ else
     fi
 fi
 
-./gradlew $TARGET
+PASSWORD_KEYSTORE="$PASSWORD_KEYSTORE" ./gradlew $TARGET
 
 #######
 # RUN #
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index a8ae8ab..3e9ced4 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -36,9 +36,14 @@ android {
             storepwd=android
              */
             storeFile file(keyStoreFile)
-            storePassword storepwd
             keyAlias storealias
-            keyPassword storepwd
+            if (System.getenv('PASSWORD_KEYSTORE') != null){
+                storePassword = System.getenv('PASSWORD_KEYSTORE')
+                keyPassword = System.getenv('PASSWORD_KEYSTORE')
+            } else {
+                storePassword storepwd
+                keyPassword storepwd
+            }
         }
     }
 



More information about the Android mailing list