Class CoreTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.mooltiverse.oss.nyx.gradle.CoreTask
All Implemented Interfaces:
Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, ExtensionAware, Task, Configurable<Task>
Direct Known Subclasses:
CleanTask, InferTask, MakeTask, MarkTask, PublishTask

public abstract class CoreTask extends DefaultTask
The abstract superclass for all Nyx core tasks. Core tasks, as opposite to LifecycleTask are those performing some concrete actions.
  • Field Details

  • Constructor Details

    • CoreTask

      public CoreTask(NyxExtension extension)
      Standard constructor.
      Parameters:
      extension - the extension object. Cannot be null.
  • Method Details

    • getExtension

      @Internal protected NyxExtension getExtension()
      Returns the instance of the extension for the task.
      Returns:
      the extension for the task
    • hasSharedProperty

      protected boolean hasSharedProperty(String name)
      Returns true if there is a project with the given name stored for the project.
      Parameters:
      name - the name of the property to look up
      Returns:
      true if there is a project with the given name stored for the project
    • storeSharedProperty

      protected void storeSharedProperty(String name, Object value)
      Stores the given value as a shared project property with the given name. The name makes the property unique within the entire project.
      Parameters:
      name - the name of the property to store
      value - the value of the property to store
    • retrieveSharedProperty

      protected Object retrieveSharedProperty(String name)
      Retrieves the shared project property with the given name. The name makes the property unique within the entire project.
      Parameters:
      name - the name of the property to retrieve
      Returns:
      the value of the shared property with the given name, if any, or null if no property with such name is available
    • nyx

      Returns a shared backing Nyx instance to be used by all tasks within the project. The returned instance is already configured with the values coming from the NyxExtension. This method also stores the instance as a shared project property so that all subsequent calls can retrieve the same instance to avoid creating multiple instances and saving configuration time. Moreover, the backing instance state object reference is stores as an extra property for use by user scripts. The instance is lazily created upon the first invocation so the Nyx instance is only created when needed.
      Returns:
      a shared backing Nyx instance to be used by all tasks within the project.
      Throws:
      DataAccessException - in case the configuration can't be loaded for some reason.
      IllegalPropertyException - in case the configuration has some illegal options.
    • state

      Returns the state of the shared backing Nyx instance.
      Returns:
      the state of the shared backing Nyx instance.
      Throws:
      DataAccessException - in case the configuration can't be loaded for some reason.
      IllegalPropertyException - in case the configuration has some illegal options.
      See Also: