Package: org.codehaus.groovy.ant

## [Java] Class CompileTaskSupport

- org.codehaus.groovy.ant.CompileTaskSupport

-     public abstract class CompileTaskSupport
      extends MatchingTask

  Support for compilation related tasks.

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `protected Path` | `classpath` | Compilation classpath.
    `protected CompilerConfiguration` | `config` | Compiler configuration shared with the concrete task implementation.
    `protected File` | `destdir` | Destination directory for generated output.
    `protected boolean` | `failOnError` | Whether task failures should stop the Ant build.
    `protected LoggingHelper` | `log` | Logger used by subclasses to report task progress.
    `protected Path` | `src` | Source roots to scan for compilation inputs.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected abstract void` | `compile()` Performs the concrete compilation work for the task.
    `` | `protected GroovyClassLoader` | `createClassLoader()` Creates a class loader for the current compiler configuration and classpath.
    `` | `public Path` | `createClasspath()` Creates a nested `<classpath>` path element.
    `` | `public CompilerConfiguration` | `createConfiguration()` Returns the mutable compiler configuration used by this task.
    `` | `public Path` | `createSrc()` Creates a nested `<src>` path element.
    `` | `public void` | `execute()` Validates the task and delegates to compile().
    `` | `public Path` | `getClasspath()` Returns the configured compilation classpath.
    `` | `public boolean` | `getFailonerror()` Indicates whether compilation errors fail the Ant build.
    `` | `public Path` | `getSrcdir()` Returns the configured source roots.
    `` | `protected void` | `handleException(Exception e)` Converts a compilation failure into the Ant task's configured error handling.
    `` | `public void` | `setClasspath(Path path)` Adds entries to the compilation classpath.
    `` | `public void` | `setClasspathRef(Reference r)` Adds a reference to a classpath defined elsewhere.
    `` | `public void` | `setDestdir(File dir)` Sets the output directory for generated classes or stubs.
    `` | `public void` | `setFailonerror(boolean fail)` Controls whether compilation errors should fail the Ant build.
    `` | `public void` | `setSrcdir(Path dir)` Adds source roots to the task.
    `` | `protected void` | `validate()` Validates the task configuration before compilation starts.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class MatchingTask` | `XsetIgnore, XsetItems, add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, bindToOwner, clone, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, equals, execute, getClass, getDescription, getLocation, getOwningTarget, getProject, getRuntimeConfigurableWrapper, getSelectors, getTaskName, getTaskType, hasSelectors, hashCode, init, log, log, log, log, maybeConfigure, notify, notifyAll, perform, reconfigure, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setDescription, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setLocation, setOwningTarget, setProject, setRuntimeConfigurableWrapper, setTaskName, setTaskType, toString, wait, wait, wait`

- - ### Field Detail

    - #### protected Path classpath

      Compilation classpath.

    - #### protected CompilerConfiguration config

      Compiler configuration shared with the concrete task implementation.

    - #### protected File destdir

      Destination directory for generated output.

    - #### protected boolean failOnError

      Whether task failures should stop the Ant build.

    - #### protected final LoggingHelper log

      Logger used by subclasses to report task progress.

    - #### protected Path src

      Source roots to scan for compilation inputs.

  - ### Method Detail

    - #### protected abstract void compile()

      Performs the concrete compilation work for the task.

      throws:
        Exception if compilation fails

    - #### protected GroovyClassLoader createClassLoader()

      Creates a class loader for the current compiler configuration and classpath.

      Returns:
        the class loader to use during compilation

    - #### public Path createClasspath()

      Creates a nested `<classpath>` path element.

      Returns:
        the path element to configure

    - #### public CompilerConfiguration createConfiguration()

      Returns the mutable compiler configuration used by this task.

      Returns:
        the compiler configuration

    - #### public Path createSrc()

      Creates a nested `<src>` path element.

      Returns:
        the path element to configure

    - #### public void execute()

      Validates the task and delegates to compile().

      throws:
        BuildException if validation fails or compilation fails fatally

    - #### public Path getClasspath()

      Returns the configured compilation classpath.

      Returns:
        the compilation classpath

    - #### public boolean getFailonerror()

      Indicates whether compilation errors fail the Ant build.

      Returns:
        `true` if failures abort the build

    - #### public Path getSrcdir()

      Returns the configured source roots.

      Returns:
        the source path

    - #### protected void handleException(Exception e)

      Converts a compilation failure into the Ant task's configured error handling.

      throws:
        BuildException if failures should abort the build
      Parameters:
        `e` - the exception raised by compilation

    - #### public void setClasspath(Path path)

      Adds entries to the compilation classpath.

      Parameters:
        `path` - the classpath entries to append

    - #### public void setClasspathRef(Reference r)

      Adds a reference to a classpath defined elsewhere.

      Parameters:
        `r` - the classpath reference

    - #### public void setDestdir(File dir)

      Sets the output directory for generated classes or stubs.

      Parameters:
        `dir` - the destination directory

    - #### public void setFailonerror(boolean fail)

      Controls whether compilation errors should fail the Ant build.

      Parameters:
        `fail` - `true` to fail the build on compilation errors

    - #### public void setSrcdir(Path dir)

      Adds source roots to the task.

      Parameters:
        `dir` - the source path to append

    - #### protected void validate()

      Validates the task configuration before compilation starts.

      throws:
        BuildException if required attributes are missing or invalid