Skip to content

Instantly share code, notes, and snippets.

@hvisser
Last active February 7, 2021 15:32
Show Gist options
  • Save hvisser/e9cd3d2855fd603be04476296ed6149f to your computer and use it in GitHub Desktop.
Save hvisser/e9cd3d2855fd603be04476296ed6149f to your computer and use it in GitHub Desktop.
Init script to load additional properties from gradle.local.properties
gradle.projectsLoaded { gradle ->
def file = rootProject.file("gradle.local.properties")
if (file.exists()) {
def properties = new Properties()
file.withInputStream { properties.load(it) }
// set the loaded properties for all projects
gradle.beforeProject { project ->
properties.entrySet().forEach { prop ->
rootProject.logger.debug("Setting ${prop.key} from ${file.name}")
project.ext.set(prop.key, prop.value)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment