org.codehaus.groovy.control
Class CompilerConfiguration

Compilation control flags and coordination stuff.

author:
Chris Poirier
author:
Jochen Theodorou
author:
Jim White
version:
$Id: CompilerConfiguration.java 9354 2007-11-21 11:41:42Z paulk $

Field Summary
 CompilerConfiguration DEFAULT
           
 String JDK5_CLASSNAME_CHECK
           
 String POST_JDK5
           
 String PRE_JDK5
           
 LinkedList classpath
           
 String currentJVMVersion
           
 boolean debug
           
 String defaultScriptExtension
           
 Map jointCompilationOptions
           
 int minimumRecompilationInterval
           
 PrintWriter output
           
 ParserPluginFactory pluginFactory
           
 boolean recompileGroovySource
           
 String scriptBaseClass
           
 String sourceEncoding
           
 String targetBytecode
           
 File targetDirectory
           
 int tolerance
           
 boolean verbose
           
 int warningLevel
           
 
Constructor Summary
CompilerConfiguration()
            Encoding for source files
CompilerConfiguration(CompilerConfiguration configuration)
            Copy constructor.
CompilerConfiguration(Properties configuration)
           
 
Method Summary
void configure(Properties configuration)
          
List getClasspath()
           Gets the classpath.
boolean getDebug()
           Returns true if debugging operation has been requested.
String getDefaultScriptExtension()
          
Map getJointCompilationOptions()
           Gets the joint compilation options for this configuration.
int getMinimumRecompilationInterval()
          
PrintWriter getOutput()
           Gets the currently configured output writer.
ParserPluginFactory getPluginFactory()
          
boolean getRecompileGroovySource()
          
String getScriptBaseClass()
           Gets the name of the base class for scripts.
String getSourceEncoding()
           Gets the currently configured source file encoding.
String getTargetBytecode()
           Retrieves the compiler bytecode compatibility mode.
File getTargetDirectory()
           Gets the target directory for writing classes.
int getTolerance()
           Returns the requested error tolerance.
static String getVMVersion()
          
boolean getVerbose()
           Returns true if verbose operation has been requested.
int getWarningLevel()
           Gets the currently configured warning level.
void setClasspath(String classpath)
           Sets the classpath.
void setClasspathList(List l)
           sets the classpath using a list of Strings
void setDebug(boolean debug)
           Turns debugging operation on or off.
void setDefaultScriptExtension(String defaultScriptExtension)
          
void setJointCompilationOptions(Map options)
           Sets the joint compilation options for this configuration.
void setMinimumRecompilationInterval(int time)
          
void setOutput(PrintWriter output)
           Sets the output writer.
void setPluginFactory(ParserPluginFactory pluginFactory)
          
void setRecompileGroovySource(boolean recompile)
          
void setScriptBaseClass(String scriptBaseClass)
           Sets the name of the base class for scripts.
void setSourceEncoding(String encoding)
           Sets the encoding to be used when reading source files.
void setTargetBytecode(String version)
           Allow setting the bytecode compatibility.
void setTargetDirectory(String directory)
           Sets the target directory.
void setTargetDirectory(File directory)
           Sets the target directory.
void setTolerance(int tolerance)
           Sets the error tolerance, which is the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted.
void setVerbose(boolean verbose)
           Turns verbose operation on or off.
void setWarningLevel(int level)
           Sets the warning level.
 

Constructor Detail

CompilerConfiguration

public CompilerConfiguration()
Encoding for source files


CompilerConfiguration

public CompilerConfiguration(CompilerConfiguration configuration)
Copy constructor. Use this if you have a mostly correct configuration for your compilation but you want to make a some changes programmatically. An important reason to prefer this approach is that your code will most likely be forward compatible with future changes to this configuration API.
An example of this copy constructor at work:
    // In all likelihood there is already a configuration in your code's context
    // for you to copy, but for the sake of this example we'll use the global default.
    CompilerConfiguration myConfiguration = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
    myConfiguration.setDebug(true);
param:
configuration The configuration to copy.


CompilerConfiguration

public CompilerConfiguration(Properties configuration)


Method Detail

configure

public void configure(Properties configuration)


getClasspath

public List getClasspath()
Gets the classpath.


getDebug

public boolean getDebug()
Returns true if debugging operation has been requested.


getDefaultScriptExtension

public String getDefaultScriptExtension()


getJointCompilationOptions

public Map getJointCompilationOptions()
Gets the joint compilation options for this configuration.
return:
the options


getMinimumRecompilationInterval

public int getMinimumRecompilationInterval()


getOutput

public PrintWriter getOutput()
Gets the currently configured output writer.


getPluginFactory

public ParserPluginFactory getPluginFactory()


getRecompileGroovySource

public boolean getRecompileGroovySource()


getScriptBaseClass

public String getScriptBaseClass()
Gets the name of the base class for scripts. It must be a subclass of Script.


getSourceEncoding

public String getSourceEncoding()
Gets the currently configured source file encoding.


getTargetBytecode

public String getTargetBytecode()
Retrieves the compiler bytecode compatibility mode.
return:
bytecode compatibity mode. Can be either 1.5 or 1.4.


getTargetDirectory

public File getTargetDirectory()
Gets the target directory for writing classes.


getTolerance

public int getTolerance()
Returns the requested error tolerance.


getVMVersion

static String getVMVersion()


getVerbose

public boolean getVerbose()
Returns true if verbose operation has been requested.


getWarningLevel

public int getWarningLevel()
Gets the currently configured warning level. See WarningMessage for level details.


setClasspath

public void setClasspath(String classpath)
Sets the classpath.


setClasspathList

public void setClasspathList(List l)
sets the classpath using a list of Strings
param:
l list of strings containg the classpathparts


setDebug

public void setDebug(boolean debug)
Turns debugging operation on or off.


setDefaultScriptExtension

public void setDefaultScriptExtension(String defaultScriptExtension)


setJointCompilationOptions

public void setJointCompilationOptions(Map options)
Sets the joint compilation options for this configuration. Using null will disable joint compilation.
param:
options the options


setMinimumRecompilationInterval

public void setMinimumRecompilationInterval(int time)


setOutput

public void setOutput(PrintWriter output)
Sets the output writer.


setPluginFactory

public void setPluginFactory(ParserPluginFactory pluginFactory)


setRecompileGroovySource

public void setRecompileGroovySource(boolean recompile)


setScriptBaseClass

public void setScriptBaseClass(String scriptBaseClass)
Sets the name of the base class for scripts. It must be a subclass of Script.


setSourceEncoding

public void setSourceEncoding(String encoding)
Sets the encoding to be used when reading source files.


setTargetBytecode

public void setTargetBytecode(String version)
Allow setting the bytecode compatibility. The parameter can take one of the values 1.5 or 1.4. If wrong parameter then the value will default to VM determined version.
param:
version the bytecode compatibility mode


setTargetDirectory

public void setTargetDirectory(String directory)
Sets the target directory.


setTargetDirectory

public void setTargetDirectory(File directory)
Sets the target directory.


setTolerance

public void setTolerance(int tolerance)
Sets the error tolerance, which is the number of non-fatal errors (per unit) that should be tolerated before compilation is aborted.


setVerbose

public void setVerbose(boolean verbose)
Turns verbose operation on or off.


setWarningLevel

public void setWarningLevel(int level)
Sets the warning level. See WarningMessage for level details.