public interface ProjectOperations
Provides various operations which typically would require the Project or ProjectLayout instances to resolve.
Type Params | Return Type | Name and description |
---|---|---|
|
public boolean |
atConfigurationTime() Value that can be read safely at configuration time |
|
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) Performs a copy according to copy specification. |
|
public CopySpec |
copySpec() Creates an empty CopySpec. |
|
public CopySpec |
copySpec(Action<? super CopySpec> action) Creates a CopySpec which can later be used to copy files or create an archive. |
|
public static ProjectOperations |
create(Project project) |
|
public boolean |
delete(Object paths) Deletes files and directories. |
|
public WorkResult |
delete(Action<? super DeleteSpec> action) Deletes the specified files. |
|
public Provider<String> |
environmentVariable(Object name) Creates a provider to an environmental variable. |
|
public Provider<String> |
environmentVariable(Object name, boolean configurationTimeSafety) Creates a provider to an environmental variable. |
|
public ExecResult |
exec(Action<? super ExecSpec> action) Executes the specified external process. |
|
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 base) Creates a new ConfigurableFileTree. |
|
public java.util.List<File> |
fileize(Iterable<Object> files) Converts a collection of file-like objects to a list of File instances with project context. |
|
public FileCollection |
files(Object paths) |
|
public static ProjectOperations |
find(Project project) Attempts to find the extension. |
|
public Provider<File> |
getBuildDir() Provider for the build directory. |
|
public ConsoleOutput |
getConsoleOutput() Console output mode |
|
public ExecTools |
getExecTools() Tools to deal with out-of-process, non-JVM, executables. |
|
public ExtensionContainer |
getExtensions() Extensions container for the project. |
|
public FileSystemOperations |
getFsOperations() Returns an object instance for filesystem operations that deals coprrectly with the functionality of the curretn Gradle version. |
|
public String |
getFullProjectPath() Get the full project path including the root project name in case of a multi-project. |
|
public LogLevel |
getGradleLogLevel() Get the minimum log level for Gradle. |
|
public Provider<File> |
getGradleUserHomeDir() Gradle user home directory. |
|
public Provider<String> |
getGroupProvider() Lazy-evaluated project group. |
|
public JvmTools |
getJvmTools() Tools for dealing for JVM/Java operations. |
|
public File |
getProjectCacheDir() Returns the project cache directory for the given project. |
|
public File |
getProjectDir() Returns the project directory. |
|
public String |
getProjectName() The project name |
|
public String |
getProjectPath() Get project path. |
|
public File |
getProjectRootDir() Returns the root directory of the project. |
|
public ProjectTools |
getProjectTools() Tools to deal with project & configuration specifics down to Gradle 4.0. |
|
public ProviderTools |
getProviderTools() Tools to deal with provider down to Gradle 4.0. |
|
public ProviderFactory |
getProviders() A reference to the provider factory. |
|
public RepositoryTools |
getRepositoryTools() Tools for dealing with repositories. |
|
public StringTools |
getStringTools() Tools for dealing with conversions of various objects into string or lists of strings. |
|
public TaskTools |
getTasks() Utilities for working with tasks in a consistent manner across Gradle versions. |
|
public Provider<String> |
getVersionProvider() Lazy-evaluated project version. |
|
public Provider<String> |
gradleProperty(Object name) Creates a provider to a project property. |
|
public Provider<String> |
gradleProperty(Object name, boolean configurationTimeSafety) Creates a provider to a project property. |
|
public ReadableResource |
gzipResource(Object file) Creates resource that points to a gzip compressed file at the given path. |
|
public boolean |
isConfigurationCacheEnabled() Whether configuration cache is enabled for a build. |
|
public boolean |
isOffline() Whether Gradle is operating in offline mode. |
|
public boolean |
isRefreshDependencies() Whether dependencies should be refreshed. |
|
public boolean |
isRerunTasks() Whether tasks should be re-ruin |
|
public boolean |
isRoot() Whether current project is the root project. |
|
public ExecResult |
javaexec(Action<? super JavaExecSpec> action) Executes the specified external java process. |
<IN, OUT> |
public Provider<OUT> |
map(Provider<IN> base, Transformer<OUT, IN> transformer) Maps one provider to another. |
|
public static ProjectOperations |
maybeCreateExtension(Project project) |
<T> |
public Provider<T> |
provider(java.util.concurrent.Callable<? extends T> var1) Returns a provider. |
|
public String |
relativePath(Object f) Returns the relative path from the project directory to the given path. |
|
public Provider<String> |
resolveProperty(Object name) Searches by Gradle property, then system property and finally by environment variable using the PropertyResolver convention . |
|
public Provider<String> |
resolveProperty(Object name, boolean configurationTimeSafety) Searches by Gradle property, then system property and finally by environment variable using the PropertyResolver convention . |
|
public Provider<String> |
resolveProperty(Object name, Object defaultValue) Searches by Gradle property, then system property and finally by environment variable using the PropertyResolver convention . |
|
public Provider<String> |
resolveProperty(Object name, Object defaultValue, boolean configurationTimeSafety) Searches by Gradle property, then system property and finally by environment variable using the PropertyResolver convention . |
|
public void |
setVersionProvider(Object newVersion) Sets a new version for a project. |
|
public Provider<String> |
systemProperty(Object name) Creates a provider to a system property. |
|
public Provider<String> |
systemProperty(Object name, boolean configurationTimeSafety) Creates a provider to a system property. |
|
public FileTree |
tarTree(Object tarPath) Returns a TAR tree presentation |
|
public void |
updateFileProperty(Provider<File> provider, Object file) Updates a file provider. |
|
public void |
updateStringProperty(Provider<String> provider, Object str) Updates a string provider. |
|
public FileTree |
zipTree(Object zipPath) Returns a ZIP tree presentation |
Value that can be read safely at configuration time As from Gradle 8.0, methods take this as an input, will ignore this value as all providers that can be resolved at configuration-time are available.
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.grolifant.api.core.StringTools#stringize
.Creates resource that points to a bzip2 compressed file at the given path.
file
- File evaluated as per file.Performs a copy according to copy specification.
action
- Copy specificationCreates an empty CopySpec.
Creates a CopySpec which can later be used to copy files or create an archive. The given action is used to configure the CopySpec before it is returned by this method.
action
- Action to configure the CopySpecDeletes files and directories.
This will not follow symlinks. If you need to follow symlinks too use delete(Action).
paths
- Any type of object accepted by Project.filesDeletes the specified files. The given action is used to configure a DeleteSpec, which is then used to delete the files.
Example:
project.delete { delete 'somefile' followSymlinks = true }
action
- Action to configure the DeleteSpecCreates a provider to an environmental variable.
name
- Anything convertible to a stringCreates a provider to an environmental variable.
name
- Anything convertible to a stringconfigurationTimeSafety
- Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored.Executes the specified external process.
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
.Creates a new ConfigurableFileTree. The tree will have no base dir specified.
base
- Base directory for file tree,Converts a collection of file-like objects to a list of File instances with project context.
It will convert anything that the singular version of FileUtils.fileize
can do.
In addition it will recursively resolve any collections that result out of resolving the supplied items.
files
- List of object to evaluate
Creates a FileCollection containing the given files, as defined by Project#files(Object...).
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.Attempts to find the extension.
Do not call this method once the configuration phase has finished.
project
- Contextual projectProvider for the build directory.
Console output mode
Tools to deal with out-of-process, non-JVM, executables.
Extensions container for the project.
Returns an object instance for filesystem operations that deals coprrectly with the functionality of the curretn Gradle version.
Get the full project path including the root project name in case of a multi-project.
Get the minimum log level for Gradle.
Gradle user home directory. Usually ~/.gradle
on non -Windows.
Lazy-evaluated project group.
Tools for dealing for JVM/Java operations.
Returns the project cache directory for the given project.
null
.Returns the project directory.
The project name
Get project path.
Returns the root directory of the project.
Tools to deal with project & configuration specifics down to Gradle 4.0.
Tools to deal with provider down to Gradle 4.0.
A reference to the provider factory.
Tools for dealing with repositories.
Tools for dealing with conversions of various objects into string or lists of strings.
Utilities for working with tasks in a consistent manner across Gradle versions.
Lazy-evaluated project version.
Creates a provider to a project property.
name
- Anything convertible to a stringCreates a provider to a project property.
name
- Anything convertible to a stringconfigurationTimeSafety
- Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored.Creates resource that points to a gzip compressed file at the given path.
file
- File evaluated as per file.Whether configuration cache is enabled for a build.
true
is configuration cache is available and enabled.Whether Gradle is operating in offline mode.
true
if offline.Whether dependencies should be refreshed.
true
to check dependencies again.Whether tasks should be re-ruin
true
if tasks were set to be re-run.Whether current project is the root project.
true
is current project is root project.Executes the specified external java process.
Maps one provider to another. Use this method if you need to support Gradle 4.0 - 4.2 as part of compatibility.
getProviderTools().map
instead.base
- Original providertransformer
- Transforming function.Returns a provider.
var1
- Anything that adheres to a Callable including Groovy closures or Java lambdas.Returns the relative path from the project directory to the given path.
f
- Object that is resolvable to a file within project contextnull
. Searches by Gradle property, then system property and finally by environment variable using the
PropertyResolver convention
.
name
- Anything convertible to a string Searches by Gradle property, then system property and finally by environment variable using the
PropertyResolver convention
.
name
- Anything convertible to a stringconfigurationTimeSafety
- Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored. Searches by Gradle property, then system property and finally by environment variable using the
PropertyResolver convention
.
name
- Anything convertible to a stringdefaultValue
- Default value to return if the property search order does not return any value.
Can be null
. Anything convertible to a string. Searches by Gradle property, then system property and finally by environment variable using the
PropertyResolver convention
.
name
- Anything convertible to a stringdefaultValue
- Default value to return if the property search order does not return any value.
Can be null
. Anything convertible to a string.configurationTimeSafety
- Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored.Sets a new version for a project.
This creates an internal objhect that can safely be evaluated by Gradle's Project.getVersion.
newVersion
- Anything that can be converted to a string using
StringTools.Creates a provider to a system property.
name
- Anything convertible to a stringCreates a provider to a system property.
name
- Anything convertible to a stringconfigurationTimeSafety
- Whether this property can be read safely at configuration time. It is suggested
to just use atConfigurationTime for this parameter. As from Gradle 8.0
this value is ignored.Returns a TAR tree presentation
tarPath
- Path to tar fileUpdates a file provider.
Update property or otherwise the provider will be assigned a new Provider instance.
provider
- Current propertyfile
- Value that should be lazy-resolved to a file using file.Updates a string provider.
Update property or otherwise the provider will be assigned a new Provider instance.
provider
- Current propertystr
- Value that should be lazy-resolved to a string .