SourceDirectorySet

API Documentation:SourceDirectorySet

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 ObjectFactory.sourceDirectorySet(java.lang.String, java.lang.String) method.

Properties

PropertyDescription
filter

The filter used to select the source from the source directories. These filter patterns are applied after the include and exclude patterns of this source directory set. Generally, the filter patterns are used to restrict the contents to certain types of files, eg *.java.

outputDir
Incubating

The directory to put the output for these sources.

srcDirs

The source directories that make up this set. Does not filter source directories that do not exist.

Methods

MethodDescription
source(source)

Adds the given source to this set.

srcDir(srcPath)

Adds the given source directory to this set. The given directory does not need to exist. Directories that do not exist are ignored.

srcDirs(srcPaths)

Adds the given source directories to this set. The given directories to not need to exist. Directories that do no exist are ignored.

Script blocks

No script blocks

Property details

PatternFilterable filter (read-only)

The filter used to select the source from the source directories. These filter patterns are applied after the include and exclude patterns of this source directory set. Generally, the filter patterns are used to restrict the contents to certain types of files, eg *.java.

File outputDir

Note: This property is incubating and may change in a future version of Gradle.

The directory to put the output for these sources.

Default with java-base plugin:
${project.buildDir}/classes/${sourceDirectorySet.name}/${sourceSet.name}

Set<File> srcDirs

The source directories that make up this set. Does not filter source directories that do not exist.

Default with java-base plugin:
src/${sourceSet.name}/${sourceDirectorySet.name}

Method details

Adds the given source to this set.

SourceDirectorySet srcDir(Object srcPath)

Adds the given source directory to this set. The given directory does not need to exist. Directories that do not exist are ignored.

SourceDirectorySet srcDirs(Object... srcPaths)

Adds the given source directories to this set. The given directories to not need to exist. Directories that do no exist are ignored.