class GrammarDependencies
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<java.io.File,java.util.Map.Entry<byte[],java.util.Collection<java.lang.String>>> |
grammars
Map grammars to their checksum and references.
|
private Graph<java.lang.String> |
graph |
private java.io.File |
libDirectory |
private org.apache.maven.plugin.logging.Log |
log |
private java.lang.String |
packageName |
private java.io.File |
sourceDirectory |
private java.io.File |
statusFile |
| Constructor and Description |
|---|
GrammarDependencies(java.io.File sourceDirectory,
java.io.File libDirectory,
java.util.List<java.lang.String> arguments,
java.io.File status,
org.apache.maven.plugin.logging.Log log) |
| Modifier and Type | Method and Description |
|---|---|
private void |
analyse(java.io.File grammarFile,
java.util.Collection<java.io.File> grammarFiles,
Tool tool) |
GrammarDependencies |
analyze(java.util.Set<java.io.File> grammarFiles,
java.util.Set<java.io.File> importGrammarFiles,
Tool tool)
Performs dependency analysis for the given grammar files.
|
private void |
explore(java.lang.String grammarName,
java.util.Collection<java.lang.String> result) |
private java.util.Collection<java.lang.String> |
findUsages(java.lang.String grammarFileName)
Returns the grammar file names that directly or indirectly use the given grammar.
|
private java.lang.String |
getPackage(java.util.List<java.lang.String> arguments)
Determines the package to use.
|
private java.lang.String |
getRelativePath(java.io.File grammarFile)
Determines the relative target path of the given grammar file.
|
boolean |
isDependencyChanged(java.io.File grammarFile)
Determines whether a grammar used by the given grammar was modified since the last
build.
|
private java.util.Map<java.io.File,java.util.Map.Entry<byte[],java.util.Collection<java.lang.String>>> |
loadStatus(java.io.File statusFile) |
private java.io.File |
resolve(java.lang.String name,
java.lang.String path)
Resolves the given grammar name.
|
void |
save() |
private java.lang.String |
stripPath(java.lang.String str) |
private java.lang.String |
stripQuotes(java.lang.String str) |
private final Graph<java.lang.String> graph
private final java.io.File sourceDirectory
private final java.io.File libDirectory
private final java.io.File statusFile
private final java.lang.String packageName
private final java.util.Map<java.io.File,java.util.Map.Entry<byte[],java.util.Collection<java.lang.String>>> grammars
private final org.apache.maven.plugin.logging.Log log
public GrammarDependencies(java.io.File sourceDirectory,
java.io.File libDirectory,
java.util.List<java.lang.String> arguments,
java.io.File status,
org.apache.maven.plugin.logging.Log log)
private java.lang.String getPackage(java.util.List<java.lang.String> arguments)
arguments - the tool arguments.null to indicate that no package should be
used.public void save()
throws java.io.IOException
java.io.IOExceptionpublic GrammarDependencies analyze(java.util.Set<java.io.File> grammarFiles, java.util.Set<java.io.File> importGrammarFiles, Tool tool) throws java.io.IOException
grammarFiles - the grammar files.importGrammarFiles - the import grammar files.tool - the tool to use.java.io.IOExceptionpublic boolean isDependencyChanged(java.io.File grammarFile)
throws java.io.IOException
grammarFile - the grammar.true if a grammar used by the given grammar has been modified.java.io.IOExceptionprivate java.lang.String getRelativePath(java.io.File grammarFile)
grammarFile - the grammar file.private java.util.Collection<java.lang.String> findUsages(java.lang.String grammarFileName)
grammarFileName - the grammar file name.private void explore(java.lang.String grammarName,
java.util.Collection<java.lang.String> result)
private void analyse(java.io.File grammarFile,
java.util.Collection<java.io.File> grammarFiles,
Tool tool)
private java.io.File resolve(java.lang.String name,
java.lang.String path)
name - the name.path - the relative path.private java.util.Map<java.io.File,java.util.Map.Entry<byte[],java.util.Collection<java.lang.String>>> loadStatus(java.io.File statusFile)
private java.lang.String stripPath(java.lang.String str)
private java.lang.String stripQuotes(java.lang.String str)