api / org.gradle.api.file / ConfigurableFileTree

ConfigurableFileTree

interface ConfigurableFileTree : FileTree, DirectoryTree, PatternFilterable, Buildable

A FileTree with a single base directory, which can be configured and modified.

You can obtain a ConfigurableFileTree instance by calling org.gradle.api.Project#fileTree(java.util.Map).

Functions

builtBy

abstract fun builtBy(vararg tasks: Any): ConfigurableFileTree

Registers some tasks which build the files of this collection.

from

abstract fun from(dir: Any): ConfigurableFileTree

Specifies base directory for this file tree using the given path. The path is evaluated as per .

getBuiltBy

abstract fun getBuiltBy(): MutableSet<Any>

Returns the set of tasks which build the files of this collection.

getDir

abstract fun getDir(): File

Returns the base directory of this file tree.

setBuiltBy

abstract fun setBuiltBy(tasks: MutableIterable<*>): ConfigurableFileTree

Sets the tasks which build the files of this collection.

setDir

abstract fun setDir(dir: Any): ConfigurableFileTree

Specifies base directory for this file tree using the given path. The path is evaluated as per .

Inherited Functions

exclude

abstract fun exclude(vararg excludes: String): PatternFilterable
abstract fun exclude(excludes: MutableIterable<String>): PatternFilterable

Adds an ANT style exclude pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. 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.

abstract fun exclude(excludeSpec: Spec<FileTreeElement>): PatternFilterable

Adds an exclude spec. This method may be called multiple times to append new specs. 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.

abstract fun exclude(excludeSpec: Closure<Any>): PatternFilterable

Adds an exclude spec. This method may be called multiple times to append new specs.The given closure is passed a org.gradle.api.file.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.

getAsFileTree

abstract fun getAsFileTree(): FileTree

Returns this.

getExcludes

abstract fun getExcludes(): MutableSet<String>

Returns the set of exclude patterns.

getFiles

abstract fun getFiles(): MutableSet<File>

Returns the contents of this tree as a flattened Set.

getIncludes

abstract fun getIncludes(): MutableSet<String>

Returns the set of include patterns.

getPatterns

abstract fun getPatterns(): PatternSet

Returns the patterns which select the files under the base directory.

include

abstract fun include(vararg includes: String): PatternFilterable
abstract fun include(includes: MutableIterable<String>): PatternFilterable

Adds an ANT style include pattern. This method may be called multiple times to append new patterns and multiple patterns may be specified in a single call. 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 to be processed.

abstract fun include(includeSpec: Spec<FileTreeElement>): PatternFilterable

Adds an include spec. This method may be called multiple times to append new specs. 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.

abstract fun include(includeSpec: Closure<Any>): PatternFilterable

Adds an include spec. This method may be called multiple times to append new specs. The given closure is passed a org.gradle.api.file.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.

matching

abstract fun matching(filterConfigClosure: Closure<Any>): FileTree

Restricts the contents of this tree to those files matching the given filter. The filtered tree is live, so that any changes to this tree are reflected in the filtered tree.

The given closure is used to configure the filter. A org.gradle.api.tasks.util.PatternFilterable is passed to the closure as its delegate. Only files which match the specified include patterns will be included in the filtered tree. Any files which match the specified exclude patterns will be excluded from the filtered tree.

abstract fun matching(filterConfigAction: Action<in PatternFilterable>): FileTree

Restricts the contents of this tree to those files matching the given filter. The filtered tree is live, so that any changes to this tree are reflected in the filtered tree.

The given action is used to configure the filter. A org.gradle.api.tasks.util.PatternFilterable is passed to the action. Only files which match the specified include patterns will be included in the filtered tree. Any files which match the specified exclude patterns will be excluded from the filtered tree.

abstract fun matching(patterns: PatternFilterable): FileTree

Restricts the contents of this tree to those files matching the given filter. The filtered tree is live, so that any changes to this tree are reflected in the filtered tree.

The given pattern set is used to configure the filter. Only files which match the specified include patterns will be included in the filtered tree. Any files which match the specified exclude patterns will be excluded from the filtered tree.

plus

abstract fun plus(fileTree: FileTree): FileTree

Returns a FileTree which contains the union of this tree and the given tree. The returned tree is live, so that changes to either this tree or the other source tree are reflected in the returned tree.

setExcludes

abstract fun setExcludes(excludes: MutableIterable<String>): PatternFilterable

Set the allowable exclude patterns. Note that unlike #exclude(Iterable) this replaces any previously defined excludes.

setIncludes

abstract fun setIncludes(includes: MutableIterable<String>): PatternFilterable

Set the allowable include patterns. Note that unlike #include(Iterable) this replaces any previously defined includes.

visit

abstract fun visit(visitor: FileVisitor): FileTree

Visits the files and directories in this file tree. Files are visited in depth-first prefix order, so that a directory is visited before its children.

abstract fun visit(visitor: Closure<Any>): FileTree

Visits the files and directories in this file tree. Files are visited in depth-first prefix order, so that a directory is visited before its children. The file/directory to be visited is passed to the given closure as a

abstract fun visit(visitor: Action<in FileVisitDetails>): FileTree

Visits the files and directories in this file tree. Files are visited in depth-first prefix order, so that a directory is visited before its children. The file/directory to be visited is passed to the given action as a