[Android] Add signed release build type

Geoffrey Métais git at videolan.org
Mon Jul 31 17:33:19 CEST 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Jul 31 17:32:56 2017 +0200| [e1844daa226eb72c288df9d20a2fe88931f05d7a] | committer: Geoffrey Métais

Add signed release build type

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

 compile.sh               |  9 ++++++++-
 vlc-android/build.gradle | 25 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/compile.sh b/compile.sh
index 13b982156..e0bc0d733 100755
--- a/compile.sh
+++ b/compile.sh
@@ -31,6 +31,7 @@ while [ $# -gt 0 ]; do
             echo "  X86:     x86, x86_64"
             echo "  MIPS:    mips, mips64."
             echo "Use --release to build in release mode"
+            echo "Use --signrelease to build in release mode and sign apk, see vlc-android/build.gradle"
             echo "Use -s to set your keystore file and -p for the password"
             echo "Use -c to get a ChromeOS build"
             echo "Use -l to build only LibVLC"
@@ -46,6 +47,10 @@ while [ $# -gt 0 ]; do
         -r|release|--release)
             RELEASE=1
             ;;
+        signrelease|--signrelease)
+            SIGNED_RELEASE=1
+            RELEASE=1
+            ;;
         -s|--signature)
             KEYSTORE_FILE=$2
             shift
@@ -262,7 +267,9 @@ fi
 ##################
 PLATFORM="Vanilla"
 BUILDTYPE="Debug"
-if [ "$RELEASE" = 1 ]; then
+if [ "$SIGNED_RELEASE" = 1 ]; then
+    BUILDTYPE="signedRelease"
+elif [ "$RELEASE" = 1 ]; then
     BUILDTYPE="Release"
 fi
 if [ "$CHROME_OS" = 1 ]; then
diff --git a/vlc-android/build.gradle b/vlc-android/build.gradle
index da7d6950d..4473fd293 100644
--- a/vlc-android/build.gradle
+++ b/vlc-android/build.gradle
@@ -83,6 +83,27 @@ android {
             }
     }
 
+    signingConfigs {
+        release {
+            /*
+            To set this properties, create file gradle.properties with these 3 props.
+            e.g.
+            keyStoreFile=/home/<username>/.android/debug.keystore
+            storealias=androiddebugkey
+            storepwd=android
+             */
+            storeFile file(keyStoreFile)
+            keyAlias storealias
+            if (System.getenv('PASSWORD_KEYSTORE') != null && !System.getenv('PASSWORD_KEYSTORE').isEmpty()){
+                storePassword = System.getenv('PASSWORD_KEYSTORE')
+                keyPassword = System.getenv('PASSWORD_KEYSTORE')
+            } else {
+                storePassword storepwd
+                keyPassword storepwd
+            }
+        }
+    }
+
     buildTypes {
         release {
             signingConfig null
@@ -90,6 +111,10 @@ android {
             shrinkResources false
             proguardFile 'proguard.cfg'
         }
+        signedRelease {
+            initWith release
+            signingConfig = signingConfigs.release
+        }
         debug {
             applicationIdSuffix ".debug"
             jniDebuggable true



More information about the Android mailing list