Package org.codehaus.groovy.ant
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, wrapperFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.tools.ant.types.PathCreates a nested<classpath>path element.org.codehaus.groovy.ant.UberCompileTask.GenStubsAdapterLazily creates the nested stub-generation adapter.org.codehaus.groovy.ant.UberCompileTask.GroovycAdapterLazily creates the nested Groovy compilation adapter.org.codehaus.groovy.ant.UberCompileTask.JavacAdapterLazily creates the nested Java compilation adapter.org.apache.tools.ant.types.PathCreates a nested<src>path element.voidexecute()Runs stub generation, Java compilation, and Groovy compilation in sequence.org.apache.tools.ant.types.PathReturns the configured shared compilation classpath.org.apache.tools.ant.types.PathReturns the configured source roots.voidsetClasspath(org.apache.tools.ant.types.Path path) Adds entries to the shared compilation classpath.voidsetClasspathRef(org.apache.tools.ant.types.Reference r) Adds a reference to a classpath defined elsewhere.voidsetDestdir(File dir) Sets the destination directory for compiled output.voidsetSrcdir(org.apache.tools.ant.types.Path dir) Adds source roots to the task.protected voidvalidate()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, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
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
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.BuildExceptionValidates 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.BuildExceptionRuns stub generation, Java compilation, and Groovy compilation in sequence.- Overrides:
executein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException- if configuration is invalid or any nested task fails
-