FileCollection

A FileCollection represents a collection of file system locations which you can query in certain ways. A file collection is can be used to define a classpath, or a set of source files, or to add files to an archive.

There are no methods on this interface that allow the contents of the collection to be modified. However, there are a number of sub-interfaces, such as ConfigurableFileCollection that allow changes to be made.

A file collection may contain task outputs. The file collection tracks not just a set of files, but also the tasks that produce those files. When a file collection is used as a task input property, Gradle will take care of automatically adding dependencies between the consuming task and the producing tasks.

You can obtain a FileCollection instance using files.

Inheritors

Types

Link copied to clipboard
enum AntType
Ant types which a FileCollection can be mapped to.

Functions

Link copied to clipboard
abstract fun addToAntBuilder(builder: Any, nodeName: String): Any
abstract fun addToAntBuilder(builder: Any, nodeName: String, type: FileCollection.AntType)
Adds this collection to an Ant task as a nested node.
Link copied to clipboard
abstract fun contains(file: File): Boolean
Determines whether this collection contains the given file.
Link copied to clipboard
abstract fun filter(filterClosure: Closure): FileCollection
abstract fun filter(filterSpec: Spec<in File>): FileCollection
Restricts the contents of this collection to those files which match the given criteria.
Link copied to clipboard
open fun forEach(action: Consumer<in T>)
Link copied to clipboard
abstract fun getAsFileTree(): FileTree
Converts this collection to a FileTree, if not already.
Link copied to clipboard
abstract fun getAsPath(): String
Returns the contents of this collection as a platform-specific path.
Link copied to clipboard
Link copied to clipboard
Returns the contents of this file collection as a Provider of FileSystemLocation instances.
Link copied to clipboard
abstract fun getFiles(): Set<File>
Returns the contents of this collection as a Set.
Link copied to clipboard
abstract fun getSingleFile(): File
Returns the content of this collection, asserting it contains exactly one file.
Link copied to clipboard
abstract fun isEmpty(): Boolean
Returns true if this collection is empty.
Link copied to clipboard
abstract fun iterator(): Iterator<T>
Link copied to clipboard
abstract fun minus(collection: FileCollection): FileCollection
Returns a FileCollection which contains the difference between this collection and the given collection.
Link copied to clipboard
abstract fun plus(collection: FileCollection): FileCollection
Returns a FileCollection which contains the union of this collection and the given collection.
Link copied to clipboard