Package org.apache.tools.ant.types

Examples of org.apache.tools.ant.types.FileList


                touch(fromDir, srcDirs[j], defaultTimestamp);
            }
        }
        // deal with the filelists
        for (int i = 0; i < filelists.size(); i++) {
            FileList fl = (FileList) filelists.elementAt(i);
            File fromDir = fl.getDir(getProject());

            String[] srcFiles = fl.getFiles(getProject());

            for (int j = 0; j < srcFiles.length; j++) {
                touch(fromDir, srcFiles[j], defaultTimestamp);
            }
        }
View Full Code Here


                    fileSet.getDirectoryScanner(getProject());
                checkAddFiles(fileSet.getDir(getProject()),
                              scanner.getIncludedFiles());

            } else if (o instanceof FileList) {
                FileList fileList = (FileList) o;
                checkAddFiles(fileList.getDir(getProject()),
                              fileList.getFiles(getProject()));
            }
        }

        // check if the files are outofdate
        if (destinationFile != null && !forceOverwrite
View Full Code Here

        // Grab all the target files specified via filelists:
        boolean upToDate = true;
        Enumeration enumTargetLists = targetFileLists.elements();
        while (enumTargetLists.hasMoreElements()) {

           FileList targetFL    = (FileList) enumTargetLists.nextElement();
           String[] targetFiles = targetFL.getFiles(getProject());

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

              File dest = new File(targetFL.getDir(getProject()), targetFiles[i]);
              if (!dest.exists()) {
                 log(targetFiles[i] + " does not exist.", Project.MSG_VERBOSE);
                 upToDate = false;
                 continue;
              } else {
                 allTargets.addElement(dest);
              }
              if (dest.lastModified() > now) {
                 log("Warning: " + targetFiles[i] + " modified in the future.",
                     Project.MSG_WARN);
              }
              if (oldestTarget == null
                  || dest.lastModified() < oldestTargetTime) {
                  oldestTargetTime = dest.lastModified();
                  oldestTarget = dest;
              }
           }
        }
        if (oldestTarget != null) {
            log(oldestTarget + " is oldest target file", Project.MSG_VERBOSE);
        } else {
            // no target files, then we cannot remove any target files and
            // skip the following tests right away
            upToDate = false;
        }
        // Check targets vs source files specified via filelists:
        if (upToDate) {
           Enumeration enumSourceLists = sourceFileLists.elements();
           while (upToDate && enumSourceLists.hasMoreElements()) {

              FileList sourceFL    = (FileList) enumSourceLists.nextElement();
              String[] sourceFiles = sourceFL.getFiles(getProject());

              for (int i = 0; upToDate && i < sourceFiles.length; i++) {
                 File src = new File(sourceFL.getDir(getProject()), sourceFiles[i]);

                 if (src.lastModified() > now) {
                    log("Warning: " + sourceFiles[i]
                        + " modified in the future.", Project.MSG_WARN);
                 }
View Full Code Here

                    fileNames.removeAllElements();
                    baseDirs.removeAllElements();
                }
            }
            for (int i = 0; i < filelists.size(); i++) {
                FileList list = (FileList) filelists.elementAt(i);
                File base = list.getDir(getProject());
                String[] names = getFilesAndDirs(list);

                for (int j = 0; j < names.length; j++) {
                    File f = new File(base, names[j]);
                    if ((!ignoreMissing) || (f.isFile() && !"dir".equals(type))
                        || (f.isDirectory() && !"file".equals(type))) {

                        if (ignoreMissing || f.isFile()) {
                            totalFiles++;
                        } else {
                            totalDirs++;
                        }
                        fileNames.addElement(names[j]);
                        baseDirs.addElement(base);
                    }
                }
                if (fileNames.size() == 0 && skipEmpty) {
                    DirectoryScanner ds = new DirectoryScanner();
                    ds.setBasedir(base);
                    ds.setIncludes(list.getFiles(getProject()));
                    ds.scan();
                    int includedCount
                        = ds.getIncludedFilesCount() + ds.getIncludedDirsCount();

                    log("Skipping filelist for directory " + base + ". It is "
View Full Code Here

        File additionalMaps[] = new File[1];
        additionalMaps[0] = new File(destDir, "testmap.map.xml");
        ResourceUtil.copyResourceToFile("testmap.map.xml", additionalMaps[0]);

        FileList additionalMapsFilelist = new FileList();
        additionalMapsFilelist.setDir(additionalMaps[0].getParentFile());
        additionalMapsFilelist.setFiles(additionalMaps[0].getName());

        Path additionalMapsPath = new Path(task.getProject());
        additionalMapsPath.addFilelist(additionalMapsFilelist);

        // setup task
View Full Code Here

        File additionalMaps[] = new File[1];
        additionalMaps[0] = new File(destDir, "testmap.map.xml");
        ResourceUtil.copyResourceToFile("testmap.map.xml", additionalMaps[0]);

        FileList additionalMapsFilelist = new FileList();
        additionalMapsFilelist.setDir(additionalMaps[0].getParentFile());
        additionalMapsFilelist.setFiles(additionalMaps[0].getName());

        Path additionalMapsPath = new Path(task.getProject());
        additionalMapsPath.addFilelist(additionalMapsFilelist);

        // setup task
View Full Code Here

  private long getLastModifiedTime(List<?> fileLists) {
    long lastModified = 0;

    for (Object entry : fileLists) {
      if (entry instanceof FileList) {
        FileList list = (FileList) entry;

        for (String fileName : list.getFiles(this.getProject())) {
          File path = list.getDir(this.getProject());
          File file = new File(path, fileName);
          lastModified = Math.max(getLastModifiedTime(file), lastModified);
        }
      } else if (entry instanceof Path) {
        Path path = (Path) entry;
View Full Code Here

                } else if (obj instanceof DirSet) {
                    DirSet ds = (DirSet) obj;

                    path.addDirset(ds);
                } else if (obj instanceof FileList) {
                    FileList fl = (FileList) obj;

                    path.addFilelist(fl);

                } else {
                    throw new BuildException("'refid' does not refer to a "
View Full Code Here

            sNameArray = fset.getDirectoryScanner(getProject()).getIncludedFiles();
            dir = fset.getDir();
         }
         else if (rc instanceof FileList)
         {
            FileList flist = (FileList)rc;
            sNameArray = flist.getFiles(getProject());
            dir = flist.getDir(getProject());
         }
         else if (rc instanceof DirSet)
         {
            DirSet dset = (DirSet)rc;
            dir = dset.getDir(getProject());
View Full Code Here

   * Create child element for list of config files.
   * Task Can have only one such child
   * @return
   */
  public FileList createConfigs() {
    this._configs = new FileList();
    return _configs;
  }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.types.FileList

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.