private GrammarInfo [ ] scanForGrammars ( ) throws MojoExecutionException { if ( ! getSourceDirectory ( ) . isDirectory ( ) ) { return null ; } GrammarInfo [ ] grammarInfos ; getLog ( ) . debug ( "Scanning for grammars: " + getSourceDirectory ( ) ) ; try { final GrammarDirectoryScanner scanner = new GrammarDirectoryScanner ( ) ; scanner . setSourceDirectory ( getSourceDirectory ( ) ) ; scanner . setIncludes ( getIncludes ( ) ) ; scanner . setExcludes ( getExcludes ( ) ) ; scanner . setOutputDirectory ( getOutputDirectory ( ) ) ; scanner . setParserPackage ( getParserPackage ( ) ) ; scanner . setStaleMillis ( getStaleMillis ( ) ) ; scanner . scan ( ) ; grammarInfos = scanner . getIncludedGrammars ( ) ; } catch ( final Exception e ) { throw new MojoExecutionException ( "Failed to scan for grammars: " + getSourceDirectory ( ) , e ) ; } getLog ( ) . debug ( "Found grammars: " + Arrays . asList ( grammarInfos ) ) ; return grammarInfos ; }
Scans the configured source directory for grammar files which need processing .