Skip to content

Instantly share code, notes, and snippets.

@Jthomas54
Last active January 9, 2018 18:40
Show Gist options
  • Save Jthomas54/f8d73733b87afd278f2a3ae4c68b8548 to your computer and use it in GitHub Desktop.
Save Jthomas54/f8d73733b87afd278f2a3ae4c68b8548 to your computer and use it in GitHub Desktop.
Gradle helper functions for loading properties file and merging into project properties
loadExternalProperties('version.properties')
def loadExternalProperties(fileName) {
def Properties props = new Properties()
file(fileName).withInputStream { stream ->
props.load stream
props.each { prop ->
project.ext[prop.key] = prop.value
}
stream.close()
}
}
buildVersion=1
versionString=1.0.0
@Jthomas54
Copy link
Author

This would allow you to use project.buildVersion to access the values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment