@Incubating public interface ProjectLayout
javax.inject.Inject
. It is also available via Project.getLayout()
.Type | Property and Description |
---|---|
DirectoryProperty |
directory
Creates a new
DirectoryProperty that uses the project directory to resolve paths, if required. |
RegularFileProperty |
file
Creates a new
RegularFileProperty that uses the project directory to resolve paths, if required. |
Modifier and Type | Method and Description |
---|---|
ConfigurableFileCollection |
configurableFiles(Object... paths)
Returns a
ConfigurableFileCollection containing the given files. |
DirectoryProperty |
directoryProperty()
Creates a new
DirectoryProperty that uses the project directory to resolve paths, if required. |
DirectoryProperty |
directoryProperty(Provider<? extends Directory> initialProvider)
Creates a new
DirectoryProperty that uses the project directory to resolve paths, if required. |
Provider<RegularFile> |
file(Provider<File> file)
Creates a
RegularFile provider whose location is calculated from the given Provider . |
RegularFileProperty |
fileProperty()
Creates a new
RegularFileProperty that uses the project directory to resolve paths, if required. |
RegularFileProperty |
fileProperty(Provider<? extends RegularFile> initialProvider)
Creates a new
RegularFileProperty that uses the project directory to resolve paths, if required. |
FileCollection |
files(Object... paths)
Creates a
FileCollection for the given targets. |
DirectoryProperty |
getBuildDirectory()
Returns the build directory for the project.
|
Directory |
getProjectDirectory()
Returns the project directory.
|
DirectoryVar |
newDirectoryVar()
Deprecated.
Use
directoryProperty() instead. |
RegularFileVar |
newFileVar()
Deprecated.
Use
fileProperty() instead. |
DirectoryProperty directoryProperty
DirectoryProperty
that uses the project directory to resolve paths, if required. The property has no initial value.RegularFileProperty fileProperty
RegularFileProperty
that uses the project directory to resolve paths, if required. The property has no initial value.Directory getProjectDirectory()
DirectoryProperty getBuildDirectory()
@Deprecated DirectoryVar newDirectoryVar()
directoryProperty()
instead.DirectoryVar
that uses the project directory to resolve paths, if required. The var has no initial value.DirectoryProperty directoryProperty()
DirectoryProperty
that uses the project directory to resolve paths, if required. The property has no initial value.DirectoryProperty directoryProperty(Provider<? extends Directory> initialProvider)
DirectoryProperty
that uses the project directory to resolve paths, if required. The property has the initial provider specified.initialProvider
- initial provider for the property@Deprecated RegularFileVar newFileVar()
fileProperty()
instead.RegularFileVar
that uses the project directory to resolve paths, if required. The var has no initial value.RegularFileProperty fileProperty()
RegularFileProperty
that uses the project directory to resolve paths, if required. The property has no initial value.RegularFileProperty fileProperty(Provider<? extends RegularFile> initialProvider)
RegularFileProperty
that uses the project directory to resolve paths, if required. The property has the initial provider specified.initialProvider
- initial provider for the propertyProvider<RegularFile> file(Provider<File> file)
RegularFile
provider whose location is calculated from the given Provider
.FileCollection files(Object... paths)
Creates a FileCollection
for the given targets. You can pass any of the following
types to this method:
CharSequence
, including String
or GString
. Interpreted relative to the project directory, as per Project.file(Object)
. A string that starts with file:
is treated as a file URL.File
. Interpreted relative to the project directory, as per Project.file(Object)
.Path
as defined by Project.file(Object)
.URI
or URL
. The URL's path is interpreted as a file path. Only file:
URLs are supported.Directory
or RegularFile
.Collection
, Iterable
, or an array that contains objects of any supported type. The elements of the collection are recursively converted to files.FileCollection
. The contents of the collection are included in the returned collection.Provider
of any supported type. The provider's value is recursively converted to files. If the provider represents an output of a task, that task is executed if the file collection is used as an input to another task.
Callable
that returns any supported type. The return value of the call()
method is recursively converted to files. A null
return value is treated as an empty collection.Closure
that returns any of the types listed here. The return value of the closure is recursively converted to files. A null
return value is treated as an empty collection.Task
. Converted to the task's output files. The task is executed if the file collection is used as an input to another task.TaskOutputs
. Converted to the output files the related task. The task is executed if the file collection is used as an input to another task.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, but the collection may not be mutated later.
paths
- The paths to the files. May be empty.ConfigurableFileCollection configurableFiles(Object... paths)
Returns a ConfigurableFileCollection
containing the given files. You can pass any of the following
types to this method:
CharSequence
, including String
or GString
. Interpreted relative to the project directory, as per Project.file(Object)
. A string that starts with file:
is treated as a file URL.File
. Interpreted relative to the project directory, as per Project.file(Object)
.Path
as defined by Project.file(Object)
.URI
or URL
. The URL's path is interpreted as a file path. Only file:
URLs are supported.Directory
or RegularFile
.Collection
, Iterable
, or an array that contains objects of any supported type. The elements of the collection are recursively converted to files.FileCollection
. The contents of the collection are included in the returned collection.Provider
of any supported type. The provider's value is recursively converted to files. If the provider represents an output of a task, that task is executed if the file collection is used as an input to another task.
Callable
that returns any supported type. The return value of the call()
method is recursively converted to files. A null
return value is treated as an empty collection.Closure
that returns any of the types listed here. The return value of the closure is recursively converted to files. A null
return value is treated as an empty collection.Task
. Converted to the task's output files. The task is executed if the file collection is used as an input to another task.TaskOutputs
. Converted to the output files the related task. The task is executed if the file collection is used as an input to another task.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.