# SourceSet

API Documentation: | `SourceSet`

A `SourceSet` represents a logical group of Java source and resources.

### Properties

Property | Description
`allJava` | All Java source files for this source set. This includes, for example, source which is directly compiled, and source which is indirectly compiled through joint compilation.
`allSource` | All source files for this source set.
`classes` | The compiled classes directory for this source set.
`classesDir` | The directory to assemble the compiled classes into.
`compileClasspath` | The classpath used to compile this source.
`java` | The Java source which is to be compiled by the Java compiler into the class output directory.
`name` | The name of this source set.
`resources` | The non-Java resources which are to be copied into the class output directory.
`runtimeClasspath` | The classpath used to execute this source.

#### Properties added by the `antlr` plugin

Property | Description
`antlr` | All Antlr source for this source set.

#### Properties added by the `groovy` plugin

Property | Description
`allGroovy` | All Groovy source for this source set.
`groovy` | The source to be compiled by the Groovy compiler for this source set. Any Java source present in this set will be passed to the Groovy compiler for joint compilation.

#### Properties added by the `scala` plugin

Property | Description
`allScala` | All Scala source for this source set.
`scala` | The source to be compiled by the Scala compiler for this source set. This may contain both Java and Scala source files.

### Property details

#### `SourceDirectorySet` `allJava` (read-only)

All Java source files for this source set. This includes, for example, source which is directly compiled, and source which is indirectly compiled through joint compilation.

Default with `java` plugin:
  `[java]`

#### `SourceDirectorySet` `allSource` (read-only)

All source files for this source set.

Default with `java` plugin:
  `[java, resources]`

#### `FileCollection` `classes` (read-only)

The compiled classes directory for this source set.

Default with `java` plugin:
  `[classesDir]`

#### `File` `classesDir`

The directory to assemble the compiled classes into.

Default with `java` plugin:
  ``${project.buildDir}`/classes/`${sourceSet.name}``

#### `FileCollection` `compileClasspath`

The classpath used to compile this source.

Default with `java` plugin:
  `project.configurations.compile` (or `project.configurations.testCompile` for the `test` source set).

#### `SourceDirectorySet` `java` (read-only)

The Java source which is to be compiled by the Java compiler into the class output directory.

Default with `java` plugin:
  `[`${project.projectDir}`/src/`${sourceSet.name}`/java]`

#### `String` `name` (read-only)

The name of this source set.

#### `SourceDirectorySet` `resources` (read-only)

The non-Java resources which are to be copied into the class output directory.

Default with `java` plugin:
  `[`${project.projectDir}`/src/`${sourceSet.name}`/resources]`

#### `FileCollection` `runtimeClasspath`

The classpath used to execute this source.

Default with `java` plugin:
  `sourceSet.classes + project.configurations.runtime` (or `sourceSet.classes + project.configurations.testRuntime` for the `test` source set).

#### `SourceDirectorySet` `antlr` (read-only)

All Antlr source for this source set.

Default with `antlr` plugin:
  `[`${project.projectDir}`/src/`${sourceSet.name}`/antlr]`

#### `SourceDirectorySet` `allGroovy` (read-only)

All Groovy source for this source set.

Default with `groovy` plugin:
  `[groovy]`

#### `SourceDirectorySet` `groovy` (read-only)

The source to be compiled by the Groovy compiler for this source set. Any Java source present in this set will be passed to the Groovy compiler for joint compilation.

Default with `groovy` plugin:
  `[`${project.projectDir}`/src/`${sourceSet.name}`/groovy]`

#### `SourceDirectorySet` `allScala` (read-only)

All Scala source for this source set.

Default with `scala` plugin:
  `[scala]`

#### `SourceDirectorySet` `scala` (read-only)

The source to be compiled by the Scala compiler for this source set. This may contain both Java and Scala source files.

Default with `scala` plugin:
  `[`${project.projectDir}`/src/`${sourceSet.name}`/scala]`

### Script blocks

Block | Description
`java` | Configures the Java source for this set.
`resources` | Configures the non-Java resources for this set.

#### Script blocks added by the `antlr` plugin

Block | Description
`antlr` | Configures the Antlr source for this set. The given closure is used to configure the `SourceDirectorySet` (see `AntlrSourceVirtualDirectory.getAntlr()`) which contains the Antlr source.

#### Script blocks added by the `groovy` plugin

Block | Description
`groovy` | Configures the Groovy source for this set.

#### Script blocks added by the `scala` plugin

Block | Description
`scala` | Configures the Scala source for this set.

### Script block details

#### `java` { }

Configures the Java source for this set.

The given closure is used to configure the `SourceDirectorySet` which contains the Java source.

Delegates to:
  `SourceDirectorySet` from `java`

#### `resources` { }

Configures the non-Java resources for this set.

The given closure is used to configure the `SourceDirectorySet` which contains the resources.

Delegates to:
  `SourceDirectorySet` from `resources`

#### `antlr` { }

Configures the Antlr source for this set. The given closure is used to configure the `SourceDirectorySet` (see `AntlrSourceVirtualDirectory.getAntlr()`) which contains the Antlr source.

Delegates to:
  `SourceDirectorySet` from `antlr`

#### `groovy` { }

Configures the Groovy source for this set.

The given closure is used to configure the `SourceDirectorySet` which contains the Groovy source.

Delegates to:
  `SourceDirectorySet` from `groovy`

#### `scala` { }

Configures the Scala source for this set.

The given closure is used to configure the `SourceDirectorySet` which contains the Scala source.

Delegates to:
  `SourceDirectorySet` from `scala`

### Methods

Method | Description
`compiledBy(taskPaths)` | Registers a set of tasks which are responsible for compiling this source set into the classes directory. The paths are evaluated as for `Task.dependsOn()`.
`getCompileTaskName(language)` | Returns the name of a compile task for this source set.
`getTaskName(verb, target)` | Returns the name of a task for this source set.

### Method details

#### `SourceSet` `compiledBy`(``Object`...` taskPaths)

Registers a set of tasks which are responsible for compiling this source set into the classes directory. The paths are evaluated as for `Task.dependsOn()`.

#### `String` `getCompileTaskName`(`String` language)

Returns the name of a compile task for this source set.

#### `String` `getTaskName`(`String` verb, `String` target)

Returns the name of a task for this source set.