class GrammarDirectoryScanner
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.List |
includedGrammars
A set of grammar infos describing the included grammar files, must never be
null . |
private java.io.File |
outputDirectory
The absolute path to the output directory used to detect stale target files by timestamp checking, may be
null if no stale detection should be performed. |
private java.lang.String |
parserPackage
The package name for the generated parser, may be
null to use the package declaration from the
grammar file. |
private org.codehaus.plexus.util.DirectoryScanner |
scanner
The directory scanner used to scan the source directory for files.
|
private int |
staleMillis
The granularity in milliseconds of the last modification date for testing whether a grammar file needs
recompilation because its corresponding target file is stale.
|
Constructor and Description |
---|
GrammarDirectoryScanner()
Creates a new grammar directory scanner.
|
Modifier and Type | Method and Description |
---|---|
GrammarInfo[] |
getIncludedGrammars()
Gets the grammar files that were included by the scanner during the last invocation of
scan() . |
protected java.io.File[] |
getTargetFiles(java.io.File targetDirectory,
java.lang.String grammarFile,
GrammarInfo grammarInfo)
Determines the output files corresponding to the specified grammar file.
|
void |
scan()
Scans the source directory for grammar files that match at least one inclusion pattern but no exclusion pattern,
optionally performing timestamp checking to exclude grammars whose corresponding parser files are up to date.
|
void |
setExcludes(java.lang.String[] excludes)
Sets the Ant-like exclusion patterns.
|
void |
setIncludes(java.lang.String[] includes)
Sets the Ant-like inclusion patterns.
|
void |
setOutputDirectory(java.io.File directory)
Sets the absolute path to the output directory used to detect stale target files.
|
void |
setParserPackage(java.lang.String packageName)
Sets the package name for the generated parser.
|
void |
setSourceDirectory(java.io.File directory)
Sets the absolute path to the source directory to scan for grammar files.
|
void |
setStaleMillis(int milliseconds)
Sets the granularity in milliseconds of the last modification date for stale file detection.
|
private org.codehaus.plexus.util.DirectoryScanner scanner
private java.io.File outputDirectory
null
if no stale detection should be performed.private java.lang.String parserPackage
null
to use the package declaration from the
grammar file.private int staleMillis
private java.util.List includedGrammars
null
.public GrammarDirectoryScanner()
public void setSourceDirectory(java.io.File directory)
directory
- The absolute path to the source directory to scan, must not be null
.public void setParserPackage(java.lang.String packageName)
packageName
- The package name for the generated parser, may be null
to use the package
declaration from the grammar file.public void setIncludes(java.lang.String[] includes)
includes
- The set of Ant-like inclusion patterns, may be null
to include all files.public void setExcludes(java.lang.String[] excludes)
excludes
- The set of Ant-like exclusion patterns, may be null
to exclude no files.public void setOutputDirectory(java.io.File directory)
directory
- The absolute path to the output directory used to detect stale target files by timestamp
checking, may be null
if no stale detection should be performed.public void setStaleMillis(int milliseconds)
milliseconds
- The granularity in milliseconds of the last modification date for testing whether a grammar
file needs recompilation because its corresponding target file is stale.public void scan() throws java.io.IOException
java.io.IOException
- If a grammar file could not be analyzed for metadata.protected java.io.File[] getTargetFiles(java.io.File targetDirectory, java.lang.String grammarFile, GrammarInfo grammarInfo)
targetDirectory
- The absolute path to the output directory for the target files, must not be
null
.grammarFile
- The path to the grammar file, relative to the scanned source directory, must not be
null
.grammarInfo
- The grammar info describing the grammar file, must not be null
null
.public GrammarInfo[] getIncludedGrammars()
scan()
.null
.