Skip to content

Instantly share code, notes, and snippets.

@fobo66
Last active October 21, 2017 15:35
Show Gist options
  • Save fobo66/17d5116b5c7bccf5f28036f401f3c09d to your computer and use it in GitHub Desktop.
Save fobo66/17d5116b5c7bccf5f28036f401f3c09d to your computer and use it in GitHub Desktop.
Useful gist for loading Gradle properties from files
// 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