Class XmlAstGradleTask

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
name.jurgenei.gradle.antlr.XmlAstGradleTask
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>

@DisableCachingByDefault(because="XmlAstGradleTask performs external parser loading and file-system driven conversion not yet declared for safe caching") public abstract class XmlAstGradleTask extends org.gradle.api.DefaultTask
Native Gradle-style task with explicit source/destination properties.

This task is intended as the primary Gradle-facing API. It supports include/exclude patterns, incremental conversion checks, configurable execution model, and explicit runtime classpath injection for configuration-cache-friendly execution. Parsing is executed through dynamically loaded ANTLR lexer/parser classes.

  • Nested Class Summary

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

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

    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
    XmlAstGradleTask(org.gradle.api.model.ObjectFactory objects)
    Creates the task and configures default conventions.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Runs conversion for all selected files from source directory to destination directory.
    org.gradle.api.provider.Property<Boolean>
    Enables periodic forced GC during long parsing runs.
    org.gradle.api.file.RegularFileProperty
    Optional XML catalog containing named grammars and parser/lexer coordinates.
    org.gradle.api.provider.Property<String>
    Grammar name to resolve from getCatalogFile().
    org.gradle.api.provider.Property<Boolean>
    Enables rule-chain compression for generated XML AST output.
    org.gradle.api.provider.Property<Boolean>
    Continue processing remaining files after per-file parse failures.
    org.gradle.api.file.DirectoryProperty
    Destination directory receiving generated XML files.
    org.gradle.api.provider.Property<Boolean>
    Enables DFA memory monitoring and logging (requires --info or --debug).
    org.gradle.api.provider.ListProperty<String>
    Ant-style exclude patterns evaluated relative to getSourceDirectory().
    org.gradle.api.provider.Property<String>
    Execution model setting retained for compatibility.
    org.gradle.api.provider.Property<Boolean>
    Global fail-fast switch aligned with Ant task semantics.
    org.gradle.api.provider.Property<Boolean>
    Transformation-specific failure switch aligned with Ant task semantics.
    org.gradle.api.provider.Property<Boolean>
    Forces conversion even when output files are newer than inputs.
    org.gradle.api.provider.Property<Integer>
    Number of completed files between forced GC cycles when aggressive GC is enabled.
    org.gradle.api.provider.Property<Integer>
    Heap-used percent threshold for aggressive GC trigger.
    org.gradle.api.provider.Property<String>
    Grammar key used by SqlXmlConverter (e.g.
    org.gradle.api.provider.ListProperty<String>
    Ant-style include patterns evaluated relative to getSourceDirectory().
    org.gradle.api.provider.Property<String>
    Optional lexer coordinate used for dynamic ANTLR parsing.
    org.gradle.api.provider.Property<Integer>
    Max worker count setting retained for compatibility.
    org.gradle.api.provider.Property<String>
    Optional parser coordinate used for dynamic ANTLR parsing.
    org.gradle.api.file.ConfigurableFileCollection
    Runtime classpath used to load converter classes and dependencies.
    org.gradle.api.file.DirectoryProperty
    Source directory scanned for input files.
    org.gradle.api.provider.Property<String>
    Parser entry rule method invoked during dynamic parsing.
    org.gradle.api.provider.Property<Boolean>
    Suppresses task failure stack traces and emits concise lifecycle diagnostics instead.
    org.gradle.api.provider.Property<String>
    Output file extension mapped from source files.

    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, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, 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, notCompatibleWithConfigurationCache
  • Constructor Details

    • XmlAstGradleTask

      @Inject public XmlAstGradleTask(org.gradle.api.model.ObjectFactory objects)
      Creates the task and configures default conventions.
      Parameters:
      objects - Gradle object factory.
  • Method Details

    • getSourceDirectory

      @InputDirectory @PathSensitive(RELATIVE) public org.gradle.api.file.DirectoryProperty getSourceDirectory()
      Source directory scanned for input files.
      Returns:
      directory property containing source files.
    • getDestinationDirectory

      @OutputDirectory public org.gradle.api.file.DirectoryProperty getDestinationDirectory()
      Destination directory receiving generated XML files.
      Returns:
      output directory property.
    • getGrammar

      @Input public org.gradle.api.provider.Property<String> getGrammar()
      Grammar key used by SqlXmlConverter (e.g. oracle, sybase, java8, antlr4).

      Retained for compatibility with existing builds and catalog metadata.

      Returns:
      grammar property.
    • getTargetExtension

      @Input public org.gradle.api.provider.Property<String> getTargetExtension()
      Output file extension mapped from source files.
      Returns:
      target extension property.
    • getParallelism

      @Input public org.gradle.api.provider.Property<Integer> getParallelism()
      Max worker count setting retained for compatibility.
      Returns:
      parallelism property.
    • getExecutionModel

      @Input public org.gradle.api.provider.Property<String> getExecutionModel()
      Execution model setting retained for compatibility.
      Returns:
      execution model property.
    • getIncludes

      @Input public org.gradle.api.provider.ListProperty<String> getIncludes()
      Ant-style include patterns evaluated relative to getSourceDirectory().
      Returns:
      include patterns property.
    • getExcludes

      @Input public org.gradle.api.provider.ListProperty<String> getExcludes()
      Ant-style exclude patterns evaluated relative to getSourceDirectory().
      Returns:
      exclude patterns property.
    • getForce

      @Input public org.gradle.api.provider.Property<Boolean> getForce()
      Forces conversion even when output files are newer than inputs.
      Returns:
      force flag property.
    • getFailOnError

      @Input public org.gradle.api.provider.Property<Boolean> getFailOnError()
      Global fail-fast switch aligned with Ant task semantics.
      Returns:
      fail-on-error property.
    • getFailOnTransformationError

      @Input public org.gradle.api.provider.Property<Boolean> getFailOnTransformationError()
      Transformation-specific failure switch aligned with Ant task semantics.
      Returns:
      fail-on-transformation-error property.
    • getContinueOnError

      @Input public org.gradle.api.provider.Property<Boolean> getContinueOnError()
      Continue processing remaining files after per-file parse failures.
      Returns:
      continue-on-error property.
    • getSuppressStackTrace

      @Input public org.gradle.api.provider.Property<Boolean> getSuppressStackTrace()
      Suppresses task failure stack traces and emits concise lifecycle diagnostics instead.
      Returns:
      suppress-stack-trace property.
    • getCatalogFile

      @Optional @InputFile @PathSensitive(RELATIVE) public org.gradle.api.file.RegularFileProperty getCatalogFile()
      Optional XML catalog containing named grammars and parser/lexer coordinates.
      Returns:
      catalog file property.
    • getCatalogGrammar

      @Optional @Input public org.gradle.api.provider.Property<String> getCatalogGrammar()
      Grammar name to resolve from getCatalogFile().
      Returns:
      catalog grammar key property.
    • getParserClassName

      @Optional @Input public org.gradle.api.provider.Property<String> getParserClassName()
      Optional parser coordinate used for dynamic ANTLR parsing.

      Supported values:

      • fully-qualified parser class name
      • grammar source coordinate (`.g4`) as local path, file URI, HTTP(S) URL, protocol-relative URL, or host/path without protocol
      Returns:
      parser class property.
    • getLexerClassName

      @Optional @Input public org.gradle.api.provider.Property<String> getLexerClassName()
      Optional lexer coordinate used for dynamic ANTLR parsing.

      Supported values mirror getParserClassName().

      Returns:
      lexer class property.
    • getStartRule

      @Input public org.gradle.api.provider.Property<String> getStartRule()
      Parser entry rule method invoked during dynamic parsing.
      Returns:
      start rule property.
    • getCompression

      @Input public org.gradle.api.provider.Property<Boolean> getCompression()
      Enables rule-chain compression for generated XML AST output.

      When enabled, single-child <rule> chains of length >= 2 are flattened, the chain head receives a pathId attribute, and a <pathIndex> section is appended to the AST root with id -> path mappings.

      Returns:
      compression flag property.
    • getEnableDFAMonitoring

      @Input public org.gradle.api.provider.Property<Boolean> getEnableDFAMonitoring()
      Enables DFA memory monitoring and logging (requires --info or --debug).

      When enabled, logs DFA clearing operations and memory heap statistics after each file is parsed (both success and failure cases).

      Returns:
      DFA monitoring flag property.
    • getAggressiveGc

      @Input public org.gradle.api.provider.Property<Boolean> getAggressiveGc()
      Enables periodic forced GC during long parsing runs.

      This is a pragmatic safety valve for extremely large conversion batches where parser memory pressure can exceed heap even in sequential mode.

      Returns:
      aggressive-GC flag property.
    • getGcEveryFiles

      @Input public org.gradle.api.provider.Property<Integer> getGcEveryFiles()
      Number of completed files between forced GC cycles when aggressive GC is enabled.
      Returns:
      files-per-gc property.
    • getGcHeapThresholdPercent

      @Input public org.gradle.api.provider.Property<Integer> getGcHeapThresholdPercent()
      Heap-used percent threshold for aggressive GC trigger.

      When aggressive GC is enabled, forced GC runs only when heap usage is at or above this percentage at the configured file interval.

      Returns:
      heap threshold percent property.
    • getRuntimeClasspath

      @Classpath public org.gradle.api.file.ConfigurableFileCollection getRuntimeClasspath()
      Runtime classpath used to load converter classes and dependencies.
      Returns:
      classpath file collection.
    • convert

      public void convert()
      Runs conversion for all selected files from source directory to destination directory.

      When force=false, files are converted only if missing or out-of-date.