Package org.gradle.api.tasks
Class Delete
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.Delete
- All Implemented Interfaces:
Comparable<Task>,DeleteSpec,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.IConventionAware,org.gradle.api.internal.TaskInternal,Named,ExtensionAware,Task,Configurable<Task>
@DisableCachingByDefault(because="Deletion cannot be cached")
public abstract class Delete
extends org.gradle.api.internal.ConventionTask
implements DeleteSpec
Deletes files or directories. Example:
task makePretty(type: Delete) {
delete 'uglyFolder', 'uglyFile'
followSymlinks = true
}
Be default symlinks will not be followed when deleting files. To change this behavior, set
getFollowSymlinks() property to true. On systems that do not support symlinks,
this will have no effect.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
Named.Namer -
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclean()Adds some files to be deleted by this task.Deprecated.protected abstract org.gradle.internal.file.DeleterSpecifies whether or not symbolic links should be followed during deletion.abstract ConfigurableFileCollectionReturns the resolved set of files which will be deleted by this task.voidDeprecated.UsegetTargetFiles()property insteadvoidDeprecated.UsegetTargetFiles()property insteadvoidsetFollowSymlinks(boolean followSymlinks) Set if symlinks should be followed.Methods inherited from class org.gradle.api.internal.ConventionTask
conventionMapping, conventionMapping, getConventionMappingMethods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Constructor Details
-
Delete
public Delete()
-
-
Method Details
-
clean
- Throws:
IOException
-
getTargetFiles
Returns the resolved set of files which will be deleted by this task.- Returns:
- The files. Never returns null.
-
getFollowSymlinks
Specifies whether or not symbolic links should be followed during deletion.- Specified by:
getFollowSymlinksin interfaceDeleteSpec
-
setFollowSymlinks
public void setFollowSymlinks(boolean followSymlinks) Set if symlinks should be followed. If the platform doesn't support symlinks, then this will have no effect.- Specified by:
setFollowSymlinksin interfaceDeleteSpec- Parameters:
followSymlinks- if symlinks should be followed.
-
getIsFollowSymlinks
-
getDelete
Deprecated.UsegetTargetFiles()property insteadReturns the set of files which will be deleted by this task.- Returns:
- The files. Never returns null.
-
setDelete
Deprecated.UsegetTargetFiles()property insteadSets the files to be deleted by this task.- Parameters:
targets- A set of any type of object accepted byProject.files(Object...)- Since:
- 4.0
-
setDelete
Deprecated.UsegetTargetFiles()property insteadSets the files to be deleted by this task.- Parameters:
target- Any type of object accepted byProject.files(Object...)
-
delete
Adds some files to be deleted by this task. The given targets are evaluated as perProject.files(Object...).- Specified by:
deletein interfaceDeleteSpec- Parameters:
targets- Any type of object accepted byProject.files(Object...)
-
getDeleter
@Inject protected abstract org.gradle.internal.file.Deleter getDeleter()
-
getTargetFiles()property instead