expand

abstract fun expand(properties: Map<String, out Any>): CopySpec(source)

Expands property references in each file as it is copied. More specifically, each file is transformed using Groovy's . This means you can use simple property references, such as $property or ${property} in the file. You can also include arbitrary Groovy code in the file, such as ${version ?: 'unknown'} or ${classpath*.name.join(' ')}

Note that all escape sequences ( \n}, \t}, \\}, etc) are converted to the symbols they represent, so, for example, \n} becomes newline. If this is undesirable then #expand(Map, Action) should be used to disable this behavior.


abstract fun expand(properties: Map<String, out Any>, action: Action<in ExpandDetails>): CopySpec(source)

Expands property references in each file as it is copied. More specifically, each file is transformed using Groovy's . This means you can use simple property references, such as $property or ${property} in the file. You can also include arbitrary Groovy code in the file, such as ${version ?: 'unknown'} or ${classpath*.name.join(' ')}. The template engine can be configured with the provided action.

Note that by default all escape sequences ( \n}, \t}, \\}, etc) are converted to the symbols they represent, so, for example, \n} becomes newline. This behavior is controlled by ExpandDetails#getEscapeBackslash() property. It should be set to true} to disable escape sequences conversion:

 expand(one: '1', two: 2) {
     escapeBackslash = true
 }