Class GeneratorTask<T>

  • Type Parameters:
    T - The domain object for the configuration file.
    All Implemented Interfaces:
    java.lang.Comparable<Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, Named, ExtensionAware, Task, Configurable<Task>
    Direct Known Subclasses:
    GenerateSolutionFileTask, PropertiesGeneratorTask, PropertyListGeneratorTask, XmlGeneratorTask

    @DisableCachingByDefault(because="Abstract super-class, not to be instantiated directly")
    public abstract class GeneratorTask<T>
    extends org.gradle.api.internal.ConventionTask

    A GeneratorTask generates a configuration file based on a domain object of type T. When executed the task:

    • loads the object from the input file, if it exists.
    • Calls the beforeConfigured actions, passing the object to each action.
    • Configures the object in some task-specific way.
    • Calls the afterConfigured actions, passing the object to each action.
    • writes the object to the output file.
    • Field Detail

      • beforeConfigured

        protected final org.gradle.internal.MutableActionSet<T> beforeConfigured
      • afterConfigured

        protected final org.gradle.internal.MutableActionSet<T> afterConfigured
      • generator

        protected org.gradle.plugins.ide.internal.generator.generator.Generator<T> generator
      • domainObject

        protected T domainObject
    • Constructor Detail

      • GeneratorTask

        public GeneratorTask()
    • Method Detail

      • getIncremental

        @Internal
        protected boolean getIncremental()
        Whether this generator task can be treated as an incremental task or not
        Since:
        4.7
      • getInstantiator

        @Inject
        protected org.gradle.internal.reflect.Instantiator getInstantiator()
      • getInputFile

        @Internal("Covered by inputFileIfExists")
        public java.io.File getInputFile()
        The input file to load the initial configuration from. Defaults to the output file. If the specified input file does not exist, this task uses some default initial configuration.
        Returns:
        The input file.
      • setInputFile

        public void setInputFile​(@Nullable
                                 java.io.File inputFile)
        Sets the input file to load the initial configuration from.
        Parameters:
        inputFile - The input file. Use null to use the output file.
      • getOutputFile

        @OutputFile
        public java.io.File getOutputFile()
        The output file to write the final configuration to.
        Returns:
        The output file.
      • setOutputFile

        public void setOutputFile​(java.io.File outputFile)
        Sets the output file to write the final configuration to.
        Parameters:
        outputFile - The output file.