Functions - pford68/gradle-examples GitHub Wiki
def <function name>(<params...>) {
// body
}ext.<method name> = {param1, param2, etc. ->
// body
}Examples
// In one gradle file
ext.includeAnotherBuild = {
...
}
// In another gradle file, simply invoke the method.
includeAnotherBuild()task myTask {
ext.myMethod = { param1, param2 ->
// Method body here
}
doLast {
myMethod(p1, p2) // This will resolve 'myMethod' defined in task
}
}