Ejemplo n.º 1
0
  void unpackJars() throws BuildException {
    // unpack in separate dirs, to allow multiple instances of the same
    // resource from different jars.

    int jarId = 0;

    Iterator it = task.getLibs().iterator();
    while (it.hasNext()) {
      FileSet fs = (FileSet) it.next();
      DirectoryScanner scanner = fs.getDirectoryScanner(task.getProject());

      String[] files = scanner.getIncludedFiles();
      Expand unjar = (Expand) task.createSubtask(Expand.class);

      for (int i = 0; i < files.length; i++) {

        File unpackDir = new File(scratchDir, jarId++ + "");
        unpackDir.mkdirs();
        unpackedJarDirs.add(unpackDir);

        unjar.setDest(unpackDir);
        unjar.setSrc(new File(scanner.getBasedir(), files[i]));
        unjar.execute();
      }
    }
  }
Ejemplo n.º 2
0
  /**
   * Perform the check
   *
   * @throws BuildException if an error occurs during execution of this task.
   */
  @Override
  public void execute() throws BuildException {
    try {

      CheckEolMode mode = null;
      if ("\n".equals(eoln)) {
        mode = CheckEolMode.LF;
      } else if ("\r\n".equals(eoln)) {
        mode = CheckEolMode.CRLF;
      } else {
        log(
            "Line ends check skipped, because OS line ends setting is neither LF nor CRLF.",
            Project.MSG_VERBOSE);
        return;
      }

      int count = 0;

      List<org.apache.tomcat.buildutil.CheckEolCheckFailureRemoteInterface> errors =
          new ArrayList<org.apache.tomcat.buildutil.CheckEolCheckFailureRemoteInterface>();

      // Step through each file and check.
      for (FileSet fs : filesets) {
        DirectoryScanner ds = fs.getDirectoryScanner(getProject());
        File basedir = ds.getBasedir();
        String[] files = ds.getIncludedFiles();
        if (files.length > 0) {
          log("Checking line ends in " + files.length + " file(s)");
          for (int i = 0; i < files.length; i++) {
            File file = new File(basedir, files[i]);
            log("Checking file '" + file + "' for correct line ends", Project.MSG_DEBUG);
            try {
              check(file, errors, mode);
            } catch (IOException e) {
              throw new BuildException("Could not check file '" + file.getAbsolutePath() + "'", e);
            }
            count++;
          }
        }
      }
      if (count > 0) {
        log("Done line ends check in " + count + " file(s), " + errors.size() + " error(s) found.");
      }
      if (errors.size() > 0) {
        String message = "The following files have wrong line ends: " + errors;
        // We need to explicitly write the message to the log, because
        // long BuildException messages may be trimmed. E.g. I observed
        // this problem with Eclipse IDE 3.7.
        log(message, Project.MSG_ERR);
        throw new BuildException(message);
      }
    } catch (Exception excp) {
      excp.printStackTrace();
    }
  }
Ejemplo n.º 3
0
  public void execute() throws BuildException {

    IvyAdapter adapter = null;

    try {
      Class.forName("org.apache.ivy.Ivy");
      adapter = new Ivy20Adapter();
    } catch (ClassNotFoundException e) {
      adapter = new Ivy14Adapter();
    }

    String setId = org + "." + module + "." + rev + ".fileset";
    adapter.configure(this);
    adapter.fileset(this, setId);

    FileSet fileset = (FileSet) getProject().getReference(setId);

    DirectoryScanner scanner = fileset.getDirectoryScanner(getProject());

    String files[] = scanner.getIncludedFiles();

    File file = new File(scanner.getBasedir(), files[0]);

    File importFile = null;

    if ("xml".equalsIgnoreCase(type)) {
      importFile = file;
    } else if ("jar".equalsIgnoreCase(type) || "zip".equalsIgnoreCase(type)) {
      File dir = new File(file.getParentFile(), file.getName() + ".extracted");
      if (!dir.exists() || dir.lastModified() < file.lastModified()) {
        dir.mkdir();
        Expand expand = (Expand) getProject().createTask("unjar");
        expand.setSrc(file);
        expand.setDest(dir);
        expand.perform();
      }
      importFile = new File(dir, resource);
      if (!importFile.exists()) {
        throw new BuildException("Cannot find a '" + resource + "' file in " + file.getName());
      }
    } else {
      throw new BuildException("Don't know what to do with type: " + type);
    }

    log("Importing " + importFile.getName(), Project.MSG_INFO);

    super.setFile(importFile.getAbsolutePath());
    super.execute();

    log("Import complete.", Project.MSG_INFO);
  }
Ejemplo n.º 4
0
  public void produce(final DataConsumer pReceiver) throws IOException {
    String user = "******";
    int uid = 0;
    String group = "root";
    int gid = 0;
    int filemode = TarEntry.DEFAULT_FILE_MODE;
    int dirmode = TarEntry.DEFAULT_DIR_MODE;
    String prefix = "";

    if (fileset instanceof Tar.TarFileSet) {
      Tar.TarFileSet tarfileset = (Tar.TarFileSet) fileset;
      user = tarfileset.getUserName();
      uid = tarfileset.getUid();
      group = tarfileset.getGroup();
      gid = tarfileset.getGid();
      filemode = tarfileset.getMode();
      dirmode = tarfileset.getDirMode(tarfileset.getProject());
      prefix = tarfileset.getPrefix(tarfileset.getProject());
    }

    final DirectoryScanner scanner = fileset.getDirectoryScanner(fileset.getProject());
    scanner.scan();

    final File basedir = scanner.getBasedir();

    final String[] directories = scanner.getIncludedDirectories();
    for (int i = 0; i < directories.length; i++) {
      final String name = directories[i].replace('\\', '/');

      pReceiver.onEachDir(prefix + "/" + name, null, user, uid, group, gid, dirmode, 0);
    }

    final String[] files = scanner.getIncludedFiles();
    for (int i = 0; i < files.length; i++) {
      final String name = files[i].replace('\\', '/');
      final File file = new File(basedir, name);

      final InputStream inputStream = new FileInputStream(file);
      try {
        pReceiver.onEachFile(
            inputStream, prefix + "/" + name, null, user, uid, group, gid, filemode, file.length());
      } finally {
        inputStream.close();
      }
    }
  }
  /**
   * Collect reports from the given {@link DirectoryScanner}, while filtering out all files that
   * were created before the given time.
   */
  public void parse(long buildTime, DirectoryScanner results) throws IOException {
    String[] includedFiles = results.getIncludedFiles();
    File baseDir = results.getBasedir();

    boolean parsed = false;

    for (String value : includedFiles) {
      File reportFile = new File(baseDir, value);
      // only count files that were actually updated during this build
      if ((buildTime - 3000 /*error margin*/ <= reportFile.lastModified()) || !checkTimestamps) {
        if (reportFile.length() == 0) {
          // this is a typical problem when JVM quits abnormally, like OutOfMemoryError during a
          // test.
          SuiteResult sr = new SuiteResult(reportFile.getName(), "", "");
          sr.addCase(
              new CaseResult(
                  sr,
                  "<init>",
                  "Test report file " + reportFile.getAbsolutePath() + " was length 0"));
          TestResult testResult = new TestResult(this, "(unknown)", sr);
          childrenBySuiteName.put(testResult.getName(), testResult);
        } else {
          parse(reportFile);
        }
        parsed = true;
      }
    }

    if (!parsed) {
      long localTime = System.currentTimeMillis();
      if (localTime < buildTime - 1000) /*margin*/
        // build time is in the the future. clock on this slave must be running behind
        throw new AbortException(
            "Clock on this slave is out of sync with the master, and therefore \n"
                + "I can't figure out what test results are new and what are old.\n"
                + "Please keep the slave clock in sync with the master.");

      File f = new File(baseDir, includedFiles[0]);
      throw new AbortException(
          String.format(
              "Test reports were found but none of them are new. Did tests run? \n"
                  + "For example, %s is %s old\n",
              f, Util.getTimeSpanString(buildTime - f.lastModified())));
    }
  }
Ejemplo n.º 6
0
  private String[] getFiles() {

    List files = new LinkedList();
    for (Iterator i = fileSets.iterator(); i.hasNext(); ) {

      FileSet fs = (FileSet) i.next();
      DirectoryScanner ds = fs.getDirectoryScanner(getProject());

      String[] dsFiles = ds.getIncludedFiles();
      for (int j = 0; j < dsFiles.length; j++) {
        File f = new File(dsFiles[j]);
        if (!f.isFile()) {
          f = new File(ds.getBasedir(), dsFiles[j]);
        }

        files.add(f.getAbsolutePath());
      }
    }

    return ArrayHelper.toStringArray(files);
  }
Ejemplo n.º 7
0
 public void visitLibraries(
     final Project project, final Linker linker, final File[] libpath, final FileVisitor visitor)
     throws BuildException {
   if (isReference()) {
     final LibrarySet master = (LibrarySet) getCheckedRef(LibrarySet.class, "LibrarySet");
     master.visitLibraries(project, linker, libpath, visitor);
   }
   //
   // if there was a libs attribute then
   // add the corresponding patterns to the FileSet
   //
   if (this.libnames != null) {
     for (final String libname : this.libnames) {
       final String[] patterns =
           linker.getLibraryPatterns(new String[] {libname}, this.libraryType);
       if (patterns.length > 0) {
         final FileSet localSet = (FileSet) this.set.clone();
         //
         // unless explicitly set
         // will default to the linker case sensitivity
         //
         if (!this.explicitCaseSensitive) {
           final boolean linkerCaseSensitive = linker.isCaseSensitive();
           localSet.setCaseSensitive(linkerCaseSensitive);
         }
         //
         // add all the patterns for this libname
         //
         for (final String pattern : patterns) {
           final PatternSet.NameEntry entry = localSet.createInclude();
           entry.setName(pattern);
         }
         int matches = 0;
         //
         // if there was no specified directory then
         // run through the libpath backwards
         //
         if (localSet.getDir(project) == null) {
           //
           // scan libpath in reverse order
           // to give earlier entries priority
           //
           for (int j = libpath.length - 1; j >= 0; j--) {
             final FileSet clone = (FileSet) localSet.clone();
             clone.setDir(libpath[j]);
             final DirectoryScanner scanner = clone.getDirectoryScanner(project);
             final File basedir = scanner.getBasedir();
             final String[] files = scanner.getIncludedFiles();
             matches += files.length;
             for (final String file : files) {
               visitor.visit(basedir, file);
             }
           }
         } else {
           final DirectoryScanner scanner = localSet.getDirectoryScanner(project);
           final File basedir = scanner.getBasedir();
           final String[] files = scanner.getIncludedFiles();
           matches += files.length;
           for (final String file : files) {
             visitor.visit(basedir, file);
           }
         }
         //
         // TODO: following section works well for Windows
         // style linkers but unnecessary fails
         // Unix style linkers. Will need to revisit.
         //
         if (matches == 0) {
           final StringBuffer msg = new StringBuffer("No file matching ");
           if (patterns.length == 1) {
             msg.append("pattern (");
             msg.append(patterns[0]);
             msg.append(")");
           } else {
             msg.append("patterns (\"");
             msg.append(patterns[0]);
             for (int k = 1; k < patterns.length; k++) {
               msg.append(", ");
               msg.append(patterns[k]);
             }
             msg.append(")");
           }
           msg.append(" for library name \"");
           msg.append(libname);
           msg.append("\" was found.");
           // TODO: raising the message in the log rather
           // throw new BuildException(msg.toString());
           project.log(msg.toString(), Project.MSG_WARN);
         }
       }
     }
   }
 }
Ejemplo n.º 8
0
  /**
   * Create the array of arguments to pass to rhino engine. It looks something like this: -modules
   * <jsdoc.home>/node_modules -modules <jsdoc.home>/rhino_modules \ -modules <jsdoc.home>
   * <jsdoc.home>/jsdoc.js --dirname=<jsdoc.home> \ <options> <sourcefiles|sourcedirs>
   *
   * @return a string[] of commands to pass to the rhino engine
   */
  private String[] createArguments() throws BuildException {
    Vector<String> arguments = new Vector<String>();

    // return if certain attributes are not present
    if ((jsDocHome == null)) {
      throw new BuildException("jsdochome must be specified");
    }

    // add the modules folders
    arguments.add("-modules");
    arguments.add(jsDocHome + "/node_modules");
    arguments.add("-modules");

    if (new File(jsDocHome + "/rhino").exists()) {
      arguments.add(jsDocHome + "/rhino");
    } else {
      arguments.add(jsDocHome + "/rhino_modules");
    }

    arguments.add("-modules");
    arguments.add(jsDocHome + "/lib");
    arguments.add("-modules");
    arguments.add(jsDocHome);

    // add the main jsodc js
    arguments.add(jsDocHome + "/jsdoc.js");

    // add the dirname
    arguments.add("--dirname=" + jsDocHome);

    addOptionalArgument(arguments, template, "-t"); // add the template
    addOptionalArgument(arguments, toDir, "-d"); // add the output dir
    addOptionalArgument(arguments, encoding, "-e"); // the encoding to use
    addOptionalArgument(arguments, config, "-c"); // the config file to use
    addOptionalArgument(arguments, tutorials, "-u"); // the tutorials dir
    addOptionalBooleanArgument(arguments, isIncludingPrivate, "-p");
    addOptionalBooleanArgument(arguments, isRecursive, "-r");

    if (inputFile != null) {
      arguments.add(inputFile);
    } else if (inputDir != null) {
      arguments.add(inputDir);
    } else if (fileSets.size() != 0 || fileLists.size() != 0) {
      // Loop through fileSets
      for (int i = 0, l = fileSets.size(); i < l; i++) {
        FileSet fs = fileSets.elementAt(i);
        // Ummm....?
        DirectoryScanner ds = fs.getDirectoryScanner(getProject());
        // Get base directory from fileset
        File dir = ds.getBasedir();
        // Get included files from fileset
        String[] srcs = ds.getIncludedFiles();
        // Loop through files
        for (int j = 0; j < srcs.length; j++) {
          // Make file object from base directory and filename
          File temp = new File(dir, srcs[j]);
          // Call the JSMin class with this file
          arguments.add(temp.getAbsolutePath());
        }
      }
      // Loop through fileLists
      for (int i = 0; i < fileLists.size(); i++) {
        FileList fs = fileLists.elementAt(i);
        // Get included files from filelist
        String[] srcs = fs.getFiles(getProject());
        // Get base directory from filelist
        File dir = fs.getDir(getProject());
        // Loop through files
        for (int j = 0; j < srcs.length; j++) {
          // Make file object from base directory and filename
          File temp = new File(dir, srcs[j]);
          // Call the JSMin class with this file
          arguments.add(temp.getAbsolutePath());
        }
      }
    } else {
      throw new BuildException(
          "No inputs specified.  Task requires 'file' attribute OR 'dir' attribute OR nested filesets");
    }
    if (args.size() != 0) {
      for (int i = 0, l = args.size(); i < l; i++) {
        arguments.addAll(Arrays.asList(args.elementAt(i).getParts()));
      }
    }
    return arguments.toArray(new String[0]);
  }
Ejemplo n.º 9
0
  /**
   * Processes the previously set WADL file and generated code in the specified package and target
   * directory.
   *
   * @throws org.apache.tools.ant.BuildException if processing of the WADL file fails.
   */
  public void execute() throws BuildException {
    if (pkg == null) throw new BuildException(Wadl2JavaMessages.PACKAGE_ATTRIBUTE_REQUIRED());
    if (target == null) throw new BuildException(Wadl2JavaMessages.TARGET_ATTRIBUTE_REQUIRED());
    if (!target.exists())
      throw new BuildException(Wadl2JavaMessages.TARGET_DIRECTORY_MUST_EXIST(target.toString()));
    if (!target.isDirectory())
      throw new BuildException(Wadl2JavaMessages.TARGET_ATTRIBUTE_DIRECTORY(target.toString()));
    if (desc == null) throw new BuildException(Wadl2JavaMessages.DESCRIPTION_REQUIRED());

    List<File> customizations = new ArrayList<File>();
    for (FileSet fs : customizationFileSets) {
      DirectoryScanner ds = fs.getDirectoryScanner(getProject());
      String[] includedFiles = ds.getIncludedFiles();
      for (String filename : includedFiles) {
        File f = new File(ds.getBasedir(), filename);
        customizations.add(f);
      }
    }

    if (desc.getScheme() == null || desc.getScheme().equals("file")) {
      // assume a file if not explicitly told otherwise
      File fileDesc = new File(this.getOwningTarget().getProject().getBaseDir(), desc.getPath());
      if (!fileDesc.exists())
        throw new BuildException(Wadl2JavaMessages.WADL_DESCRIPTION_MUST_EXIST(desc.toString()));
      if (!fileDesc.isFile())
        throw new BuildException(Wadl2JavaMessages.WADL_DESCRIPTION_FILE(desc.toString()));
      desc = fileDesc.toURI();

      // check if description has changed since code was last generated
      long earliestProducedFileStamp = Long.MAX_VALUE;
      for (FileSet fs : producedFileSets) {
        DirectoryScanner ds = fs.getDirectoryScanner(getProject());
        String[] includedFiles = ds.getIncludedFiles();
        for (String filename : includedFiles) {
          File f = new File(ds.getBasedir(), filename);
          if (f.lastModified() < earliestProducedFileStamp)
            earliestProducedFileStamp = f.lastModified();
        }
      }
      long latestConsumedFileStamp = fileDesc.lastModified();
      for (FileSet fs : consumedFileSets) {
        DirectoryScanner ds = fs.getDirectoryScanner(getProject());
        String[] includedFiles = ds.getIncludedFiles();
        for (String filename : includedFiles) {
          File f = new File(ds.getBasedir(), filename);
          if (f.lastModified() > latestConsumedFileStamp)
            latestConsumedFileStamp = f.lastModified();
        }
      }
      for (File f : customizations) {
        if (f.lastModified() > latestConsumedFileStamp) latestConsumedFileStamp = f.lastModified();
      }

      if (earliestProducedFileStamp < Long.MAX_VALUE
          && latestConsumedFileStamp < earliestProducedFileStamp) {
        log(Wadl2JavaMessages.SKIPPING_COMPILATION());
        return;
      }
    }

    // pre-requisites satisfied, compile the description
    try {
      Wadl2Java wadlProcessor = new Wadl2Java(target, pkg, autoPackage, customizations);
      wadlProcessor.process(desc);
    } catch (Exception ex) {
      ex.printStackTrace();
      throw new BuildException(Wadl2JavaMessages.PROCESSING_FAILED(), ex);
    }
  }
Ejemplo n.º 10
0
  public void execute() throws BuildException {

    if (_licenseFileName == null) {
      log.error("License file not specified");
      throw new BuildException("License file not specified");
    }
    File f = new File(_licenseFileName);
    if (!f.exists()) {
      log.error("License file doesn't exist");
      throw new BuildException("License file doesn't exist");
    }
    try {
      StringBuffer sb = new StringBuffer();
      BufferedReader br = new BufferedReader(new FileReader(f));
      String line = null;
      while ((line = br.readLine()) != null) {
        sb.append(line);
        sb.append("\n");
      }
      _updater.setText(sb.toString());
    } catch (Exception ex) {
      log.error("Error getting license text: " + ex.getMessage());
      throw new BuildException("Error getting license text: " + ex.getMessage(), ex);
    }

    try {
      _updater.validate();
    } catch (Exception ex) {
      log.error("Task not configured correctly: " + ex.getMessage());
      throw new BuildException("Task not configured correctly: " + ex.getMessage(), ex);
    }
    if (_fileSets.size() == 0) {
      log.error("A nested fileset element is required");
      throw new BuildException("A nested fileset element is required");
    }
    for (Iterator i = _fileSets.iterator(); i.hasNext(); ) {
      FileSet fileSet = (FileSet) i.next();
      DirectoryScanner ds = null;
      if (_outputDirName == null) {
        ds = fileSet.getDirectoryScanner(project);
      } else {
        File outputDir = new File(_outputDirName);
        if (!outputDir.exists()) {
          outputDir.mkdirs();
        }

        Copy copy = new Copy();
        copy.setProject(project);
        copy.addFileset(fileSet);
        copy.setTodir(outputDir);
        copy.setVerbose(false);
        copy.init();
        copy.execute();
        fileSet.setDir(outputDir);
        ds = fileSet.getDirectoryScanner(project);
      }
      String[] fileNames = ds.getIncludedFiles();
      String path = ds.getBasedir().getAbsolutePath();
      for (int j = 0; j < fileNames.length; j++) {
        _updater.getFiles().add(new File(path + "/" + fileNames[j]));
      }
    }

    try {
      _updater.run();
    } catch (Exception ex) {
      log.error("Error executing license updater: " + ex.getMessage());
      ex.printStackTrace();
      throw new BuildException("Error executing license updater: " + ex.getMessage(), ex);
    }
  }
Ejemplo n.º 11
0
  public void produce(final DataConsumer pReceiver) throws IOException {
    String user = Producers.ROOT_NAME;
    int uid = Producers.ROOT_UID;
    String group = Producers.ROOT_NAME;
    int gid = Producers.ROOT_UID;
    int filemode = TarEntry.DEFAULT_FILE_MODE;
    int dirmode = TarEntry.DEFAULT_DIR_MODE;
    String prefix = "";

    if (fileset instanceof Tar.TarFileSet) {
      Tar.TarFileSet tarfileset = (Tar.TarFileSet) fileset;
      user = tarfileset.getUserName();
      uid = tarfileset.getUid();
      group = tarfileset.getGroup();
      gid = tarfileset.getGid();
      filemode = tarfileset.getMode();
      dirmode = tarfileset.getDirMode(tarfileset.getProject());
      prefix = tarfileset.getPrefix(tarfileset.getProject());
    }

    final DirectoryScanner scanner = fileset.getDirectoryScanner(fileset.getProject());
    scanner.scan();

    final File basedir = scanner.getBasedir();

    for (String directory : scanner.getIncludedDirectories()) {
      String name = directory.replace('\\', '/');

      final TarArchiveEntry entry = new TarArchiveEntry(prefix + "/" + name);
      entry.setUserName(user);
      entry.setUserId(uid);
      entry.setGroupName(group);
      entry.setGroupId(gid);
      entry.setMode(dirmode);

      pReceiver.onEachDir(entry);
    }

    for (String filename : scanner.getIncludedFiles()) {
      final String name = filename.replace('\\', '/');
      final File file = new File(basedir, name);

      final InputStream inputStream = new FileInputStream(file);
      try {
        final String entryName = prefix + "/" + name;

        final File entryPath = new File(entryName);

        final boolean symbolicLink = SymlinkUtils.isSymbolicLink(entryPath);
        final TarArchiveEntry e;
        if (symbolicLink) {
          e = new TarArchiveEntry(entryName, TarConstants.LF_SYMLINK);
          e.setLinkName(SymlinkUtils.readSymbolicLink(entryPath));
        } else {
          e = new TarArchiveEntry(entryName, true);
        }

        e.setUserId(uid);
        e.setGroupId(gid);
        e.setUserName(user);
        e.setGroupName(group);
        e.setMode(filemode);
        e.setSize(file.length());

        pReceiver.onEachFile(inputStream, e);
      } finally {
        inputStream.close();
      }
    }
  }
Ejemplo n.º 12
0
  /**
   * Adds the contents of this class path element to the given class path.
   *
   * @param classPath the class path to be extended.
   * @param output specifies whether this is an output entry or not.
   */
  public void appendClassPathEntriesTo(ClassPath classPath, boolean output) {
    File baseDir = getProject().getBaseDir();
    String[] fileNames;

    if (isReference()) {
      // Get the referenced path or file set.
      Object referencedObject = getCheckedRef(DataType.class, DataType.class.getName());

      if (referencedObject instanceof Path) {
        Path path = (Path) referencedObject;

        // Get the names of the files in the referenced path.
        fileNames = path.list();
      } else if (referencedObject instanceof AbstractFileSet) {
        AbstractFileSet fileSet = (AbstractFileSet) referencedObject;

        // Get the names of the existing input files in the referenced file set.
        DirectoryScanner scanner = fileSet.getDirectoryScanner(getProject());
        baseDir = scanner.getBasedir();
        fileNames = scanner.getIncludedFiles();
      } else {
        throw new BuildException(
            "The refid attribute doesn't point to a <path> element or a <fileset> element");
      }
    } else {
      // Get the names of the files in this path.
      fileNames = list();
    }

    if (output) {
      if (fileNames.length != 1) {
        throw new BuildException(
            "The <outjar> element must specify exactly one file or directory ["
                + fileNames.length
                + "]");
      }
    }
    // else
    // {
    //    if (fileNames.length < 1)
    //    {
    //        throw new BuildException("The <injar> element must specify at least one file or
    // directory");
    //    }
    // }

    for (int index = 0; index < fileNames.length; index++) {
      // Create a new class path entry, with the proper file name and
      // any filters.
      String fileName = fileNames[index];
      File file = new File(fileName);

      ClassPathEntry entry =
          new ClassPathEntry(file.isAbsolute() ? file : new File(baseDir, fileName), output);
      entry.setFilter(ListUtil.commaSeparatedList(filter));
      entry.setApkFilter(ListUtil.commaSeparatedList(apkFilter));
      entry.setJarFilter(ListUtil.commaSeparatedList(jarFilter));
      entry.setAarFilter(ListUtil.commaSeparatedList(aarFilter));
      entry.setWarFilter(ListUtil.commaSeparatedList(warFilter));
      entry.setEarFilter(ListUtil.commaSeparatedList(earFilter));
      entry.setZipFilter(ListUtil.commaSeparatedList(zipFilter));

      // Add it to the class path.
      classPath.add(entry);
    }
  }