org.quattor.pan
Class CompilerOptions

java.lang.Object
  extended by org.quattor.pan.CompilerOptions

public class CompilerOptions
extends java.lang.Object

Encapsulates the global options for the pan compiler. An instance of this class must be passed to the Compiler itself. Instances of this class are immutable and thread-safe.

Author:
loomis

Field Summary
 int activeThreadsPerQueue
          The number of active threads per task queue to allow.
 java.io.File annotationBaseDirectory
          Base directory of source files for generation of annotation output files.
 java.io.File annotationDirectory
          Directory that will contain the annotation output files.
 int callDepthLimit
          The call depth limit which is used to prevent infinite recursion in the compiler.
 int deprecationLevel
          Define the deprecation level for compilation.
 boolean depWriteEnabled
          Indicates whether or not the dependency files for produced machine profiles should be written.
 boolean failOnWarn
          If set to true, then any warnings will cause the compilation to fail.
 boolean forceBuild
          Force the build to be done even if no output files are to be written.
 Formatter formatter
          The Formatter that will be used to format the machine profiles.
 boolean gzipOutput
          Indicate whether the produced machine profile should be gzipped.
 int iterationLimit
          The iteration limit during the compilation to avoid infinite loops.
 java.io.File outputDirectory
          The directory that will contain the produced machine profiles and dependency files (if any).
 SourceRepository sourceRepository
           
 boolean xmlWriteEnabled
          Flag to activate the writing of machine profiles to disk.
 
Constructor Summary
CompilerOptions(java.util.List<java.util.regex.Pattern> debugIncludePatterns, java.util.List<java.util.regex.Pattern> debugExcludePatterns, boolean xmlWriteEnabled, boolean depWriteEnabled, int iterationLimit, int callDepthLimit, Formatter formatter, java.io.File outputDirectory, java.io.File sessionDirectory, java.util.List<java.io.File> includeDirectories, int nthread, boolean gzipOutput, int deprecationLevel, boolean forceBuild, java.io.File annotationDirectory, java.io.File annotationBaseDirectory, boolean failOnWarn)
          Construct a CompilerOptions instance to drive a Compiler run.
 
Method Summary
 boolean checkDebugEnabled(java.lang.String tplName)
          A utility function that checks a given template name against the list of debug include and exclude patterns.
static CompilerOptions createCheckSyntaxOptions(int deprecationLevel, boolean failOnWarn)
          Create a CompilerOptions object that is appropriate for just doing a syntax check.
 java.util.Set<java.io.File> resolveFileList(java.util.List<java.lang.String> objectNames, java.util.Collection<java.io.File> tplFiles)
          Resolve a list of object template names and template Files to a set of files based on this instance's include directories and session directory.
 java.lang.String toString()
          A verbose representation of all of the options in this instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xmlWriteEnabled

public final boolean xmlWriteEnabled
Flag to activate the writing of machine profiles to disk. Typically these are XML files, but any Formatter can be used.


depWriteEnabled

public final boolean depWriteEnabled
Indicates whether or not the dependency files for produced machine profiles should be written.


forceBuild

public final boolean forceBuild
Force the build to be done even if no output files are to be written.


iterationLimit

public final int iterationLimit
The iteration limit during the compilation to avoid infinite loops.


callDepthLimit

public final int callDepthLimit
The call depth limit which is used to prevent infinite recursion in the compiler.


formatter

public final Formatter formatter
The Formatter that will be used to format the machine profiles.


outputDirectory

public final java.io.File outputDirectory
The directory that will contain the produced machine profiles and dependency files (if any).


activeThreadsPerQueue

public final int activeThreadsPerQueue
The number of active threads per task queue to allow.


gzipOutput

public final boolean gzipOutput
Indicate whether the produced machine profile should be gzipped.


deprecationLevel

public final int deprecationLevel
Define the deprecation level for compilation. Less than zero turns this off, 0 gives warnings for things that will change in next release, and 1 gives warnings for other future changes.


failOnWarn

public final boolean failOnWarn
If set to true, then any warnings will cause the compilation to fail.


sourceRepository

public final SourceRepository sourceRepository

annotationDirectory

public final java.io.File annotationDirectory
Directory that will contain the annotation output files.


annotationBaseDirectory

public final java.io.File annotationBaseDirectory
Base directory of source files for generation of annotation output files. These files will be generated at locations relative to the base directory in the specified output directory.

Constructor Detail

CompilerOptions

public CompilerOptions(java.util.List<java.util.regex.Pattern> debugIncludePatterns,
                       java.util.List<java.util.regex.Pattern> debugExcludePatterns,
                       boolean xmlWriteEnabled,
                       boolean depWriteEnabled,
                       int iterationLimit,
                       int callDepthLimit,
                       Formatter formatter,
                       java.io.File outputDirectory,
                       java.io.File sessionDirectory,
                       java.util.List<java.io.File> includeDirectories,
                       int nthread,
                       boolean gzipOutput,
                       int deprecationLevel,
                       boolean forceBuild,
                       java.io.File annotationDirectory,
                       java.io.File annotationBaseDirectory,
                       boolean failOnWarn)
Construct a CompilerOptions instance to drive a Compiler run. Instances of this class are immutable.

Parameters:
debugIncludePatterns - patterns to use to turn on debugging for matching templates
debugExcludePatterns - patterns to use to turn off debugging for matching templates
xmlWriteEnabled - write machine configuration files (usually XML files)
depWriteEnabled - write dependency information
iterationLimit - maximum number of iterations (<=0 unlimited)
callDepthLimit - maximum call depth (<=0 unlimited)
formatter - format for machine configuration files (cannot be null if writeXmlEnabled is true)
outputDirectory - output directory for machine configuration and dependency files (cannot be null if either writeXmlEnable or writeDepEnabled is true)
sessionDirectory - session directory
includeDirectories - list of directories to check for template files; directories must exist and be absolute
nthread - number of threads to use (<=0 uses default value)
gzipOutput - gzip produced machine profiles
deprecationLevel - level for deprecation warnings (<0 off, =0 next release, >0 future releases)
forceBuild - force build even if no output files are generated if true
annotationDirectory - directory that will contain annotation output files
annotationBaseDirectory - base directory of source files for annotation output
failOnWarn - if set to true, all warnings will cause compilation to fail
Method Detail

createCheckSyntaxOptions

public static CompilerOptions createCheckSyntaxOptions(int deprecationLevel,
                                                       boolean failOnWarn)
Create a CompilerOptions object that is appropriate for just doing a syntax check.

Parameters:
deprecationLevel - set the deprecation level, the higher the level the fewer deprecation warnings are produced; 0 produces all warnings
failOnWarn - if set to true, all warnings will cause compilation to fail
Returns:

resolveFileList

public java.util.Set<java.io.File> resolveFileList(java.util.List<java.lang.String> objectNames,
                                                   java.util.Collection<java.io.File> tplFiles)
Resolve a list of object template names and template Files to a set of files based on this instance's include directories and session directory.

Parameters:
objectNames - object template names to lookup
tplFiles - template Files to process
Returns:
unmodifiable set of the resolved file names

checkDebugEnabled

public boolean checkDebugEnabled(java.lang.String tplName)
A utility function that checks a given template name against the list of debug include and exclude patterns.

Parameters:
tplName - name of the template to check
Returns:
flag indicating whether debugging should be activated or not

toString

public java.lang.String toString()
A verbose representation of all of the options in this instance.

Overrides:
toString in class java.lang.Object
Returns:
String representation of options


Copyright © 2011 Quattor. All Rights Reserved.