public interface FileSystemOperations
Abstracts a number of file operations.
Also Acts as a proxy for the FileSystemOperations that was implemented in Gradle 6.0,
but allows for a substitute operation on old Gradle versions.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public Provider<File> |
buildDirDescendant(Object stringy)Safely resolve the stringy item as a path relative to the build directory. |
|
public ReadableResource |
bzip2Resource(Object file)Creates resource that points to a bzip2 compressed file at the given path. |
|
public WorkResult |
copy(Action<? super CopySpec> action)Copies the specified files. |
|
public void |
copyResourceToFile(String resourcePath, File destFile)Copies the file at the resource path to a local file. |
|
public CopySpec |
copySpec()Creates an empty CopySpec |
|
public CopySpec |
copySpec(Action<? super CopySpec> action)Creates a copy specification and configures it. |
|
public CopySpec |
copySpec(groovy.lang.Closure<?> action)Creates a copy specification and configures it. |
|
public File |
createTempDirectory(String prefix)Creates a temporary directory with the given prefix. |
|
public WorkResult |
delete(Action<? super DeleteSpec> action)Deletes the specified files. |
|
public ConfigurableFileCollection |
emptyFileCollection()Creates an empty file collection. |
|
public File |
file(Object file)Converts a file-like object to a File instance with project context. |
|
public File |
fileOrNull(Object file)Similar to {
|
|
public ConfigurableFileTree |
fileTree(Object file)Obtain a file tree given a starting location |
|
public ConfigurableFileCollection |
files(java.util.Collection<?> files)Converts a file-like objects to File instances with project context. |
|
public ConfigurableFileCollection |
filesDropNull(java.util.Collection<?> files)Converts a file-like objects to File instances with project context. |
|
public Provider<File> |
getGradleHomeDir()Gradle distribution home directory. |
|
public Provider<File> |
getGradleUserHomeDir()Gradle user home directory. |
|
public File |
getProjectCacheDir()Returns the project's local cache directory |
|
public File |
getProjectDir()Returns the project directory. |
|
public File |
getProjectRootDir()The project root dir. |
|
public ReadableResource |
gzipResource(Object file)Creates resource that points to a gzip compressed file at the given path. |
|
public java.util.List<File> |
listDirs(File distDir)Provides a list of directories below another directory |
|
public java.util.Properties |
loadPropertiesFromResource(String resourcePath)Loads properties from a resource file. |
|
public java.util.Properties |
loadPropertiesFromResource(String resourcePath, ClassLoader classLoader)Loads properties from a resource file. |
|
public Provider<File> |
provideFile(Object file)Like file, but does not immediately evaluate the passed parameter. |
|
public Provider<File> |
provideProjectCacheDir()Like getProjectCacheDir(), but returns a provider instead. |
|
public Provider<File> |
provideProjectCacheDirDescendant(Object subpath)Provides a subpath below the project's cache directory. |
|
public Provider<File> |
provideProjectDir()Like getProjectDir(), but returns a provider instead. |
|
public Provider<java.util.Properties> |
providePropertiesFromResource(String resourcePath)Lazy-load properties from a resource file. |
|
public Provider<java.util.Properties> |
providePropertiesFromResource(String resourcePath, ClassLoader classLoader)Lazy-load properties from a resource file. |
|
public Provider<File> |
provideRootDir()The root directory of the project. |
|
public String |
relativePath(Object f)Returns the relative path from the project directory to the given path. |
|
public String |
relativePathNotEmpty(Object f)Returns a relative path from the project directory to the given path. |
|
public String |
relativePathToProjectDir(Object f)Returns the relative path from the given path to the project directory. |
|
public String |
relativePathToRootDir(Object f)Returns the relative path from the given path to the root project directory. |
|
public String |
relativeRootPath(Object f)Returns the relative path from the root project directory to the given path. |
|
public String |
relativize(File base, File target)Returns the path of one File relative to another. |
|
public String |
relativize(java.nio.file.Path base, java.nio.file.Path target)Returns the path of one Path relative to another. |
|
public FileTree |
resolveFilesFromCopySpec(CopySpec copySpec)Given a {
|
|
public WorkResult |
sync(Action<? super CopySpec> action)Synchronizes the contents of a destination directory with some source directories and files. |
|
public FileTree |
tarTree(Object tarPath)Expands a tar file into a FileTree. |
|
public File |
toSafeFile(String parts)Converts a collection of String into a {@
|
|
public String |
toSafeFileName(String name)Converts a string into a string that is safe to use as a file name. |
|
public 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 |
|
public void |
updateFileProperty(Property<File> provider, Object file)Updates a Property<File>. |
|
public FileTree |
zipTree(Object zipPath)Expands a ZIP file into a FileTree. |
Safely resolve the stringy item as a path relative to the build directory.
stringy - Any item that can be resolved to a string using
org.ysb33r.grolifant5.core.api.grolifant.StringTools#stringize.Creates resource that points to a bzip2 compressed file at the given path.
file - File evaluated as per file.Copies the specified files.
action - Configures a CopySpecCopies the file at the resource path to a local file.
resourcePath - Resource path.destFile - Destination file.Creates a copy specification and configures it.
action - Configurator for copy specificationCreates a copy specification and configures it.
action - Configurator for copy specificationCreates a temporary directory with the given prefix.
Directory will be set to delete on VM exit, but consumers are allowed to delete earlier.
The directory will be created somewhere in the build directory.
prefix - Prefix for directory.Deletes the specified files.
action - Configures a DeleteSpecCreates an empty file collection.
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.
file - Potential File objectSimilar to {
null or an empty provider.file - Potential File objectnull.Obtain a file tree given a starting location
file - Starting location.
Anything convertible with file will do.Converts a file-like objects to File instances with project context.
Converts collections of the following recursively until it gets to a file:
CharSequence including String and GString.
file: schemes.
Collections are flattened. Null instances are not allowed.
files - Potential File objectsConverts a file-like objects to File instances with project context.
Converts collections of the following recursively until it gets to a file:
CharSequence including String and GString.
file: schemes.
Collections are flattened. Null instances are removed.
files - Potential File objectsGradle distribution home directory.
Gradle user home directory. Usually ~/.gradle on non -Windows.
Returns the project's local cache directory
Returns the project directory.
The project root dir.
Creates resource that points to a gzip compressed file at the given path.
file - File evaluated as per file.Provides a list of directories below another directory
distDir - Directorynull
supplied directory.Loads properties from a resource file.
resourcePath - Resource path.Loads properties from a resource file.
resourcePath - Resource path.classLoader - Classloader to use for loading the content.Like file, but does not immediately evaluate the passed parameter.
file - Potential File objectLike getProjectCacheDir(), but returns a provider instead.
Provides a subpath below the project's cache directory. Anything that can evaluater to a string using StringTools.
Like getProjectDir(), but returns a provider instead.
Lazy-load properties from a resource file.
resourcePath - Resource path.Lazy-load properties from a resource file.
resourcePath - Resource path.classLoader - Classloader to use for loading the resource.The root directory of the project.
Returns the relative path from the project directory to the given path.
f - Object that is resolvable to a file within project contextnull.Returns a relative path from the project directory to the given path. When the path is empty, return a dot
f - Object that is resolvable to a file within project contextnull. Will at minimum contain a dot.Returns the relative path from the given path to the project directory.
f - Object that is resolvable to a file within project contextnull.Returns the relative path from the given path to the root project directory.
f - Object that is resolvable to a file within project contextnull.Returns the relative path from the root project directory to the given path.
f - Object that is resolvable to a file within project contextnull.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 directoryGiven a {
copySpec - Input specificationSynchronizes the contents of a destination directory with some source directories and files.
action - Action to configure the CopySpec.Expands a tar file into a FileTree.
tarPath - Path to tar file.
Anything that can be converted with fileConverts 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.
name - 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 parts Updates a Property<File>.
This method deals with a wide range of possibilities and works around the limitations of
Property.set()
provider - Current providerfile - Value that should be lazy-resolved.