# SourceDirectories.Layered

# SourceDirectories.Layered

<br />

```
public interface SourceDirectories.Layered extends 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.3/null/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 methods                                                                                                                                                                                                                                                                                                                                                                                                                   |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `abstract @`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[Provider](https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Provider.html)`<@`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[List](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html)`<@`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[Collection](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/Collection.html)`<@`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[Directory](https://docs.gradle.org/current/javadoc/org/gradle/api/file/Directory.html)`>>>` | [getAll](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/variant/SourceDirectories.Layered#getAll())`()` 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 methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From[org.gradle.api.Named](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html) |---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | `abstract @`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[String](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html) | [getName](https://docs.gradle.org/current/javadoc/org/gradle/api/Named.html#getName--)`()` |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| From[com.android.build.api.variant.SourceDirectories](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/variant/SourceDirectories) |-----------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `abstract void` | `<TASK extends `[Task](https://docs.gradle.org/current/javadoc/org/gradle/api/Task.html)`> `[addGeneratedSourceDirectory](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/variant/SourceDirectories#addGeneratedSourceDirectory(org.gradle.api.tasks.TaskProvider,kotlin.Function1))`(` ` @`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[TaskProvider](https://docs.gradle.org/current/javadoc/org/gradle/api/tasks/TaskProvider.html)`<@`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` TASK> taskProvider,` ` @`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` Function1<@`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` TASK, @`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[DirectoryProperty](https://docs.gradle.org/current/javadoc/org/gradle/api/file/DirectoryProperty.html)`> wiredWith` `)` Add the output of a custom task to the list of source directories. | | `abstract void` | [addStaticSourceDirectory](https://developer.android.com/reference/tools/gradle-api/8.3/null/com/android/build/api/variant/SourceDirectories#addStaticSourceDirectory(kotlin.String))`(@`[NonNull](https://developer.android.com/reference/tools/gradle-api/8.3/null/androidx/annotation/NonNull)` `[String](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html)` srcDir)` Add a source directory with sources already present to the variant.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | |

## Public methods

### getAll

```
abstract @NonNull Provider<@NonNull List<@NonNull Collection<@NonNull Directory>>> getAll()
```

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)