# SourceDirectories.Layered

# SourceDirectories.Layered

<br />

```
interface SourceDirectories.Layered : SourceDirectories
```

<br />

*** ** * ** ***

Represent a collection of directories that have overlay properties to each other. This mean that some directories will carry higher priority when merging content will be carried out.

The collection is represented as a[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)where the first elements are the highest priority ones.

For a specific priority, there can be more than one directory defined and is represented as a[Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)of[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html).

Therefore,[Layered](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/variant/SourceDirectories.Layered)can be represented as a[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)of[Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)of[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html).

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                         ### Public properties                                                                                                                                                                                                                                                                                                                                                                                                                          ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)`<`[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)`<`[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html)`>>>` | [all](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/variant/SourceDirectories.Layered#all()) Get all registered source folders and files as a[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)of[Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)of[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html). |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ### Inherited functions                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| From class[org.gradle.api.Named](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html) |----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getName](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html#getName--)`()` |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| From class[com.android.build.api.variant.SourceDirectories](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/variant/SourceDirectories) |------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `<TASK : `[Task](https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html)`> `[addGeneratedSourceDirectory](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/variant/SourceDirectories#addGeneratedSourceDirectory(org.gradle.api.tasks.TaskProvider,kotlin.Function1))`(` ` taskProvider: `[TaskProvider](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskProvider.html)`<TASK>,` ` wiredWith: (TASK) `->` `[DirectoryProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/file/DirectoryProperty.html) `)` Add the output of a custom task to the list of source directories. | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [addStaticSourceDirectory](https://developer.android.com/reference/tools/gradle-api/8.1/com/android/build/api/variant/SourceDirectories#addStaticSourceDirectory(kotlin.String))`(srcDir: `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Add a source directory with sources already present to the variant.                                                                                                                                                                                                                                                                                                     | |

## Public properties

### all

```
val all: Provider<List<Collection<Directory>>>
```

Get all registered source folders and files as a[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)of[Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)of[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html).

The outer[List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)represents the priority of[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html)respective to each other, meaning that elements first in the list overrides elements last in the list.

The inner[Collection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/index.html)represents all[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html)with the same priority respective to each other.

The returned[Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)can be used directly in a[org.gradle.api.tasks.InputFiles](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/InputFiles.html)annotated property of a[Task](https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html)