Skip to content

Instantly share code, notes, and snippets.

@talenguyen
Last active August 6, 2019 04:06
Show Gist options
  • Save talenguyen/8e965fd0d29fe59dcf1595d1c876e158 to your computer and use it in GitHub Desktop.
Save talenguyen/8e965fd0d29fe59dcf1595d1c876e158 to your computer and use it in GitHub Desktop.
Script to read local properties
def propertiesFile = new File(rootDir, "local.properties")
if (propertiesFile.exists()) {
def properties = new Properties()
properties.load(propertiesFile.newDataInputStream())
if (properties.containsKey("gradleScripts.dir")) {
ext.gradleScriptsDir = properties.getProperty("gradleScripts.dir")
} else {
throw new IllegalArgumentException("ERROR: Gradle Scripts location not found. " +
"Define location with gradleScripts.dir in the local.properties file")
}
} else {
throw new IllegalArgumentException("ERROR: Gradle Scripts location not found. " +
"Define location with gradleScripts.dir in the local.properties file")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment