Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

Commit

Permalink
change grade build to sign application from external properties file
Browse files Browse the repository at this point in the history
  • Loading branch information
fgei committed Sep 11, 2015
1 parent 4054e69 commit 0a1e669
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ buildscript {
apply plugin: 'com.android.application'
apply plugin: 'witness'

if(project.hasProperty("duckduckgo.signing") && new File(project.property("duckduckgo.signing")).exists()) {
apply from: project.property("duckduckgo.signing");
}

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
Expand Down Expand Up @@ -60,13 +56,24 @@ android {
}
}

signingConfigs {
release
}

buildTypes {
debug {
debuggable true
jniDebuggable true
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
signingConfig signingConfigs.release
}
}

lintOptions {
abortOnError false
}

applicationVariants.all { variant ->
Expand All @@ -82,4 +89,24 @@ android {
}
}
}

def Properties props = new Properties()
def propFile = new File('/Users/jenkins/jenkins_static/duckduckgo_android/ddg_android_build.properties')
if (propFile.exists()){
props.load(new FileInputStream(propFile))

if (props!=null && props.containsKey('key.store') && props.containsKey('key.store.password') &&
props.containsKey('key.alias') && props.containsKey('key.alias.password')) {
android.signingConfigs.release.storeFile = file(props['key.store'])
android.signingConfigs.release.storePassword = props['key.store.password']
android.signingConfigs.release.keyAlias = props['key.alias']
android.signingConfigs.release.keyPassword = props['key.alias.password']
} else {
println 'signing.properties found but some entries are missing'
android.buildTypes.release.signingConfig = null
}
} else {
println 'signing.properties not found'
android.buildTypes.release.signingConfig = null
}
}

0 comments on commit 0a1e669

Please sign in to comment.