# SourceDirectorySet

interface SourceDirectorySet : FileTree, PatternFilterable, Named, Describable(source)

A `SourceDirectorySet` represents a set of source files composed from a set of source directories, along with associated include and exclude patterns.

`SourceDirectorySet` extends FileTree. The contents of the file tree represent the source files of this set, arranged in a hierarchy. The file tree is live and reflects changes to the source directories and their contents.

You can create an instance of `SourceDirectorySet` using the sourceDirectorySet method.

You can filter the files that are obtainable in this set using patterns via include and include (or any overload of these methods). The set of included source directories themselves are not filtered.

#### Since

0.8

#### Inheritors

AntlrSourceDirectorySet
GroovySourceDirectorySet
ScalaSourceDirectorySet

## Functions

addToAntBuilder
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.
abstract fun addToAntBuilder(node: Any, childNodeName: String): Any
Add to ant builder.
compiledBy
Link copied to clipboard
abstract fun <T : Task?> compiledBy(taskProvider: TaskProvider<T>, mapping: (T) -> DirectoryProperty)
Define the task responsible for processing the source.
contains
Link copied to clipboard
abstract fun contains(file: File): Boolean
Determines whether this collection contains the given file.
exclude
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.
filter
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.
forEach
Link copied to clipboard
open fun forEach(action: Consumer<in T>)
getAsFileTree
Link copied to clipboard
abstract fun getAsFileTree(): FileTree
Returns this.
getAsPath
Link copied to clipboard
abstract fun getAsPath(): String
Returns the contents of this collection as a platform-specific path.
getBuildDependencies
Link copied to clipboard
abstract fun getBuildDependencies(): TaskDependency
Returns a dependency which contains the tasks which build this artifact.
getClassesDirectory
Link copied to clipboard
abstract fun getClassesDirectory(): Provider<Directory>
Returns the directory property that is bound to the task that produces the output via compiledBy.
getDestinationDirectory
Link copied to clipboard
abstract fun getDestinationDirectory(): DirectoryProperty
Configure the directory to assemble the compiled classes into.
getDisplayName
Link copied to clipboard
abstract fun getDisplayName(): String
Returns the display name of this object.
getElements
Link copied to clipboard
abstract fun getElements(): Provider<Set<FileSystemLocation>>
Returns the contents of this file collection as a Provider of FileSystemLocation instances.
getExcludes
Link copied to clipboard
abstract fun getExcludes(): Set<String>
Returns the set of exclude patterns.
getFiles
Link copied to clipboard
abstract fun getFiles(): Set<File>
Returns the contents of this tree as a flattened Set.
getFilter
Link copied to clipboard
abstract fun getFilter(): PatternFilterable
Returns the filter used to select the source from the source directories.
getIncludes
Link copied to clipboard
abstract fun getIncludes(): Set<String>
Returns the set of include patterns.
getName
Link copied to clipboard
abstract fun getName(): String
A concise name for the source directory set (typically used to identify it in a collection).
getSingleFile
Link copied to clipboard
abstract fun getSingleFile(): File
Returns the content of this collection, asserting it contains exactly one file.
getSourceDirectories
Link copied to clipboard
abstract fun getSourceDirectories(): FileCollection
Returns the source directories that make up this set, represented as a FileCollection.
getSrcDirs
Link copied to clipboard
abstract fun getSrcDirs(): Set<File>
Returns the source directories that make up this set.
getSrcDirTrees
Link copied to clipboard
abstract fun getSrcDirTrees(): Set<DirectoryTree>
Returns the source directory trees that make up this set.
include
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.
isEmpty
Link copied to clipboard
abstract fun isEmpty(): Boolean
Returns true if this collection is empty.
iterator
Link copied to clipboard
abstract fun iterator(): Iterator<T>
matching
Link copied to clipboard
abstract fun matching(@DelegatesTo(value = PatternFilterable::class) filterConfigClosure: Closure): FileTree
abstract fun matching(filterConfigAction: Action<in PatternFilterable>): FileTree
abstract fun matching(patterns: PatternFilterable): FileTree
Restricts the contents of this tree to those files matching the given filter.
minus
Link copied to clipboard
abstract fun minus(collection: FileCollection): FileCollection
Returns a `FileCollection` which contains the difference between this collection and the given collection.
plus
Link copied to clipboard
abstract fun plus(collection: FileCollection): FileCollection
Returns a `FileCollection` which contains the union of this collection and the given collection.
abstract fun plus(fileTree: FileTree): FileTree
Returns a `FileTree` which contains the union of this tree and the given tree.
setExcludes
Link copied to clipboard
abstract fun setExcludes(excludes: Iterable<String>): PatternFilterable
Set the allowable exclude patterns.
setIncludes
Link copied to clipboard
abstract fun setIncludes(includes: Iterable<String>): PatternFilterable
Set the allowable include patterns.
setSrcDirs
Link copied to clipboard
abstract fun setSrcDirs(srcPaths: Iterable<out Any>): SourceDirectorySet
Sets the source directories for this set.
source
Link copied to clipboard
abstract fun source(source: SourceDirectorySet): SourceDirectorySet
Adds the given source to this set.
spliterator
Link copied to clipboard
open fun spliterator(): Spliterator<T>
srcDir
Link copied to clipboard
abstract fun srcDir(srcPath: Any): SourceDirectorySet
Adds the given source directory to this set.
srcDirs
Link copied to clipboard
abstract fun srcDirs(@Nullable srcPaths: Array<@Nullable Any>): SourceDirectorySet
Adds the given source directories to this set.
visit
Link copied to clipboard
abstract fun visit(@DelegatesTo(value = FileVisitDetails::class) visitor: Closure): FileTree
abstract fun visit(visitor: Action<in FileVisitDetails>): FileTree
abstract fun visit(visitor: FileVisitor): FileTree
Visits the files and directories in this file tree.