|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.ProjectComponent | +--org.apache.tools.ant.Task | +--org.apache.tools.ant.taskdefs.MatchingTask | +--org.apache.tools.ant.taskdefs.Javac
Compiles Java source files. This task can take the following arguments:
When this task executes, it will recursively scan the sourcedir and destdir looking for Java source files to compile. This task makes its compile decision based on timestamp.
Nested Class Summary | |
class |
Javac.ImplementationSpecificArgument
Adds an "compiler" attribute to Commandline$Attribute used to filter command line attributes based on the current implementation. |
Field Summary | |
protected java.io.File[] |
compileList
|
protected boolean |
failOnError
|
protected boolean |
listFiles
|
Fields inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
fileset |
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary | |
Javac()
Javac task for compilation of Java files. |
Method Summary | |
protected void |
checkParameters()
Check that all required attributes have been set and nothing silly has been entered. |
protected void |
compile()
Perform the compilation. |
Path |
createBootclasspath()
Adds a path to the bootclasspath. |
Path |
createClasspath()
Adds a path to the classpath. |
Javac.ImplementationSpecificArgument |
createCompilerArg()
Adds an implementation specific command-line argument. |
Path |
createExtdirs()
Adds a path to extdirs. |
Path |
createSourcepath()
Adds a path to sourcepath. |
Path |
createSrc()
Adds a path for source compilation. |
void |
execute()
Executes the task. |
Path |
getBootclasspath()
Gets the bootclasspath that will be used to compile the classes against. |
Path |
getClasspath()
Gets the classpath to be used for this compilation. |
java.lang.String |
getCompiler()
The implementation for this particular task. |
java.lang.String |
getCompilerVersion()
The implementation for this particular task. |
java.lang.String[] |
getCurrentCompilerArgs()
Get the additional implementation specific command line arguments. |
boolean |
getDebug()
Gets the debug flag. |
java.lang.String |
getDebugLevel()
Get the value of debugLevel. |
boolean |
getDepend()
Gets the depend flag. |
boolean |
getDeprecation()
Gets the deprecation flag. |
java.io.File |
getDestdir()
Gets the destination directory into which the java source files should be compiled. |
java.lang.String |
getEncoding()
Gets the java source file encoding name. |
java.lang.String |
getExecutable()
The value of the executable attribute, if any. |
Path |
getExtdirs()
Gets the extension directories that will be used during the compilation. |
boolean |
getFailonerror()
Gets the failonerror flag. |
java.io.File[] |
getFileList()
Gets the list of files to be compiled. |
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. |
java.lang.String |
getJavacExecutable()
The name of the javac executable to use in fork-mode. |
boolean |
getListfiles()
Get the listfiles flag. |
java.lang.String |
getMemoryInitialSize()
Gets the memoryInitialSize flag. |
java.lang.String |
getMemoryMaximumSize()
Gets the memoryMaximumSize flag. |
boolean |
getNowarn()
Should the -nowarn option be used. |
boolean |
getOptimize()
Gets the optimize flag. |
java.lang.String |
getSource()
Get the value of source. |
Path |
getSourcepath()
Gets the sourcepath to be used for this compilation. |
Path |
getSrcdir()
Gets the source dirs to find the source java files. |
protected java.lang.String |
getSystemJavac()
|
java.lang.String |
getTarget()
Gets the target VM that the classes will be compiled for. |
java.io.File |
getTempdir()
Where Ant should place temporary files. |
boolean |
getVerbose()
Gets the verbose flag. |
boolean |
isForkedJavac()
Is this a forked invocation of JDK's javac? |
protected boolean |
isJdkCompiler(java.lang.String compilerImpl)
Is the compiler implementation a jdk compiler |
protected Path |
recreateSrc()
Recreate src. |
protected void |
resetFileLists()
Clear the list of files to be compiled and copied.. |
protected void |
scanDir(java.io.File srcDir,
java.io.File destDir,
java.lang.String[] files)
Scans the directory looking for source files to be compiled. |
void |
setBootclasspath(Path bootclasspath)
Sets the bootclasspath that will be used to compile the classes against. |
void |
setBootClasspathRef(Reference r)
Adds a reference to a classpath defined elsewhere. |
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 |
setCompiler(java.lang.String compiler)
Choose the implementation for this particular task. |
void |
setDebug(boolean debug)
Indicates whether source should be compiled with debug information; defaults to off. |
void |
setDebugLevel(java.lang.String v)
Keyword list to be appended to the -g command-line switch. |
void |
setDepend(boolean depend)
Enables dependency-tracking for compilers that support this (jikes and classic). |
void |
setDeprecation(boolean deprecation)
Indicates whether source should be compiled with deprecation information; defaults to off. |
void |
setDestdir(java.io.File destDir)
Set the destination directory into which the Java source files should be compiled. |
void |
setEncoding(java.lang.String encoding)
Set the Java source file encoding name. |
void |
setExecutable(java.lang.String forkExec)
Sets the name of the javac executable. |
void |
setExtdirs(Path extdirs)
Sets the extension directories that will be used during the compilation. |
void |
setFailonerror(boolean fail)
Indicates whether the build will continue even if there are compilation errors; defaults to true. |
void |
setFork(boolean f)
If true, forks the javac compiler. |
void |
setIncludeantruntime(boolean include)
If true, includes Ant's own classpath in the classpath. |
void |
setIncludejavaruntime(boolean include)
If true, includes the Java runtime libraries in the classpath. |
void |
setListfiles(boolean list)
If true, list the source files being handed off to the compiler. |
void |
setMemoryInitialSize(java.lang.String memoryInitialSize)
The initial size of the memory for the underlying VM if javac is run externally; ignored otherwise. |
void |
setMemoryMaximumSize(java.lang.String memoryMaximumSize)
The maximum size of the memory for the underlying VM if javac is run externally; ignored otherwise. |
void |
setNowarn(boolean flag)
If true, enables the -nowarn option. |
void |
setOptimize(boolean optimize)
If true, compiles with optimization enabled. |
void |
setProceed(boolean proceed)
|
void |
setSource(java.lang.String v)
Value of the -source command-line switch; will be ignored by all implementations except modern and jikes. |
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 |
setTarget(java.lang.String target)
Sets the target VM that the classes will be compiled for. |
void |
setTempdir(java.io.File tmpDir)
Where Ant should place temporary files. |
void |
setVerbose(boolean verbose)
If true, asks the compiler for verbose output. |
Methods inherited from class org.apache.tools.ant.taskdefs.MatchingTask |
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 |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, reconfigure, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean failOnError
protected boolean listFiles
protected java.io.File[] compileList
Constructor Detail |
public Javac()
Method Detail |
public java.lang.String getDebugLevel()
public void setDebugLevel(java.lang.String v)
v
- Value to assign to debugLevel.public java.lang.String getSource()
public void setSource(java.lang.String v)
v
- Value to assign to source.public Path createSrc()
protected Path recreateSrc()
public void setSrcdir(Path srcDir)
srcDir
- the source directories as a pathpublic Path getSrcdir()
public void setDestdir(java.io.File destDir)
destDir
- the destination directorpublic java.io.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 setBootclasspath(Path bootclasspath)
bootclasspath
- a path to use as a boot class path (may be more
than one)public Path getBootclasspath()
public Path createBootclasspath()
public void setBootClasspathRef(Reference r)
r
- a reference to a classpathpublic void setExtdirs(Path extdirs)
extdirs
- a pathpublic Path getExtdirs()
public Path createExtdirs()
public 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 failoferrorpublic boolean getFailonerror()
public void setDeprecation(boolean deprecation)
deprecation
- if true turn on deprecation informationpublic boolean getDeprecation()
public void setMemoryInitialSize(java.lang.String memoryInitialSize)
memoryInitialSize
- string to pass to VMpublic java.lang.String getMemoryInitialSize()
public void setMemoryMaximumSize(java.lang.String memoryMaximumSize)
memoryMaximumSize
- string to pass to VMpublic java.lang.String getMemoryMaximumSize()
public void setEncoding(java.lang.String encoding)
encoding
- the source file encodingpublic java.lang.String getEncoding()
public void setDebug(boolean debug)
debug
- if true compile with debug informationpublic boolean getDebug()
public void setOptimize(boolean optimize)
optimize
- if true compile with optimization enabledpublic boolean getOptimize()
public void setDepend(boolean depend)
depend
- if true enable dependency-trackingpublic boolean getDepend()
public void setVerbose(boolean verbose)
verbose
- if true, asks the compiler for verbose outputpublic boolean getVerbose()
public void setTarget(java.lang.String target)
target
- the target VMpublic java.lang.String getTarget()
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 setExecutable(java.lang.String forkExec)
Ignored unless fork is true or extJavac has been specified as the compiler.
forkExec
- the name of the executablepublic java.lang.String getExecutable()
public boolean isForkedJavac()
public java.lang.String getJavacExecutable()
This is either the name specified with the executable attribute or the full path of the javac compiler of the VM Ant is currently running in - guessed by Ant.
You should not invoke this method if you
want to get the value of the executable command - use getExecutable
for this.
public void setNowarn(boolean flag)
flag
- if true, enable the -nowarn optionpublic boolean getNowarn()
public Javac.ImplementationSpecificArgument createCompilerArg()
public java.lang.String[] getCurrentCompilerArgs()
public void setTempdir(java.io.File tmpDir)
tmpDir
- the temporary directorypublic java.io.File getTempdir()
public void execute() throws BuildException
execute
in class Task
BuildException
- if an error occursprotected void resetFileLists()
protected void scanDir(java.io.File srcDir, java.io.File destDir, java.lang.String[] files)
srcDir
- The source directorydestDir
- The destination directoryfiles
- An array of filenamespublic java.io.File[] getFileList()
protected boolean isJdkCompiler(java.lang.String compilerImpl)
compilerImpl
- the name of the compiler implementation
protected java.lang.String getSystemJavac()
public void setCompiler(java.lang.String compiler)
compiler
- the name of the compilerpublic java.lang.String getCompiler()
Defaults to the build.compiler property but can be overridden via the compiler and fork attributes.
If fork has been set to true, the result will be extJavac and not classic or java1.2 - no matter what the compiler attribute looks like.
getCompilerVersion()
public java.lang.String getCompilerVersion()
Defaults to the build.compiler property but can be overridden via the compiler attribute.
This method does not take the fork attribute into account.
getCompiler()
protected void checkParameters() throws BuildException
BuildException
- if an error occursprotected void compile()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |