/** Scans the source directories looking for source files to be decompiled. */
  protected void scanSrc() throws BuildException {
    for (@SuppressWarnings("unchecked") Iterator<Resource> it = src.iterator(); it.hasNext(); ) {
      Resource resource = it.next();
      FileResource fileResource = resource instanceof FileResource ? (FileResource) resource : null;
      if (fileResource != null) {
        File file = fileResource.getFile();
        if (file.isDirectory()) {
          DirectoryScanner ds = getDirectoryScanner(file);
          String[] files = ds.getIncludedFiles();

          scanDir(file, destdir != null ? destdir : file, files);
        } else {
          String[] files = new String[] {fileResource.getName()};

          scanDir(
              fileResource.getBaseDir(),
              destdir != null ? destdir : fileResource.getBaseDir(),
              files);
        }
      }
      //			else
      //			{
      //				//FIXME what to do?
      //			}
    }
  }
Example #2
0
 /** {@inheritDoc}. */
 public void execute() {
   if (length != null && adjust != null) {
     throw new BuildException("length and adjust are mutually exclusive options");
   }
   if (length == null && adjust == null) {
     length = ZERO;
   }
   if (path == null) {
     throw new BuildException(NO_CHILD);
   }
   for (Iterator it = path.iterator(); it.hasNext(); ) {
     Resource r = (Resource) it.next();
     File f = ((FileProvider) r.as(FileProvider.class)).getFile();
     if (shouldProcess(f)) {
       process(f);
     }
   }
 }