From 3e12faa37902aa207371cd16e5033d5cbfe359cc Mon Sep 17 00:00:00 2001 From: Ralf Kistner Date: Sun, 5 Jun 2016 19:08:59 +0200 Subject: [PATCH] Add sample release config. --- .gitignore | 2 +- sample/build.gradle | 30 ++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 615d1e6df..6253c8600 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ maven-repository *.iml local.properties mvn-clone - +*.keystore diff --git a/sample/build.gradle b/sample/build.gradle index 87a347716..f439c1838 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -7,11 +7,37 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion project.androidTargetSdk - versionCode 1 - versionName "1.0" + versionCode 330 + versionName "3.3.0" } + + Properties properties = new Properties() + properties.load(project.rootProject.file('local.properties').newDataInputStream()) + def keystoreFile = properties.getProperty('keystore.file') + def keystorePassword = properties.getProperty('keystore.password') + def keystoreAlias = properties.getProperty('keystore.alias') + def validConfig = keystoreFile != null && keystorePassword != null && keystoreAlias != null; + + if(validConfig) { + System.out.println("Release signing configured with " + keystoreFile) + signingConfigs { + release { + storeFile project.rootProject.file(keystoreFile) + storePassword keystorePassword + keyAlias keystoreAlias + keyPassword keystorePassword + } + } + } else { + System.out.println("Specify keystore.file, keystore.alias and keystore.password in local.properties to enable release signing.") + } + buildTypes { release { + if(validConfig) { + signingConfig signingConfigs.release + } + minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' }