Last active
February 7, 2021 15:32
-
-
Save hvisser/e9cd3d2855fd603be04476296ed6149f to your computer and use it in GitHub Desktop.
Init script to load additional properties from gradle.local.properties
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
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