public class Groovyc extends MatchingTask
When this task executes, it will recursively scan srcdir and destdir looking for Groovy source files to compile. This task makes its compile decision based on timestamp.
Based heavily on the Javac implementation in Ant.
Modifier and Type | Field and Description |
---|---|
protected File[] |
compileList |
protected CompilerConfiguration |
configuration |
protected boolean |
failOnError |
protected boolean |
listFiles |
fileset
description, location, project
Constructor and Description |
---|
Groovyc() |
Modifier and Type | Method and Description |
---|---|
void |
addConfiguredJavac(Javac javac)
Add the configured nested javac task if present to initiate joint compilation.
|
protected void |
addToCompileList(File[] newFiles) |
protected GroovyClassLoader |
buildClassLoaderFor() |
protected void |
checkParameters() |
protected void |
compile() |
Path |
createClasspath()
Adds a path to the classpath.
|
Path |
createSourcepath()
Adds a path to sourcepath.
|
Path |
createSrc()
Adds a path for source compilation.
|
void |
execute()
Executes the task.
|
Path |
getClasspath()
Gets the classpath to be used for this compilation.
|
String |
getConfigscript()
Get the configuration file used to customize the compilation configuration.
|
File |
getDestdir()
Gets the destination directory into which the java source files
should be compiled.
|
String |
getEncoding()
Returns the encoding to be used when creating files.
|
String |
getExecutable()
The value of the executable attribute, if any.
|
boolean |
getFailonerror()
Gets the failonerror flag.
|
File[] |
getFileList()
Gets the list of files to be compiled.
|
boolean |
getForceLookupUnnamedFiles()
Gets the forceLookupUnnamedFiles flag.
|
boolean |
getIncludeantruntime()
Gets whether or not the ant classpath is to be included in the classpath.
|
boolean |
getIncludejavaruntime()
Gets whether or not the java runtime should be included in this
task's classpath.
|
boolean |
getIndy()
Get the value of the indy flag.
|
boolean |
getKeepStubs()
Gets the keepStubs flag.
|
boolean |
getListfiles()
Get the listfiles flag.
|
String |
getMemoryInitialSize()
Gets the memoryInitialSize flag.
|
String |
getMemoryMaximumSize()
Gets the memoryMaximumSize flag.
|
String |
getScriptBaseClass()
Get the base script class name for the scripts (must derive from Script)
|
String |
getScriptExtension()
Get the extension to use when searching for Groovy source files.
|
Path |
getSourcepath()
Gets the sourcepath to be used for this compilation.
|
Path |
getSrcdir()
Gets the source dirs to find the source java files.
|
File |
getStubdir()
Gets the stub directory into which the Java source stub
files should be generated
|
String |
getTargetBytecode()
Retrieves the compiler bytecode compatibility mode.
|
boolean |
getTaskSuccess()
Get the result of the groovyc task (success or failure).
|
boolean |
getVerbose()
Gets the verbose flag.
|
boolean |
isIncludeDestClasses()
Get the value of the includeDestClasses property.
|
protected CompilationUnit |
makeCompileUnit() |
protected Path |
recreateSrc()
Recreate src.
|
protected void |
resetFileLists()
Clear the list of files to be compiled and copied.
|
protected void |
scanDir(File srcDir,
File destDir,
String[] files)
Scans the directory looking for source files to be compiled.
|
void |
setClasspath(Path classpath)
Set the classpath to be used for this compilation.
|
void |
setClasspathRef(Reference r)
Adds a reference to a classpath defined elsewhere.
|
void |
setConfigscript(String configscript)
Set the configuration file used to customize the compilation configuration.
|
void |
setDestdir(File destDir)
Set the destination directory into which the Java source
files should be compiled.
|
void |
setEncoding(String encoding)
Sets the file encoding for generated files.
|
void |
setErrorProperty(String errorProperty)
The property to set on compilation failure.
|
void |
setExecutable(String forkExecPath)
Sets the name of the java executable to use when
invoking the compiler in forked mode, ignored otherwise.
|
void |
setFailonerror(boolean fail)
Indicates whether the build will continue
even if there are compilation errors; defaults to true.
|
void |
setForceLookupUnnamedFiles(boolean forceLookupUnnamedFiles)
Set the forceLookupUnnamedFiles flag.
|
void |
setFork(boolean f)
If true forks the Groovy compiler.
|
void |
setIncludeantruntime(boolean include)
If true, includes Ant's own classpath in the classpath.
|
void |
setIncludeDestClasses(boolean includeDestClasses)
This property controls whether to include the
destination classes directory in the classpath
given to the compiler.
|
void |
setIncludejavaruntime(boolean include)
If true, includes the Java runtime libraries in the classpath.
|
void |
setIndy(boolean useIndy)
Set the indy flag.
|
void |
setJavaHome(File home)
The JDK Home to use when forked.
|
void |
setKeepStubs(boolean keepStubs)
Set the keepStubs flag.
|
void |
setListfiles(boolean list)
If true, list the source files being handed off to the compiler.
|
void |
setMemoryInitialSize(String memoryInitialSize)
The initial size of the memory for the underlying VM
if javac is run externally; ignored otherwise.
|
void |
setMemoryMaximumSize(String memoryMaximumSize)
The maximum size of the memory for the underlying VM
if javac is run externally; ignored otherwise.
|
void |
setProceed(boolean proceed) |
void |
setScriptBaseClass(String scriptBaseClass)
Set the base script class name for the scripts (must derive from Script)
|
void |
setScriptExtension(String scriptExtension)
Set the extension to use when searching for Groovy source files.
|
void |
setSourcepath(Path sourcepath)
Set the sourcepath to be used for this compilation.
|
void |
setSourcepathRef(Reference r)
Adds a reference to a source path defined elsewhere.
|
void |
setSrcdir(Path srcDir)
Set the source directories to find the source Java files.
|
void |
setStacktrace(boolean stacktrace)
Enable compiler to report stack trace information if a problem occurs
during compilation.
|
void |
setStubdir(File stubDir)
Set the stub directory into which the Java source stub
files should be generated.
|
void |
setTargetBytecode(String version)
Sets the bytecode compatibility mode
|
void |
setUpdatedProperty(String updatedProperty)
The property to set on compilation success.
|
void |
setVerbose(boolean verbose)
Enable verbose compiling which will display which files
are being compiled.
|
add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDirectoryScanner, getImplicitFileSet, getSelectors, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFollowSymlinks, setIncludes, setIncludesfile, setProject, XsetIgnore, XsetItems
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
clone, getDescription, getLocation, getProject, setDescription, setLocation
protected boolean failOnError
protected boolean listFiles
protected File[] compileList
protected CompilerConfiguration configuration
public Path createSrc()
protected Path recreateSrc()
public void setSrcdir(Path srcDir)
srcDir
- the source directories as a pathpublic Path getSrcdir()
public void setScriptExtension(String scriptExtension)
scriptExtension
- the extension of Groovy source filespublic String getScriptExtension()
public void setTargetBytecode(String version)
version
- the bytecode compatibility modepublic String getTargetBytecode()
public void setDestdir(File destDir)
destDir
- the destination directorpublic File getDestdir()
public void setSourcepath(Path sourcepath)
sourcepath
- the source pathpublic Path getSourcepath()
public Path createSourcepath()
public void setSourcepathRef(Reference r)
r
- a reference to a source pathpublic void setClasspath(Path classpath)
classpath
- an Ant Path object containing the compilation classpath.public Path getClasspath()
public Path createClasspath()
public void setClasspathRef(Reference r)
r
- a reference to a classpathpublic void setListfiles(boolean list)
list
- if true list the source filespublic boolean getListfiles()
public void setFailonerror(boolean fail)
fail
- if true halt the build on failurepublic void setProceed(boolean proceed)
proceed
- inverse of failonerrorpublic boolean getFailonerror()
public void setMemoryInitialSize(String memoryInitialSize)
memoryInitialSize
- string to pass to VMpublic String getMemoryInitialSize()
public void setMemoryMaximumSize(String memoryMaximumSize)
memoryMaximumSize
- string to pass to VMpublic String getMemoryMaximumSize()
public void setEncoding(String encoding)
encoding
- the file encoding to be usedpublic String getEncoding()
public void setVerbose(boolean verbose)
public boolean getVerbose()
public void setIncludeantruntime(boolean include)
include
- if true, includes Ant's own classpath in the classpathpublic boolean getIncludeantruntime()
public void setIncludejavaruntime(boolean include)
include
- if true, includes the Java runtime libraries in the classpathpublic boolean getIncludejavaruntime()
public void setFork(boolean f)
f
- "true|false|on|off|yes|no"public void setJavaHome(File home)
home
- the java.home value to use, default is the current JDK's homepublic void setExecutable(String forkExecPath)
forkExecPath
- the name of the executablepublic String getExecutable()
public void setUpdatedProperty(String updatedProperty)
updatedProperty
- the property name to use.public void setErrorProperty(String errorProperty)
errorProperty
- the property name to use.public void setIncludeDestClasses(boolean includeDestClasses)
includeDestClasses
- the value to use.public boolean isIncludeDestClasses()
public boolean getTaskSuccess()
public void addConfiguredJavac(Javac javac)
public void setStacktrace(boolean stacktrace)
public void setIndy(boolean useIndy)
useIndy
- the indy flagpublic boolean getIndy()
public void setScriptBaseClass(String scriptBaseClass)
scriptBaseClass
- Base class name for scripts (must derive from Script)public String getScriptBaseClass()
public String getConfigscript()
public void setConfigscript(String configscript)
configscript
- a path to a configuration scriptpublic void setStubdir(File stubDir)
stubDir
- the stub directorypublic File getStubdir()
public void setKeepStubs(boolean keepStubs)
keepStubs
- should stubs be retainedpublic boolean getKeepStubs()
public void setForceLookupUnnamedFiles(boolean forceLookupUnnamedFiles)
true
.forceLookupUnnamedFiles
- should unnamed source files be searched for on the classpathpublic boolean getForceLookupUnnamedFiles()
public void execute() throws BuildException
execute
in class Task
BuildException
- if an error occursprotected void resetFileLists()
protected void scanDir(File srcDir, File destDir, String[] files)
srcDir
- The source directorydestDir
- The destination directoryfiles
- An array of filenamesprotected void addToCompileList(File[] newFiles)
public File[] getFileList()
protected void checkParameters() throws BuildException
BuildException
protected void compile()
protected CompilationUnit makeCompileUnit()
protected GroovyClassLoader buildClassLoaderFor()