abstract fun files(vararg paths: Any): ConfigurableFileCollection
Returns a ConfigurableFileCollection containing the given files. You can pass any of the following types to this method:
#file(Object)
. A string that starts with file:
is treated as a file URL.#file(Object)
.#file(Object)
.file:
URLs are supported.call()
method is recursively converted to files. A null
return value is treated as an empty collection.null
return value is treated as an empty collection.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.
paths
- The paths to the files. May be empty.
Return
The file collection. Never returns null.
abstract fun files(paths: Any, configureClosure: Closure<Any>): ConfigurableFileCollection
Creates a new ConfigurableFileCollection
using the given paths. The paths are evaluated as per
. The file collection is configured using the given closure. The file collection is passed to the closure as its delegate. Example:
files "$buildDir/classes" { builtBy 'compile' }
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.
paths
- The contents of the file collection. Evaluated as per #files(Object...)
.
configureClosure
- The closure to use to configure the file collection.
Return
the configured file tree. Never returns null.
abstract fun files(paths: Any, configureAction: Action<in ConfigurableFileCollection>): ConfigurableFileCollection
Creates a new ConfigurableFileCollection
using the given paths. The paths are evaluated as per
. The file collection is configured using the given action. Example:
files "$buildDir/classes" { builtBy 'compile' }
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.
paths
- The contents of the file collection. Evaluated as per #files(Object...)
.
configureAction
- The action to use to configure the file collection.
Return
the configured file tree. Never returns null.
Since
3.5