Package org.codehaus.plexus.util

Examples of org.codehaus.plexus.util.Scanner


    List<String> inputFiles(File directory, String type) {
        if (!directory.exists()) {
            return emptyList();
        }

        Scanner ds = context.newScanner(directory, true);
        String[] includes = {"**\\*." + type};
        ds.setIncludes(includes);
        ds.scan();

        List<String> result = new ArrayList<String>();
        for (String file : ds.getIncludedFiles()) {
            result.add(new File(directory, file).getPath());
        }

        sort(result);
        return result;
View Full Code Here


        if (destRoot == null) {
            throw new MojoFailureException("destination directory for " + srcRoot + " is null");
        }
        DirectoryScanner scanner = new DirectoryScanner();
        scanner.setBasedir(srcRoot);
        Scanner incrementalScanner = buildContext.newScanner(srcRoot);

        if (includes == null) {
          scanner.setIncludes(getDefaultIncludes());
          incrementalScanner.setIncludes(getDefaultIncludes());
        } else {
          scanner.setIncludes(includes.toArray(new String[0]));
          incrementalScanner.setIncludes(includes.toArray(new String[0]));
        }

        if ( (srcExcludes != null) && !srcExcludes.isEmpty() ) {
            scanner.setExcludes( srcExcludes.toArray( EMPTY_STRING_ARRAY ) );
        }
        if ((excludes != null) && !excludes.isEmpty()) {
            scanner.setExcludes( excludes.toArray( EMPTY_STRING_ARRAY ) );
        }
        scanner.addDefaultExcludes();
        incrementalScanner.addDefaultExcludes();
        if(buildContext.isIncremental()){
          incrementalScanner.scan();
          if(incrementalScanner.getIncludedFiles() == null ||incrementalScanner.getIncludedFiles().length ==0 ){
            getLog().info("No files have changed, so skipping the processing");
            return;
          }
        }
        scanner.scan();
View Full Code Here

    // The directory that the html and resources are emitted into
    File apidocOutputDir = new File(outputDirectory, "apidoc");

    // Copy random resources
    Scanner copyScanner = buildContext.newScanner(apidocDirectory, true);
    copyScanner.setExcludes(new String[] { "apidoc_template.html", "**/*.md" });
    copyScanner.scan();
    for (String copyPath : copyScanner.getIncludedFiles()) {
      File copyFrom = new File(apidocDirectory, copyPath);
      File outFile = new File(apidocOutputDir, copyPath);
      if (buildContext.isUptodate(outFile, copyFrom)) {
        continue;
      }
      try {
        InputStream in = new FileInputStream(copyFrom);
        outFile.getParentFile().mkdirs();
        OutputStream out = buildContext.newFileOutputStream(outFile);
        IOUtil.copy(in, out);
        in.close();
        out.close();
      } catch (IOException e) {
        buildContext.addMessage(copyFrom, 0, 0, "Could not copy resource",
            BuildContext.SEVERITY_ERROR, e);
      }
    }

    // Look for all changed *.md files
    Scanner inputScanner = buildContext.newScanner(apidocDirectory, false);
    inputScanner.setIncludes(new String[] { "**/*.md" });
    inputScanner.scan();
    String[] dirtyPaths = inputScanner.getIncludedFiles();
    if (dirtyPaths.length == 0) {
      return;
    }

    apidocOutputDir.mkdirs();
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.util.Scanner

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.