SourceDirectories

@Incubating interface SourceDirectories


Represents all the source folders for a source type in the variant.

since 7.2

Summary

Public functions

Unit
<T : Task?> add(taskProvider: TaskProvider<T?>?, wiredWith: ((T) -> Provider<Directory>)?)

Add the output of a custom task to the list of source directories.

Unit
addSrcDir(srcDir: String?)

Add a source directory with sources already present to the variant.

Public properties

Provider<List<Directory>>

Get all registered source folders and files as a List of Directory.

Inherited functions

From class Named

Public functions

add

fun <T : Task?> add(taskProvider: TaskProvider<T?>?, wiredWith: ((T) -> Provider<Directory>)?): Unit

Add the output of a custom task to the list of source directories.

The Directory is the output of a Task T that has been registered using the Gradle's Task manager.

The Directory is added last to the variant's list of source directories. In case there is merging for the source type, the Directory will have the highest priority.

Parameters
taskProvider: TaskProvider<T?>?

the TaskProvider returned by Gradle's Task manager when registering the Task of type T.

wiredWith: ((T) -> Provider<Directory>)?

the method reference returning the T task's output to use as a source directory. The generated source directory location is automatically determined by the Android Gradle Plugin

addSrcDir

fun addSrcDir(srcDir: String?): Unit

Add a source directory with sources already present to the variant.

The directory will be added last in the list of source folders for the variant. In case there is merging for the source type, srcDir will be the folder with the highest priority.

Do not use addSrcDir to add sources that are generated by a task, instead use add

Parameters
srcDir: String?

the source directory path, that will be resolved using the Directory.dir API relative to the Gradle project directory.

Public properties

all

val allProvider<List<Directory>>

Get all registered source folders and files as a List of Directory.

Some source types do not have the concept of overriding, while others require a merging step to ensure only one source file is used when processing begins.

The returned Provider can be used directly in a org.gradle.api.tasks.InputFiles annotated property of a Task