Package com.mooltiverse.oss.nyx.gradle
Class ReleaseTask
- java.lang.Object
-
- org.gradle.api.internal.AbstractTask
-
- org.gradle.api.DefaultTask
-
- com.mooltiverse.oss.nyx.gradle.ReleaseTask
-
- All Implemented Interfaces:
Comparable<Task>
,org.gradle.api.internal.DynamicObjectAware
,org.gradle.api.internal.TaskInternal
,ExtensionAware
,Task
,org.gradle.util.Configurable<Task>
public class ReleaseTask extends DefaultTask
The Release lifecycle task. This task does not provide any concrete action but is used to group together all the release-related tasks so they can be invoked with just this one simple task.
-
-
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 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 ReleaseTask()
Default constructor
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static TaskProvider<ReleaseTask>
conditionallyDefine(Project project)
Registers the task into the given project if no task with the same name has already been registered.protected static void
configure(com.mooltiverse.oss.nyx.gradle.AbstractTask task)
Configures the task by setting the group name.protected static void
configure(ReleaseTask task)
Configures the task.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 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
-
conditionallyDefine
public static TaskProvider<ReleaseTask> conditionallyDefine(Project project)
Registers the task into the given project if no task with the same name has already been registered. The task is lazily registered, for deferred creation. Either way, when this method returns, a task with this name exists within the project, be it this one or another defined elsewhere (i.e. by user or other plugins).- Parameters:
project
- the project to define the task for- Returns:
- the task provider used for the deferred task instantiation or
null
if a task with the same name was already registered - See Also:
define(Project, String, Class, Action)
-
configure
protected static void configure(ReleaseTask task)
Configures the task. 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:
conditionallyDefine(Project)
,NyxPlugin.defineTasks(Project)
-
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
-
configure
protected static void configure(com.mooltiverse.oss.nyx.gradle.AbstractTask task)
Configures the task by setting the group name. All tasks invoking this method will belong to theGROUP
group (onless they override it). Child classes should invoke this method during the configuration phase.- Parameters:
task
- the task to configure
-
-