Class GenerateCode

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
com.axelor.gradle.tasks.GenerateCode
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.util.Configurable<org.gradle.api.Task>

public class GenerateCode extends org.gradle.api.DefaultTask
  • 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
    static final String
     
    static final String
     
    static final String
     
    static final String
     

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Executes the code generation task.
    Retrieves the input directory used for the code generation process.
    static File
    getInputMainDir(org.gradle.api.Project project)
    Retrieves the directory containing the main domain models for the given project.
    static File
    getInputTestDir(org.gradle.api.Project project)
    Retrieves the directory containing the test domain models for the given project.
    Retrieves a list of lookup files that are used during the code generation process.
    static File
    getMainJavaOutputDir(org.gradle.api.Project project)
    Retrieves the output directory of the main domain models for the given project.
    static File
    getMainResourceOutputDir(org.gradle.api.Project project)
    Retrieves the output directory of the main resources for the given project.
    Retrieves a list of output directories for the code generation process.
    static File
    getTestJavaOutputDir(org.gradle.api.Project project)
    Retrieves the output directory of the test domain models for the given project.
    Indicates whether test domain models should be used in the code generation process.
    void
    setUseTestSources(Boolean useTestSources)
    Sets whether test domain models should be used in the code generation process.

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

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

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, getConvention, notCompatibleWithConfigurationCache
  • Field Details

  • Constructor Details

    • GenerateCode

      public GenerateCode()
  • Method Details

    • getUseTestSources

      @Input public Boolean getUseTestSources()
      Indicates whether test domain models should be used in the code generation process.
      Returns:
      true if test domain models should be generated
    • setUseTestSources

      public void setUseTestSources(Boolean useTestSources)
      Sets whether test domain models should be used in the code generation process.
      Parameters:
      useTestSources - true if test domain models should be generated
    • getInputMainDir

      public static File getInputMainDir(org.gradle.api.Project project)
      Retrieves the directory containing the main domain models for the given project.
      Parameters:
      project - the project
      Returns:
      the directory containing the main domain models as a File
    • getInputTestDir

      public static File getInputTestDir(org.gradle.api.Project project)
      Retrieves the directory containing the test domain models for the given project.
      Parameters:
      project - the project
      Returns:
      the directory containing the test domain models as a File
    • getMainJavaOutputDir

      public static File getMainJavaOutputDir(org.gradle.api.Project project)
      Retrieves the output directory of the main domain models for the given project.
      Parameters:
      project - the project
      Returns:
      the output directory of the main domain models as a File
    • getTestJavaOutputDir

      public static File getTestJavaOutputDir(org.gradle.api.Project project)
      Retrieves the output directory of the test domain models for the given project.
      Parameters:
      project - the project
      Returns:
      the output directory of the test domain models as a File
    • getMainResourceOutputDir

      public static File getMainResourceOutputDir(org.gradle.api.Project project)
      Retrieves the output directory of the main resources for the given project.
      Parameters:
      project - the project
      Returns:
      the output directory of the main resources as a File
    • getLookupFiles

      @InputFiles public List<File> getLookupFiles()
      Retrieves a list of lookup files that are used during the code generation process. For test, an empty list is returned as it is not allowed to enhance test domain models from other modules or current project main domain models; otherwise, it collects the output directory of the main domain models for all axelor projects associated with the current project.

      Important: Gradle uses this method for incremental builds and configuration cache. It is not explicitly used in the code.

      Returns:
      a list of File objects representing the lookup files
    • getInputDirectory

      @InputFiles public File getInputDirectory()
      Retrieves the input directory used for the code generation process.

      Important: Gradle uses this method for incremental builds and configuration cache. It is not explicitly used in the code.

      Returns:
      a File object representing the input directory
    • getOutputDirectories

      @OutputDirectories public List<File> getOutputDirectories()
      Retrieves a list of output directories for the code generation process.

      Important: Gradle uses this method for incremental builds and configuration cache. It is not explicitly used in the code.

      Returns:
      a list of File objects representing the output directories
    • generate

      public void generate() throws IOException
      Executes the code generation task.
      Throws:
      IOException - if an error occurs during file I/O operations