Search in sources :

Example 1 with SimpleSourceInclusionScanner

use of org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner in project antlr4 by antlr.

the class Antlr4Mojo method getGrammarFiles.

private Set<File> getGrammarFiles(File sourceDirectory) throws InclusionScanException {
    // Which files under the source set should we be looking for as grammar files
    SourceMapping mapping = new SuffixMapping("g4", Collections.<String>emptySet());
    // What are the sets of includes (defaulted or otherwise).
    Set<String> includes = getIncludesPatterns();
    // Now, to the excludes, we need to add the imports directory
    // as this is autoscanned for imported grammars and so is auto-excluded from the
    // set of grammar fields we should be analyzing.
    excludes.add("imports/**");
    SourceInclusionScanner scan = new SimpleSourceInclusionScanner(includes, excludes);
    scan.addSourceMapping(mapping);
    return scan.getIncludedSources(sourceDirectory, null);
}
Also used : SourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner) SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner) SuffixMapping(org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping) SourceMapping(org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping) SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner)

Example 2 with SimpleSourceInclusionScanner

use of org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner in project maven-plugins by apache.

the class TestCompilerMojo method getSourceInclusionScanner.

protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding) {
    SourceInclusionScanner scanner;
    // it's not defined if we get the ending with or without the dot '.'
    String defaultIncludePattern = "**/*" + (inputFileEnding.startsWith(".") ? "" : ".") + inputFileEnding;
    if (testIncludes.isEmpty() && testExcludes.isEmpty()) {
        testIncludes = Collections.singleton(defaultIncludePattern);
        scanner = new SimpleSourceInclusionScanner(testIncludes, Collections.<String>emptySet());
    } else {
        if (testIncludes.isEmpty()) {
            testIncludes.add(defaultIncludePattern);
        }
        scanner = new SimpleSourceInclusionScanner(testIncludes, testExcludes);
    }
    return scanner;
}
Also used : SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner) SourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner) SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner)

Example 3 with SimpleSourceInclusionScanner

use of org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner in project maven-plugins by apache.

the class CompilerMojo method getSourceInclusionScanner.

protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding) {
    SourceInclusionScanner scanner;
    // it's not defined if we get the ending with or without the dot '.'
    String defaultIncludePattern = "**/*" + (inputFileEnding.startsWith(".") ? "" : ".") + inputFileEnding;
    if (includes.isEmpty() && excludes.isEmpty()) {
        includes = Collections.singleton(defaultIncludePattern);
        scanner = new SimpleSourceInclusionScanner(includes, Collections.<String>emptySet());
    } else {
        if (includes.isEmpty()) {
            includes.add(defaultIncludePattern);
        }
        scanner = new SimpleSourceInclusionScanner(includes, excludes);
    }
    return scanner;
}
Also used : SourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner) SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner) SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner)

Example 4 with SimpleSourceInclusionScanner

use of org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner in project antlr4 by antlr.

the class Antlr4Mojo method getImportFiles.

private Set<File> getImportFiles(File sourceDirectory) throws InclusionScanException {
    if (!libDirectory.exists())
        return Collections.emptySet();
    Set<String> includes = new HashSet<String>();
    includes.add("*.g4");
    includes.add("*.tokens");
    SourceInclusionScanner scan = new SimpleSourceInclusionScanner(includes, Collections.<String>emptySet());
    scan.addSourceMapping(new SuffixMapping("G4", "g4"));
    return scan.getIncludedSources(libDirectory, null);
}
Also used : SourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner) SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner) SuffixMapping(org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping) SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner) HashSet(java.util.HashSet)

Example 5 with SimpleSourceInclusionScanner

use of org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner in project jangaroo-tools by CoreMedia.

the class MavenPluginHelper method createSourceInclusionScanner.

private SourceInclusionScanner createSourceInclusionScanner(Set<String> includes, Set<String> excludes, String inputFileSuffix, int staleMillis) {
    SourceInclusionScanner scanner;
    if (staleMillis >= 0 && includes.isEmpty() && excludes.isEmpty()) {
        scanner = new StaleSourceScanner(staleMillis);
    } else {
        if (includes.isEmpty()) {
            includes.add("**/*" + inputFileSuffix);
        }
        scanner = staleMillis >= 0 ? new StaleSourceScanner(staleMillis, includes, excludes) : new SimpleSourceInclusionScanner(includes, excludes);
    }
    log.debug("Using source inclusion scanner " + scanner);
    return scanner;
}
Also used : SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner) SourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner) StaleSourceScanner(org.codehaus.plexus.compiler.util.scan.StaleSourceScanner) SimpleSourceInclusionScanner(org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner)

Aggregations

SimpleSourceInclusionScanner (org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner)5 SourceInclusionScanner (org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner)5 SuffixMapping (org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping)2 HashSet (java.util.HashSet)1 StaleSourceScanner (org.codehaus.plexus.compiler.util.scan.StaleSourceScanner)1 SourceMapping (org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping)1