Interface ProjectLayout
javax.inject.Inject. It is also available via Project.getLayout().- Since:
- 4.1
-
Method Summary
Modifier and TypeMethodDescriptionconfigurableFiles(Object... paths) Returns aConfigurableFileCollectioncontaining the given files.Creates a newDirectoryPropertythat uses the project directory to resolve paths, if required.directoryProperty(Provider<? extends Directory> initialProvider) Creates a newDirectoryPropertythat uses the project directory to resolve paths, if required.Creates aRegularFileprovider whose location is calculated from the givenProvider.Creates a newRegularFilePropertythat uses the project directory to resolve paths, if required.fileProperty(Provider<? extends RegularFile> initialProvider) Creates a newRegularFilePropertythat uses the project directory to resolve paths, if required.Creates aFileCollectionfor the given targets.Returns the build directory for the project.Returns the project directory.Deprecated.Deprecated.UsefileProperty()instead.
-
Method Details
-
getProjectDirectory
Directory getProjectDirectory()Returns the project directory. -
getBuildDirectory
DirectoryProperty getBuildDirectory()Returns the build directory for the project. -
newDirectoryVar
Deprecated.UsedirectoryProperty()instead.Creates a newDirectoryVarthat uses the project directory to resolve paths, if required. The var has no initial value. -
directoryProperty
DirectoryProperty directoryProperty()Creates a newDirectoryPropertythat uses the project directory to resolve paths, if required. The property has no initial value.- Since:
- 4.3
-
directoryProperty
Creates a newDirectoryPropertythat uses the project directory to resolve paths, if required. The property has the initial provider specified.- Parameters:
initialProvider- initial provider for the property- Since:
- 4.4
-
newFileVar
Deprecated.UsefileProperty()instead.Creates a newRegularFileVarthat uses the project directory to resolve paths, if required. The var has no initial value. -
fileProperty
RegularFileProperty fileProperty()Creates a newRegularFilePropertythat uses the project directory to resolve paths, if required. The property has no initial value.- Since:
- 4.3
-
fileProperty
Creates a newRegularFilePropertythat uses the project directory to resolve paths, if required. The property has the initial provider specified.- Parameters:
initialProvider- initial provider for the property- Since:
- 4.4
-
file
Creates aRegularFileprovider whose location is calculated from the givenProvider. -
files
Creates a
FileCollectionfor the given targets. You can pass any of the following types to this method:- A
CharSequence, includingStringorGString. Interpreted relative to the project directory, as perProject.file(Object). A string that starts withfile:is treated as a file URL. - A
File. Interpreted relative to the project directory, as perProject.file(Object). - A
Pathas defined byProject.file(Object). - A
URIorURL. The URL's path is interpreted as a file path. Onlyfile:URLs are supported. - A
DirectoryorRegularFile. - A
Collection,Iterable, or an array that contains objects of any supported type. The elements of the collection are recursively converted to files. - A
FileCollection. The contents of the collection are included in the returned collection. - A
Providerof 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. - A
Callablethat returns any supported type. The return value of thecall()method is recursively converted to files. Anullreturn value is treated as an empty collection. - A
Closurethat returns any of the types listed here. The return value of the closure is recursively converted to files. Anullreturn value is treated as an empty collection. - A
Task. Converted to the task's output files. The task is executed if the file collection is used as an input to another task. - A
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. - Anything else is treated as a failure.
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.
- Parameters:
paths- The paths to the files. May be empty.- Returns:
- The file collection. Never returns null.
- Since:
- 4.8
- A
-
configurableFiles
Returns a
ConfigurableFileCollectioncontaining the given files. You can pass any of the following types to this method:- A
CharSequence, includingStringorGString. Interpreted relative to the project directory, as perProject.file(Object). A string that starts withfile:is treated as a file URL. - A
File. Interpreted relative to the project directory, as perProject.file(Object). - A
Pathas defined byProject.file(Object). - A
URIorURL. The URL's path is interpreted as a file path. Onlyfile:URLs are supported. - A
DirectoryorRegularFile. - A
Collection,Iterable, or an array that contains objects of any supported type. The elements of the collection are recursively converted to files. - A
FileCollection. The contents of the collection are included in the returned collection. - A
Providerof 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. - A
Callablethat returns any supported type. The return value of thecall()method is recursively converted to files. Anullreturn value is treated as an empty collection. - A
Closurethat returns any of the types listed here. The return value of the closure is recursively converted to files. Anullreturn value is treated as an empty collection. - A
Task. Converted to the task's output files. The task is executed if the file collection is used as an input to another task. - A
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. - Anything else is treated as a failure.
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.- Returns:
- The file collection. Never returns null.
- Since:
- 4.8
- A
-
directoryProperty()instead.