Class CommonTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.graphql_java_generator.gradleplugin.CommonTask
All Implemented Interfaces:
com.graphql_java_generator.plugin.conf.CommonConfiguration, java.lang.Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>
Direct Known Subclasses:
GenerateCodeCommonTask, GenerateGraphQLSchemaTask

public class CommonTask
extends org.gradle.api.DefaultTask
implements com.graphql_java_generator.plugin.conf.CommonConfiguration

This class contain the parameters that are common to all Gradle Extensions for this plugin, that is the parameters that are common to all the tasks of this plugin.

This avoids to redeclare each common parameter in each Extension, including its comment. When a comment is updated, only one update is necessary, instead of updating it in each Extension.

Note: The attribute have no default values: their default values is read from the GenerateCodeCommonExtension, whose attributes can be either the default value, or a value set in the build script.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Task

    org.gradle.api.Task.Namer
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected CommonExtension extension
    This is the extension, that contains default value for the task attributes
    protected java.lang.Class<? extends CommonExtension> extensionClass
    This is the class of the extension, that contains default value for the task attributes
    java.lang.Boolean skipGenerationIfSchemaHasNotChanged
    This parameter is now deprecated: it's value used in the plugin is always true, that is: if the generated sources or resources are older than the GraphQL schema file(s), then there is no source or resource generation.

    Fields inherited from interface com.graphql_java_generator.plugin.conf.CommonConfiguration

    DEFAULT_ADD_RELAY_CONNECTIONS, DEFAULT_PACKAGE_NAME, DEFAULT_SCHEMA_FILE_FOLDER, DEFAULT_SCHEMA_FILE_PATTERN, DEFAULT_SKIP_GENERATION_IF_SCHEMA_HAS_NOT_CHANGED

    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
    CommonTask​(java.lang.Class<? extends CommonExtension> extensionClazz)  
  • Method Summary

    Modifier and Type Method Description
    org.gradle.api.Task configure​(groovy.lang.Closure closure)  
    java.lang.String getDefaultTargetSchemaFileName()  
    protected CommonExtension getExtension()  
    protected java.io.File getFileValue​(java.lang.String taskValue, java.io.File extensionValue)  
    java.io.File getProjectDir()  
    java.io.File getSchemaFileFolder()  
    java.lang.String getSchemaFilePattern()  
    java.util.Map<java.lang.String,​java.lang.String> getTemplates()  
    protected <T> T getValue​(T taskValue, T extensionValue)  
    boolean isAddRelayConnections()  
    boolean isSkipGenerationIfSchemaHasNotChanged()  
    void logConfiguration()  
    void registerGeneratedFolders()
    This method registers to Gradle the source and resources folders in which files are generated, if any
    void setAddRelayConnections​(java.lang.Boolean addRelayConnections)  
    void setSchemaFileFolder​(java.lang.String schemaFileFolder)  
    void setSchemaFilePattern​(java.lang.String schemaFilePattern)  
    void setSkipGenerationIfSchemaHasNotChanged​(boolean skipGenerationIfSchemaHasNotChanged)  
    void setTemplates​(java.util.Map<java.lang.String,​java.lang.String> templates)  

    Methods inherited from class org.gradle.api.internal.AbstractTask

    appendParallelSafeAction, compareTo, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getAsDynamicObject, getConvention, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getIdentityPath, getImpliesSubProjects, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOnlyIf, getOutputs, getPath, getProject, getRequiredServices, getServices, getSharedResources, getShouldRunAfter, getStandardOutputCapture, getState, getTaskActions, getTaskDependencies, getTaskIdentity, getTemporaryDir, getTemporaryDirFactory, getTimeout, hasProperty, hasTaskActions, injectIntoNewInstance, isEnabled, isHasCustomActions, mustRunAfter, onlyIf, onlyIf, prependParallelSafeAction, property, replaceLogger, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setImpliesSubProjects, setMustRunAfter, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, toString, usesService

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.graphql_java_generator.plugin.conf.CommonConfiguration

    logCommonConfiguration
  • Field Details

    • skipGenerationIfSchemaHasNotChanged

      public java.lang.Boolean skipGenerationIfSchemaHasNotChanged

      This parameter is now deprecated: it's value used in the plugin is always true, that is: if the generated sources or resources are older than the GraphQL schema file(s), then there is no source or resource generation. In clear, the source and resource generation is always executed only if the provided input (GraphQL schema...) has been updated since the last plugin execution.

    • extensionClass

      protected java.lang.Class<? extends CommonExtension> extensionClass
      This is the class of the extension, that contains default value for the task attributes
    • extension

      protected CommonExtension extension
      This is the extension, that contains default value for the task attributes
  • Constructor Details

  • Method Details

    • getValue

      protected <T> T getValue​(T taskValue, T extensionValue)
    • getFileValue

      protected java.io.File getFileValue​(java.lang.String taskValue, java.io.File extensionValue)
    • isAddRelayConnections

      @Input public final boolean isAddRelayConnections()
      Specified by:
      isAddRelayConnections in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setAddRelayConnections

      public final void setAddRelayConnections​(java.lang.Boolean addRelayConnections)
    • getDefaultTargetSchemaFileName

      @Internal public final java.lang.String getDefaultTargetSchemaFileName()
      Specified by:
      getDefaultTargetSchemaFileName in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • getProjectDir

      @Internal public final java.io.File getProjectDir()
      Specified by:
      getProjectDir in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • isSkipGenerationIfSchemaHasNotChanged

      @Input public final boolean isSkipGenerationIfSchemaHasNotChanged()
      Specified by:
      isSkipGenerationIfSchemaHasNotChanged in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setSkipGenerationIfSchemaHasNotChanged

      public final void setSkipGenerationIfSchemaHasNotChanged​(boolean skipGenerationIfSchemaHasNotChanged)
    • getSchemaFileFolder

      @InputDirectory @Optional public final java.io.File getSchemaFileFolder()
      Specified by:
      getSchemaFileFolder in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setSchemaFileFolder

      public final void setSchemaFileFolder​(java.lang.String schemaFileFolder)
    • getSchemaFilePattern

      @Input public final java.lang.String getSchemaFilePattern()
      Specified by:
      getSchemaFilePattern in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setSchemaFilePattern

      public final void setSchemaFilePattern​(java.lang.String schemaFilePattern)
    • getTemplates

      @Input public final java.util.Map<java.lang.String,​java.lang.String> getTemplates()
      Specified by:
      getTemplates in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • setTemplates

      public final void setTemplates​(java.util.Map<java.lang.String,​java.lang.String> templates)
    • logConfiguration

      public void logConfiguration()
      Specified by:
      logConfiguration in interface com.graphql_java_generator.plugin.conf.CommonConfiguration
    • getExtension

      @Internal protected CommonExtension getExtension()
    • registerGeneratedFolders

      public void registerGeneratedFolders()
      This method registers to Gradle the source and resources folders in which files are generated, if any
    • configure

      public org.gradle.api.Task configure​(groovy.lang.Closure closure)
      Specified by:
      configure in interface org.gradle.util.Configurable<org.gradle.api.Task>
      Specified by:
      configure in interface org.gradle.api.Task
      Overrides:
      configure in class org.gradle.api.internal.AbstractTask