Various file utilities that requires at least Gradle 5.0
Type Params | Return Type | Name and description |
---|---|---|
|
static File |
fileize(ProjectLayout projectLayout, Object file) Converts a file-like object to a File instance with project context. |
|
static java.util.List<File> |
fileize(ProjectLayout projectLayout, Iterable<Object> files) Converts a collection of file-like objects to a a list of File instances within a project layout. |
|
static FileCollection |
filesFromCopySpec(CopySpec copySpec) Returns the file collection that a CopySpec describes. |
|
static java.util.List<File> |
listDirs(File distDir) Provides a list of directories below another directory |
|
static String |
relativize(File base, File target) Returns the path of one File relative to another. |
|
static String |
relativize(java.nio.file.Path base, java.nio.file.Path target) Returns the path of one Path relative to another. |
|
static ClassLocation |
resolveClassLocation(Class aClass) Returns the classpath location for a specific class |
|
static File |
toSafeFile(String... parts) Converts a collection of String into a {@@link File} with all parts guarantee to be safe file parts |
|
static String |
toSafeFileName(String name) Converts a string into a string that is safe to use as a file name. |
|
static java.nio.file.Path |
toSafePath(String... parts) Converts a collection of String into a java.nio.file.Path with all parts guarantee to be safe file parts |
|
static void |
updateFileProperty(ProjectLayout projectLayout, ProviderFactory providers, Property<File> provider, Object file) Updates a Provider. |
Converts a file-like object to a File instance with project context. Converts any of the following recursively until it gets to a file:
CharSequence
including String
and GString
.
file:
schemes.
projectLayout
- Project layoutConverts a collection of file-like objects to a a list of File instances within a project layout. It will convert anything that the singular version of fileize(ProjectLayout projectLayout, Object o) can do. In addition it will recursively resolve any collections that result out of resolving the supplied items.
project
- projectLayout Project layoutfiles
- List of object to evaluateReturns the file collection that a CopySpec describes.
copySpec
- An instance of a CopySpecProvides a list of directories below another directory
distDir
- Directorynull
supplied directory.Returns the path of one File relative to another.
target
- the target directorybase
- the base directoryReturns the path of one Path relative to another.
target
- the target directorybase
- the base directoryReturns the classpath location for a specific class
aClass
- Class to find.null
which means class has been found, but cannot be placed
on classpathConverts a collection of String into a {@
parts
- File path partsConverts a string into a string that is safe to use as a file name. T The result will only include ascii characters and numbers, and the "-","_", #, $ and "." characters.
A
- potential file nameConverts a collection of String into a java.nio.file.Path with all parts guarantee to be safe file parts
parts
- File path partsUpdates a Provider. Update property otherwise the provider will be assigned a new Provider instance.
projectLayout
- Project layoutproviders
- Provider factoryprovider
- Current propertystringy
- Value that should be lazy-resolved.