Class 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
-
Field Summary
Fields Modifier and Type Field Description protected CommonExtensionextensionThis is the extension, that contains default value for the task attributesprotected java.lang.Class<? extends CommonExtension>extensionClassThis is the class of the extension, that contains default value for the task attributesjava.lang.BooleanskipGenerationIfSchemaHasNotChangedThis 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. -
Constructor Summary
Constructors Constructor Description CommonTask(java.lang.Class<? extends CommonExtension> extensionClazz) -
Method Summary
Modifier and Type Method Description protected voidaddThisTaskAsADependencyToAnotherTask(java.lang.String taskName)This method find the task(s) from the given name, and add the current task as a task that must be executed before (dependsOn) thetaskNametaskorg.gradle.api.Taskconfigure(groovy.lang.Closure closure)java.lang.StringgetDefaultTargetSchemaFileName()protected CommonExtensiongetExtension()protected java.io.FilegetFileValue(java.lang.String taskValue, java.io.File extensionValue)java.lang.IntegergetMaxTokens()java.io.FilegetProjectDir()java.io.FilegetSchemaFileFolder()java.lang.StringgetSchemaFilePattern()java.util.Map<java.lang.String,java.lang.String>getTemplates()protected <T> TgetValue(T taskValue, T extensionValue)booleanisAddRelayConnections()booleanisGenerateJacksonAnnotations()booleanisInitialized()Returns true if either this task or its extension has been initialized, that is: at least one of their setters has been called.booleanisSkipGenerationIfSchemaHasNotChanged()Deprecated.voidlogConfiguration()voidregisterGeneratedFolders()This method registers to Gradle the source and resources folders in which files are generated, if anyvoidsetAddRelayConnections(java.lang.Boolean addRelayConnections)protected voidsetInitialized(boolean initialized)When initialized is set to true, this marks this task as being configured.voidsetParserOptions(java.lang.Integer maxTokens)voidsetSchemaFileFolder(java.lang.String schemaFileFolder)voidsetSchemaFilePattern(java.lang.String schemaFilePattern)voidsetSkipGenerationIfSchemaHasNotChanged(boolean skipGenerationIfSchemaHasNotChanged)voidsetTemplates(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
-
Field Details
-
skipGenerationIfSchemaHasNotChanged
public java.lang.Boolean skipGenerationIfSchemaHasNotChangedThis 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 executed only if the provided input (GraphQL schema...) has been updated since the last plugin execution.
-
extensionClass
This is the class of the extension, that contains default value for the task attributes -
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:
isAddRelayConnectionsin interfacecom.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:
getDefaultTargetSchemaFileNamein interfacecom.graphql_java_generator.plugin.conf.CommonConfiguration
-
isInitialized
@Input public boolean isInitialized()Returns true if either this task or its extension has been initialized, that is: at least one of their setters has been called.- Returns:
- The value for initialized
-
getMaxTokens
@Input public java.lang.Integer getMaxTokens()- Specified by:
getMaxTokensin interfacecom.graphql_java_generator.plugin.conf.CommonConfiguration
-
setParserOptions
public void setParserOptions(java.lang.Integer maxTokens) -
getProjectDir
@Internal public final java.io.File getProjectDir()- Specified by:
getProjectDirin interfacecom.graphql_java_generator.plugin.conf.CommonConfiguration
-
isGenerateJacksonAnnotations
@Internal public boolean isGenerateJacksonAnnotations()- Specified by:
isGenerateJacksonAnnotationsin interfacecom.graphql_java_generator.plugin.conf.CommonConfiguration
-
isSkipGenerationIfSchemaHasNotChanged
@Input @Deprecated public final boolean isSkipGenerationIfSchemaHasNotChanged()Deprecated.- Specified by:
isSkipGenerationIfSchemaHasNotChangedin interfacecom.graphql_java_generator.plugin.conf.CommonConfiguration
-
setSkipGenerationIfSchemaHasNotChanged
public final void setSkipGenerationIfSchemaHasNotChanged(boolean skipGenerationIfSchemaHasNotChanged) -
getSchemaFileFolder
@InputDirectory @Optional public final java.io.File getSchemaFileFolder()- Specified by:
getSchemaFileFolderin interfacecom.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:
getSchemaFilePatternin interfacecom.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:
getTemplatesin interfacecom.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:
logConfigurationin interfacecom.graphql_java_generator.plugin.conf.CommonConfiguration
-
getExtension
-
registerGeneratedFolders
public void registerGeneratedFolders()This method registers to Gradle the source and resources folders in which files are generated, if any -
addThisTaskAsADependencyToAnotherTask
protected void addThisTaskAsADependencyToAnotherTask(java.lang.String taskName)This method find the task(s) from the given name, and add the current task as a task that must be executed before (dependsOn) thetaskNametask- Parameters:
taskName- The task's name
-
setInitialized
protected void setInitialized(boolean initialized)When initialized is set to true, this marks this task as being configured. So we'll mark compileJava and processResources as depending on it.- Parameters:
initialized- The new value for initialized
-
configure
public org.gradle.api.Task configure(groovy.lang.Closure closure)- Specified by:
configurein interfaceorg.gradle.util.Configurable<org.gradle.api.Task>- Specified by:
configurein interfaceorg.gradle.api.Task- Overrides:
configurein classorg.gradle.api.internal.AbstractTask
-