Package com.mooltiverse.oss.nyx.gradle
Class CleanTask
- java.lang.Object
-
- org.gradle.api.internal.AbstractTask
-
- org.gradle.api.DefaultTask
-
- com.mooltiverse.oss.nyx.gradle.CoreTask
-
- com.mooltiverse.oss.nyx.gradle.CleanTask
-
- All Implemented Interfaces:
Comparable<Task>
,org.gradle.api.internal.DynamicObjectAware
,org.gradle.api.internal.TaskInternal
,ExtensionAware
,Task
,org.gradle.util.Configurable<Task>
public abstract class CleanTask extends CoreTask
The task running the Clean command by invoking theNyx.clean()
method on the backing Nyx instance.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.gradle.api.Task
Task.Namer
-
-
Field Summary
Fields Modifier and Type Field Description static String
DESCRIPTION
The description of the task.static String
GROUP
The group the tasks belong to.static String
NAME
The name of the task.-
Fields inherited from class com.mooltiverse.oss.nyx.gradle.CoreTask
NYX_INSTANCE_PROPERTY
-
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 Constructor Description CleanTask()
Default constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clean()
The actual business method for this task.protected static void
configure(CleanTask task)
Configures the task (group, description, dependencies, properties).static TaskProvider<CleanTask>
define(Project project)
Registers the task into the given project.protected static <T extends Task>
TaskProvider<T>define(Project project, String name, Class<T> type, Action<? super T> configurationAction)
Registers the task into the given project.protected static TaskProvider<Task>
findTask(Project project, String name)
Returns the provider for the task with the given name ornull
if no task has been registered or created with such name in the given project.-
Methods inherited from class com.mooltiverse.oss.nyx.gradle.CoreTask
configure, hasSharedProperty, nyx, retrieveExtension, retrieveExtension, retrieveSharedProperty, state, storeSharedProperty
-
Methods 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, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService
-
Methods inherited from class org.gradle.api.internal.AbstractTask
appendParallelSafeAction, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getOnlyIf, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isEnabled, isHasCustomActions, prependParallelSafeAction, setImpliesSubProjects, setLoggerMessageRewriter
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.gradle.api.Task
getConvention
-
-
-
-
Field Detail
-
DESCRIPTION
public static final String DESCRIPTION
The description of the task. This also appears in Gradle help.- See Also:
- Constant Field Values
-
NAME
public static final String NAME
The name of the task. This is the name of the task to use inside Gradle scripts.- See Also:
- Constant Field Values
-
GROUP
public static final String GROUP
The group the tasks belong to.- See Also:
- Constant Field Values
-
-
Method Detail
-
define
public static TaskProvider<CleanTask> define(Project project)
Registers the task into the given project. The task is lazily registered, for deferred creation.- Parameters:
project
- the project to define the task for- Returns:
- the task provider used for the deferred task instantiation
- See Also:
define(Project, String, Class, Action)
-
configure
protected static void configure(CleanTask task)
Configures the task (group, description, dependencies, properties). This method is lazily invoked by Gradle (only when actually needed) as its reference is passed as anAction
during thedefine(Project, String, Class, Action)
phase.- Parameters:
task
- the task to configure- See Also:
define(Project)
-
clean
public void clean() throws NyxException
The actual business method for this task. This method runs theNyx.clean()
method on the shared singleton Nyx instance. Gradle knows this is the method to run upon task execution thanks to theTaskAction
annotation.- Throws:
NyxException
- in case of any exception when invoking the backing instance
-
findTask
protected static TaskProvider<Task> findTask(Project project, String name)
Returns the provider for the task with the given name ornull
if no task has been registered or created with such name in the given project. The returned provider can also be used to set a property and is used for lazy instantiation so the task represented by the provider will only be created when it's actually needed. This is the same asTaskCollection.named(String)
but in case there is no such task returnsnull
instead of throwing an exception. For this reason this method does not trigger the creation of the task if it was only registered, according to Configuration Avoidance.- Parameters:
project
- the project to look up the task intoname
- the name of the task to look up- Returns:
- the provider for the given task or
null
if there is no such task
-
define
protected static <T extends Task> TaskProvider<T> define(Project project, String name, Class<T> type, Action<? super T> configurationAction)
Registers the task into the given project. Once the task is registered it's not yet instantiated but, instead, a provider object is returned. The provider can also be used to set properties. What's important is that the provider does not instantiate the task until it's actually needed and this prevents unnecessary load. The task is defined lazily so it will be actually created by Gradle only when needed, according to the Configuration Avoidance. For this reasonTaskContainer.register(String, Class, Action)
is used instead ofTaskContainer.create(String, Class, Action)
internally.- Type Parameters:
T
- the task class- Parameters:
project
- the project to define the task forname
- the name to register the task withtype
- the task classconfigurationAction
- the optional action used to configure the task upon creation. It may benull
- Returns:
- the task provider used for the deferred task instantiation
-
-