Last active
October 21, 2017 15:35
-
-
Save fobo66/17d5116b5c7bccf5f28036f401f3c09d to your computer and use it in GitHub Desktop.
Useful gist for loading Gradle properties from files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load properties from file in the way recommended by Android docs | |
// | |
// Usage: | |
// def keystoreProperties = loadProperties("keystore.properties") | |
// ... | |
// android { | |
// ... | |
// signingConfigs { | |
// releaseConfig { | |
// keyAlias keystoreProperties['keyAlias'] | |
// keyPassword keystoreProperties['keyPassword'] | |
// storeFile file(keystoreProperties['storeFile']) | |
// storePassword keystoreProperties['storePassword'] | |
// } | |
// ... | |
ext.loadProperties = { propertiesName -> | |
def propertiesFile = rootProject.file(propertiesName) | |
def properties = new Properties() | |
properties.load(new FileInputStream(propertiesFile)) | |
return properties | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment