Package org.codehaus.plexus.compiler.util.scan

Examples of org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner


  @Parameter(defaultValue = "false")
  private boolean includeStale;

  public void execute() throws MojoExecutionException, MojoFailureException {

    SourceInclusionScanner scanner = includeStale
            ? new StaleSourceScanner(1024, Collections.singleton("**/*." + extension), Collections.<String>emptySet())
            : new SimpleSourceInclusionScanner(Collections.singleton("**/*." + extension), Collections.<String>emptySet());

    scanner.addSourceMapping(new SuffixMapping("." + extension, "." + extension));

    MustacheFactory mustacheFactory = new DefaultMustacheFactory();
    try {
      Set<File> files = scanner.getIncludedSources(sourceDirectory, outputDirectory);

      for (File file : files) {
        try {
          mustacheFactory.compile(new FileReader(file), file.getAbsolutePath());
        } catch (MustacheException e) {
View Full Code Here


        // as this is autoscanned for importd grammars and so is auto-excluded from the
        // set of gramamr fiels we shuold be analyzing.
        //
        excludes.add("imports/**");

        SourceInclusionScanner scan = new SimpleSourceInclusionScanner(includes, excludes);

        scan.addSourceMapping(mapping);
        Set<File> grammarFiles = scan.getIncludedSources(sourceDirectory, null);

        if (grammarFiles.isEmpty()) {
            if (getLog().isInfoEnabled()) {
                getLog().info("No grammars to process");
            }
View Full Code Here

    }
  }

  private Set<File> collectIncludedSourceGrammars() throws MojoExecutionException {
    SourceMapping mapping = new SuffixMapping( "g", Collections.<String>emptySet() );
        SourceInclusionScanner scan = new SimpleSourceInclusionScanner( getIncludePatterns(), getExcludePatterns() );
        scan.addSourceMapping( mapping );
    try {
      return scan.getIncludedSources( sourceDirectory, null );
    }
    catch ( InclusionScanException e ) {
      throw new MojoExecutionException( "Error determining gUnit sources", e );
    }
  }
View Full Code Here

        // 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);
        Set<File> grammarFiles = scan.getIncludedSources(sourceDirectory, null);

        if (grammarFiles.isEmpty()) {
            getLog().info("No grammars to process");
      return Collections.emptyList();
    }
View Full Code Here

    public List<NamespaceInFile> discoverNamespacesIn(File basePath) throws MojoExecutionException {

        if (!basePath.exists()) return Collections.EMPTY_LIST;

        SourceInclusionScanner scanner = getSourceInclusionScanner(includeStale);

        SourceMapping mapping = new SuffixMapping(".clj", new HashSet(Arrays.asList(".clj", "__init.class")));

        scanner.addSourceMapping(mapping);

        final Set<File> sourceFiles;

        try {
            sourceFiles = scanner.getIncludedSources(basePath, targetPath);
        } catch (InclusionScanException e) {
            throw new MojoExecutionException("Error scanning source path: \'" + basePath.getPath() + "\' " + "for  files to recompile.", e);
        }

        List<NamespaceInFile> namespaces = new ArrayList<NamespaceInFile>();
View Full Code Here

     * Creates a source inclusion scanner.
     *
     * @return The inclusion scanner.
     */
    private SourceInclusionScanner getSourceInclusionScanner() {
        SourceInclusionScanner scanner = null;
        if (includes == null) {
            includes = new HashSet<String>();
        }
        if (excludes == null) {
            excludes = new HashSet<String>();
        }

        if (includes.isEmpty() && excludes.isEmpty()) {
            includes = Collections.singleton("**/*Model.java");
            scanner = new SimpleSourceInclusionScanner(includes, excludes);
        } else {
            if (includes.isEmpty()) {
                includes = Collections.singleton("**/*Model.java");
            }
            scanner = new SimpleSourceInclusionScanner(includes, excludes);
        }
        scanner.addSourceMapping(new SourceMapping() {

            @SuppressWarnings("rawtypes")
            @Override
            public Set getTargetFiles(File targetDir, String source) {
                return null;
View Full Code Here

        {
            // see MCOMPILER-199 GroovyEclipseCompiler doesn't set inputFileEnding
            // so we can presume it's all files from the source directory
            inputFileEnding = ".*";
        }
        SourceInclusionScanner scanner = getSourceInclusionScanner( inputFileEnding );

        SourceMapping mapping = getSourceMapping( compilerConfiguration, compiler );

        scanner.addSourceMapping( mapping );

        Set<File> compileSources = new HashSet<File>();

        for ( String sourceRoot : getCompileSourceRoots() )
        {
            File rootFile = new File( sourceRoot );

            if ( !rootFile.isDirectory() )
            {
                continue;
            }

            try
            {
                compileSources.addAll( scanner.getIncludedSources( rootFile, null ) );
            }
            catch ( InclusionScanException e )
            {
                throw new MojoExecutionException(
                    "Error scanning source root: \'" + sourceRoot + "\' for stale files to recompile.", e );
View Full Code Here

        return outputDirectory;
    }

    protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis )
    {
        SourceInclusionScanner scanner = null;

        if ( testIncludes.isEmpty() && testExcludes.isEmpty() )
        {
            scanner = new StaleSourceScanner( staleMillis );
        }
View Full Code Here

        return scanner;
    }

    protected SourceInclusionScanner getSourceInclusionScanner( String inputFileEnding )
    {
        SourceInclusionScanner scanner = null;

        // it's not defined if we get the ending with or without the dot '.'
        String defaultIncludePattern = "**/*" + ( inputFileEnding.startsWith( "." ) ? "" : "." ) + inputFileEnding;

        if ( testIncludes.isEmpty() && testExcludes.isEmpty() )
View Full Code Here

        }
    }

    protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis )
    {
        SourceInclusionScanner scanner = null;

        if ( includes.isEmpty() && excludes.isEmpty() )
        {
            scanner = new StaleSourceScanner( staleMillis );
        }
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.