Class UberCompileTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.codehaus.groovy.ant.UberCompileTask
All Implemented Interfaces:
Cloneable

public class UberCompileTask extends org.apache.tools.ant.Task
Compiles Java and Groovy source files. This works by invoking the GenerateStubsTask task, then the Javac task and then the GroovycTask. Each task can be configured by creating a nested element. Common configuration such as the source dir and classpath is picked up from this task's configuration.
  • Field Summary

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.tools.ant.types.Path
    Creates a nested <classpath> path element.
    org.codehaus.groovy.ant.UberCompileTask.GenStubsAdapter
    Lazily creates the nested stub-generation adapter.
    org.codehaus.groovy.ant.UberCompileTask.GroovycAdapter
    Lazily creates the nested Groovy compilation adapter.
    org.codehaus.groovy.ant.UberCompileTask.JavacAdapter
    Lazily creates the nested Java compilation adapter.
    org.apache.tools.ant.types.Path
    Creates a nested <src> path element.
    void
    Runs stub generation, Java compilation, and Groovy compilation in sequence.
    org.apache.tools.ant.types.Path
    Returns the configured shared compilation classpath.
    org.apache.tools.ant.types.Path
    Returns the configured source roots.
    void
    setClasspath(org.apache.tools.ant.types.Path path)
    Adds entries to the shared compilation classpath.
    void
    setClasspathRef(org.apache.tools.ant.types.Reference r)
    Adds a reference to a classpath defined elsewhere.
    void
    Sets the destination directory for compiled output.
    void
    setSrcdir(org.apache.tools.ant.types.Path dir)
    Adds source roots to the task.
    protected void
    Validates the task configuration before running the nested compilers.

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • UberCompileTask

      public UberCompileTask()
  • Method Details

    • createSrc

      public org.apache.tools.ant.types.Path createSrc()
      Creates a nested <src> path element.
      Returns:
      the path element to configure
    • setSrcdir

      public void setSrcdir(org.apache.tools.ant.types.Path dir)
      Adds source roots to the task.
      Parameters:
      dir - the source path to append
    • getSrcdir

      public org.apache.tools.ant.types.Path getSrcdir()
      Returns the configured source roots.
      Returns:
      the source path
    • setDestdir

      public void setDestdir(File dir)
      Sets the destination directory for compiled output.
      Parameters:
      dir - the destination directory
    • setClasspath

      public void setClasspath(org.apache.tools.ant.types.Path path)
      Adds entries to the shared compilation classpath.
      Parameters:
      path - the classpath entries to append
    • getClasspath

      public org.apache.tools.ant.types.Path getClasspath()
      Returns the configured shared compilation classpath.
      Returns:
      the classpath
    • createClasspath

      public org.apache.tools.ant.types.Path createClasspath()
      Creates a nested <classpath> path element.
      Returns:
      the path element to configure
    • setClasspathRef

      public void setClasspathRef(org.apache.tools.ant.types.Reference r)
      Adds a reference to a classpath defined elsewhere.
      Parameters:
      r - the classpath reference
    • createGeneratestubs

      public org.codehaus.groovy.ant.UberCompileTask.GenStubsAdapter createGeneratestubs()
      Lazily creates the nested stub-generation adapter.
      Returns:
      the adapter used to configure stub generation
    • createGroovyc

      public org.codehaus.groovy.ant.UberCompileTask.GroovycAdapter createGroovyc()
      Lazily creates the nested Groovy compilation adapter.
      Returns:
      the adapter used to configure Groovy compilation
    • createJavac

      public org.codehaus.groovy.ant.UberCompileTask.JavacAdapter createJavac()
      Lazily creates the nested Java compilation adapter.
      Returns:
      the adapter used to configure Java compilation
    • validate

      protected void validate() throws org.apache.tools.ant.BuildException
      Validates the task configuration before running the nested compilers.
      Throws:
      org.apache.tools.ant.BuildException - if required attributes are missing or invalid
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Runs stub generation, Java compilation, and Groovy compilation in sequence.
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException - if configuration is invalid or any nested task fails