PatternFilterable

A PatternFilterable represents some file container which Ant-style include and exclude patterns or specs can be applied to.

Patterns may include:

  • '*' to match any number of characters
  • '?' to match any single character
  • '**' to match any number of directories or files

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 org.gradle.api.file.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.

Inheritors

Functions

Link copied to clipboard
abstract fun exclude(excludeSpec: Closure): PatternFilterable
abstract fun exclude(excludeSpec: Spec<FileTreeElement>): PatternFilterable
Adds an exclude spec.
abstract fun exclude(excludes: Iterable<String>): PatternFilterable
abstract fun exclude(excludes: Array<String>): PatternFilterable
Adds an ANT style exclude pattern.
Link copied to clipboard
abstract fun getExcludes(): Set<String>
Returns the set of exclude patterns.
Link copied to clipboard
abstract fun getIncludes(): Set<String>
Returns the set of include patterns.
Link copied to clipboard
abstract fun include(includeSpec: Closure): PatternFilterable
abstract fun include(includeSpec: Spec<FileTreeElement>): PatternFilterable
Adds an include spec.
abstract fun include(includes: Iterable<String>): PatternFilterable
abstract fun include(includes: Array<String>): PatternFilterable
Adds an ANT style include pattern.
Link copied to clipboard
abstract fun setExcludes(excludes: Iterable<String>): PatternFilterable
Set the allowable exclude patterns.
Link copied to clipboard
abstract fun setIncludes(includes: Iterable<String>): PatternFilterable
Set the allowable include patterns.