Skip to content
This repository has been archived by the owner on Sep 28, 2020. It is now read-only.

Commit

Permalink
library: Implement properties based signing config
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
  • Loading branch information
Harsh Shandilya committed May 27, 2018
1 parent 0f89e4f commit b45d7ac
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -8,4 +8,7 @@
gen

.idea
*.iml
*.iml

keystore.properties
*.jks
25 changes: 25 additions & 0 deletions library/build.gradle
@@ -1,5 +1,9 @@
apply plugin: 'com.android.library'

// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
final def keystorePropertiesFile = rootProject.file("keystore.properties")

android {
compileSdkVersion 27

Expand All @@ -11,10 +15,31 @@ android {
consumerProguardFiles 'consumer-proguard-rules.pro'
}

// If the keystore file exists
if (keystorePropertiesFile.exists()) {
// Initialize a new Properties() object called keystoreProperties.
final def keystoreProperties = new Properties()

// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (keystorePropertiesFile.exists()) {
signingConfig signingConfigs.release
}
}
}
}
Expand Down

0 comments on commit b45d7ac

Please sign in to comment.