CopyProcessingSpec
, CopySpec
, FileCopyDetails
, SyncSpec
AbstractArchiveTask
, AbstractCopyTask
, Copy
, Ear
, Jar
, Jar
, ProcessResources
, Sync
, Tar
, War
, Zip
public interface ContentFilterable
Modifier and Type | Method | Description |
---|---|---|
ContentFilterable |
expand(java.util.Map<java.lang.String,?> properties) |
Expands property references in each file as it is copied.
|
ContentFilterable |
expand(java.util.Map<java.lang.String,?> properties,
Action<? super ExpandDetails> action) |
Expands property references in each file as it is copied.
|
ContentFilterable |
filter(Closure closure) |
Adds a content filter based on the provided closure.
|
ContentFilterable |
filter(java.lang.Class<? extends java.io.FilterReader> filterType) |
Adds a content filter to be used during the copy.
|
ContentFilterable |
filter(java.util.Map<java.lang.String,?> properties,
java.lang.Class<? extends java.io.FilterReader> filterType) |
Adds a content filter to be used during the copy.
|
ContentFilterable |
filter(Transformer<java.lang.String,java.lang.String> transformer) |
Adds a content filter based on the provided transformer.
|
ContentFilterable filter(java.util.Map<java.lang.String,?> properties, java.lang.Class<? extends java.io.FilterReader> filterType)
Adds a content filter to be used during the copy. Multiple calls to filter, add additional filters to the
filter chain. Each filter should implement java.io.FilterReader
. Include
org.apache.tools.ant.filters.*
for access to all the standard Ant filters.
Filter properties may be specified using groovy map syntax.
Examples:
filter(HeadFilter, lines:25, skip:2) filter(ReplaceTokens, tokens:[copyright:'2009', version:'2.3.1'])
properties
- map of filter propertiesfilterType
- Class of filter to addContentFilterable filter(java.lang.Class<? extends java.io.FilterReader> filterType)
Adds a content filter to be used during the copy. Multiple calls to filter, add additional filters to the
filter chain. Each filter should implement java.io.FilterReader
. Include
org.apache.tools.ant.filters.*
for access to all the standard Ant filters.
Examples:
filter(StripJavaComments) filter(com.mycompany.project.CustomFilter)
filterType
- Class of filter to addContentFilterable filter(Closure closure)
null
to remove the line. If every line is
removed, the result will be an empty file, not an absent one.closure
- to implement line based filteringContentFilterable filter(Transformer<java.lang.String,java.lang.String> transformer)
null
to remove the line. If every line is
removed, the result will be an empty file, not an absent one.transformer
- to implement line based filteringContentFilterable expand(java.util.Map<java.lang.String,?> properties)
Expands property references in each file as it is copied. More specifically, each file is transformed using
Groovy's SimpleTemplateEngine
. 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.
properties
- reference-to-value map for substitution@Incubating ContentFilterable expand(java.util.Map<java.lang.String,?> properties, Action<? super ExpandDetails> action)
Expands property references in each file as it is copied. More specifically, each file is transformed using
Groovy's SimpleTemplateEngine
. 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 }
properties
- reference-to-value map for substitutionaction
- action to perform additional configuration of the underlying template engine