api / org.gradle.kotlin.dsl / InitScriptApi / files

files

fun files(vararg paths: Any): ConfigurableFileCollection

Creates a ConfigurableFileCollection containing the given files.

You can pass any of the following types to this method:

The returned file collection is lazy, so that the paths are evaluated only when the contents of the file collection are queried. The file collection is also live, so that it evaluates the above each time the contents of the collection is queried.

The returned file collection maintains the iteration order of the supplied paths.

The returned file collection maintains the details of the tasks that produce the files, so that these tasks are executed if this file collection is used as an input to some task.

This method can also be used to create an empty collection, which can later be mutated to add elements.

Parameters

paths - The paths to the files. May be empty.

Return
The file collection.

fun files(paths: Any, configuration: ConfigurableFileCollection.() -> Unit): ConfigurableFileCollection

Creates a ConfigurableFileCollection containing the given files.

Parameters

paths - The contents of the file collection. Evaluated as per KotlinInitScript.files.

configuration - The block to use to configure the file collection.

Return
The file collection.

See Also

KotlinInitScript.files