+ return p
+}
+
+def overrideProperties(String propsFileName, boolean output = false) {
+ if (propsFileName == null) {
+ return
+ }
+ def propsFile = file(propsFileName)
+ if (propsFile != null && propsFile.exists()) {
+ println("Using properties from file '${propsFileName}'")
+ def p = readPropertiesFile(propsFileName)
+ p.each { key, val ->
+ def oldval
+ if (project.hasProperty(key)) {
+ oldval = project.findProperty(key)
+ project.setProperty(key, val)
+ if (output) {
+ println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
+ }
+ } else {
+ ext.setProperty(key, val)
+ if (output) {
+ println("Setting ext property '${key}' with ${file(propsFile).getName()}s value '${val}'")
+ }
+ }
+ }
+ }