org.apache.tools.ant.taskdefs.compilers

Class DefaultCompilerAdapter

public abstract class DefaultCompilerAdapter extends Object implements CompilerAdapter

This is the default implementation for the CompilerAdapter interface. Currently, this is a cut-and-paste of the original javac task.

Since: Ant 1.3

Field Summary
protected Javacattributes
protected Pathbootclasspath
protected PathcompileClasspath
protected File[]compileList
protected PathcompileSourcepath
protected booleandebug
protected booleandepend
protected booleandeprecation
protected FiledestDir
protected Stringencoding
protected Pathextdirs
protected booleanincludeAntRuntime
protected booleanincludeJavaRuntime
protected Locationlocation
protected static StringlSep
protected StringmemoryInitialSize
protected StringmemoryMaximumSize
protected booleanoptimize
protected Projectproject
protected Pathsrc
protected Stringtarget
protected booleanverbose
Method Summary
protected voidaddCurrentCompilerArgs(Commandline cmd)
Adds the command line arguments specific to the current implementation.
protected voidaddExtdirsToClasspath(Path classpath)
protected booleanassumeJava11()
Shall we assume JDK 1.1 command line switches?
protected booleanassumeJava12()
Shall we assume JDK 1.2 command line switches?
protected booleanassumeJava13()
Shall we assume JDK 1.3 command line switches?
protected booleanassumeJava14()
Shall we assume JDK 1.4 command line switches?
protected booleanassumeJava15()
Shall we assume JDK 1.5 command line switches?
protected intexecuteExternalCompile(String[] args, int firstFileName)
Do the compile with the specified arguments.
protected intexecuteExternalCompile(String[] args, int firstFileName, boolean quoteFiles)
Do the compile with the specified arguments.
protected PathgetCompileClasspath()
Builds the compilation classpath.
JavacgetJavac()
Get the Javac task instance associated with this compiler adapter
protected StringgetNoDebugArgument()
The argument the compiler wants to see if the debug attribute has been set to false.
protected ProjectgetProject()
protected voidlogAndAddFilesToCompile(Commandline cmd)
Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"
voidsetJavac(Javac attributes)
Set the Javac instance which contains the configured compilation attributes.
protected CommandlinesetupJavacCommand()
protected CommandlinesetupJavacCommand(boolean debugLevelCheck)
Does the command line argument processing for classic and adds the files to compile as well.
protected CommandlinesetupJavacCommandlineSwitches(Commandline cmd)
protected CommandlinesetupJavacCommandlineSwitches(Commandline cmd, boolean useDebugLevel)
Does the command line argument processing common to classic and modern.
protected CommandlinesetupModernJavacCommand()
Does the command line argument processing for modern and adds the files to compile as well.
protected CommandlinesetupModernJavacCommandlineSwitches(Commandline cmd)
Does the command line argument processing for modern.

Field Detail

attributes

protected Javac attributes

bootclasspath

protected Path bootclasspath

compileClasspath

protected Path compileClasspath

compileList

protected File[] compileList

compileSourcepath

protected Path compileSourcepath

debug

protected boolean debug

depend

protected boolean depend

deprecation

protected boolean deprecation

destDir

protected File destDir

encoding

protected String encoding

extdirs

protected Path extdirs

includeAntRuntime

protected boolean includeAntRuntime

includeJavaRuntime

protected boolean includeJavaRuntime

location

protected Location location

lSep

protected static final String lSep

memoryInitialSize

protected String memoryInitialSize

memoryMaximumSize

protected String memoryMaximumSize

optimize

protected boolean optimize

project

protected Project project

src

protected Path src

target

protected String target

verbose

protected boolean verbose

Method Detail

addCurrentCompilerArgs

protected void addCurrentCompilerArgs(Commandline cmd)
Adds the command line arguments specific to the current implementation.

addExtdirsToClasspath

protected void addExtdirsToClasspath(Path classpath)

Deprecated: use org.apache.tools.ant.types.Path#addExtdirs instead

assumeJava11

protected boolean assumeJava11()
Shall we assume JDK 1.1 command line switches?

Since: Ant 1.5

assumeJava12

protected boolean assumeJava12()
Shall we assume JDK 1.2 command line switches?

Since: Ant 1.5

assumeJava13

protected boolean assumeJava13()
Shall we assume JDK 1.3 command line switches?

Since: Ant 1.5

assumeJava14

protected boolean assumeJava14()
Shall we assume JDK 1.4 command line switches?

Since: Ant 1.6.3

assumeJava15

protected boolean assumeJava15()
Shall we assume JDK 1.5 command line switches?

Returns: true if JDK 1.5

Since: Ant 1.6.3

executeExternalCompile

protected int executeExternalCompile(String[] args, int firstFileName)
Do the compile with the specified arguments.

Parameters: args - arguments to pass to process on command line firstFileName - index of the first source file in args, if the index is negative, no temporary file will ever be created, but this may hit the command line length limit on your system.

executeExternalCompile

protected int executeExternalCompile(String[] args, int firstFileName, boolean quoteFiles)
Do the compile with the specified arguments.

Parameters: args - arguments to pass to process on command line firstFileName - index of the first source file in args, if the index is negative, no temporary file will ever be created, but this may hit the command line length limit on your system. quoteFiles - if set to true, filenames containing spaces will be quoted when they appear in the external file. This is necessary when running JDK 1.4's javac and probably others.

Since: Ant 1.6

getCompileClasspath

protected Path getCompileClasspath()
Builds the compilation classpath.

getJavac

public Javac getJavac()
Get the Javac task instance associated with this compiler adapter

Returns: the configured Javac task instance used by this adapter.

getNoDebugArgument

protected String getNoDebugArgument()
The argument the compiler wants to see if the debug attribute has been set to false.

A return value of null means no argument at all.

Returns: "-g:none" unless we expect to invoke a JDK 1.1 compiler.

Since: Ant 1.6.3

getProject

protected Project getProject()

Since: Ant 1.6

logAndAddFilesToCompile

protected void logAndAddFilesToCompile(Commandline cmd)
Logs the compilation parameters, adds the files to compile and logs the "niceSourceList"

setJavac

public void setJavac(Javac attributes)
Set the Javac instance which contains the configured compilation attributes.

Parameters: attributes a configured Javac task.

setupJavacCommand

protected Commandline setupJavacCommand()

setupJavacCommand

protected Commandline setupJavacCommand(boolean debugLevelCheck)
Does the command line argument processing for classic and adds the files to compile as well.

setupJavacCommandlineSwitches

protected Commandline setupJavacCommandlineSwitches(Commandline cmd)

setupJavacCommandlineSwitches

protected Commandline setupJavacCommandlineSwitches(Commandline cmd, boolean useDebugLevel)
Does the command line argument processing common to classic and modern. Doesn't add the files to compile.

setupModernJavacCommand

protected Commandline setupModernJavacCommand()
Does the command line argument processing for modern and adds the files to compile as well.

setupModernJavacCommandlineSwitches

protected Commandline setupModernJavacCommandlineSwitches(Commandline cmd)
Does the command line argument processing for modern. Doesn't add the files to compile.
Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.