Class PublishTask

  • 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 PublishTask
    extends CoreTask
    The task running the Publish command by invoking the Nyx.publish() method on the backing Nyx instance.
    • Constructor Detail

      • PublishTask

        @Inject
        public PublishTask()
        Default constructor
    • Method Detail

      • define

        public static TaskProvider<PublishTask> 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​(PublishTask 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 an Action during the define(Project, String, Class, Action) phase.
        Parameters:
        task - the task to configure
        See Also:
        define(Project)
      • publish

        public void publish()
                     throws NyxException
        The actual business method for this task. This method runs the Nyx.publish() method on the shared singleton Nyx instance. Gradle knows this is the method to run upon task execution thanks to the TaskAction 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 or null 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 as TaskCollection.named(String) but in case there is no such task returns null 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 into
        name - 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 TaskTaskProvider<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 reason TaskContainer.register(String, Class, Action) is used instead of TaskContainer.create(String, Class, Action) internally.
        Type Parameters:
        T - the task class
        Parameters:
        project - the project to define the task for
        name - the name to register the task with
        type - the task class
        configurationAction - the optional action used to configure the task upon creation. It may be null
        Returns:
        the task provider used for the deferred task instantiation