AntlrSourceDirectorySet, ConfigurableFileTree, CopySpec, GroovySourceDirectorySet, ScalaSourceDirectorySet, SourceDirectorySet, SyncSpecAbstractArchiveTask, AbstractCompile, AbstractCopyTask, AbstractScalaCompile, AntlrTask, Checkstyle, CodeNarc, Copy, Ear, GroovyCompile, Groovydoc, Jar, Jar, JavaCompile, Javadoc, PatternSet, Pmd, ProcessResources, ScalaCompile, ScalaDoc, SourceTask, Sync, Tar, Test, War, Zippublic interface PatternFilterable
A PatternFilterable represents some file container which Ant-style include and exclude patterns or specs
can be applied to.
Patterns may include:
Either '/' or '\' may be used in a pattern to separate directories. Patterns ending with '/' or '\' will have '**' automatically appended.
Examples:
all files ending with 'jsp' (including subdirectories)
**/*.jsp
all files beginning with 'template_' in the level1/level2 directory
level1/level2/template_*
all files (including subdirectories) beneath src/main/webapp
src/main/webapp/
all files beneath any .svn directory (including subdirectories) under src/main/java
src/main/java/**/.svn/**
You may also use a closure or Spec to specify which files to include or exclude. The closure or Spec
is passed a FileTreeElement, and must return a boolean value.
If no include patterns or specs are specified, then all files in this container will be included. If any include patterns or specs are specified, then a file is included if it matches any of the patterns or specs.
If no exclude patterns or spec are specified, then no files will be excluded. If any exclude patterns or specs are specified, then a file is include only if it matches none of the patterns or specs.
| Modifier and Type | Method | Description |
|---|---|---|
PatternFilterable |
exclude(Closure excludeSpec) |
Adds an exclude spec.
|
PatternFilterable |
exclude(java.lang.Iterable<java.lang.String> excludes) |
Adds an ANT style exclude pattern.
|
PatternFilterable |
exclude(java.lang.String... excludes) |
Adds an ANT style exclude pattern.
|
PatternFilterable |
exclude(Spec<FileTreeElement> excludeSpec) |
Adds an exclude spec.
|
java.util.Set<java.lang.String> |
getExcludes() |
Returns the set of exclude patterns.
|
java.util.Set<java.lang.String> |
getIncludes() |
Returns the set of include patterns.
|
PatternFilterable |
include(Closure includeSpec) |
Adds an include spec.
|
PatternFilterable |
include(java.lang.Iterable<java.lang.String> includes) |
Adds an ANT style include pattern.
|
PatternFilterable |
include(java.lang.String... includes) |
Adds an ANT style include pattern.
|
PatternFilterable |
include(Spec<FileTreeElement> includeSpec) |
Adds an include spec.
|
PatternFilterable |
setExcludes(java.lang.Iterable<java.lang.String> excludes) |
Set the allowable exclude patterns.
|
PatternFilterable |
setIncludes(java.lang.Iterable<java.lang.String> includes) |
Set the allowable include patterns.
|
java.util.Set<java.lang.String> getIncludes()
java.util.Set<java.lang.String> getExcludes()
PatternFilterable setIncludes(java.lang.Iterable<java.lang.String> includes)
include(Iterable) this replaces any previously
defined includes.includes - an Iterable providing new include patternsPattern FormatPatternFilterable setExcludes(java.lang.Iterable<java.lang.String> excludes)
exclude(Iterable) this replaces any previously
defined excludes.excludes - an Iterable providing new exclude patternsPattern FormatPatternFilterable include(java.lang.String... includes)
includes - a vararg list of include patternsPattern FormatPatternFilterable include(java.lang.Iterable<java.lang.String> includes)
includes - a Iterable providing more include patternsPattern FormatPatternFilterable include(Spec<FileTreeElement> includeSpec)
includeSpec - the spec to addPattern FormatPatternFilterable include(Closure includeSpec)
FileTreeElement as its parameter.
If includes are not provided, then all files in this container will be included. If includes are provided, then a
file must match at least one of the include patterns or specs to be included.includeSpec - the spec to addPattern FormatPatternFilterable exclude(java.lang.String... excludes)
excludes - a vararg list of exclude patternsPattern FormatPatternFilterable exclude(java.lang.Iterable<java.lang.String> excludes)
excludes - a Iterable providing new exclude patternsPattern FormatPatternFilterable exclude(Spec<FileTreeElement> excludeSpec)
excludeSpec - the spec to addPattern FormatPatternFilterable exclude(Closure excludeSpec)
FileTreeElement as its parameter. The closure should return true or false. Example:
copySpec {
from 'source'
into 'destination'
//an example of excluding files from certain configuration:
exclude { it.file in configurations.someConf.files }
}
If excludes are not provided, then no files will be excluded. If excludes are provided, then files must not match
any exclude pattern to be processed.excludeSpec - the spec to addFileTreeElement