Skip to content

Commit

Permalink
Add sample release config.
Browse files Browse the repository at this point in the history
  • Loading branch information
rkistner committed Jun 5, 2016
1 parent cac37cb commit 3e12faa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ maven-repository
*.iml
local.properties
mvn-clone

*.keystore
30 changes: 28 additions & 2 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Expand Down

0 comments on commit 3e12faa

Please sign in to comment.