Package org.apache.tools.ant.types

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


  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

                    // Get the list of files.
                    srcFiles = scanner.getIncludedFiles();
                   
                } else if (next instanceof FileList) {
                   
                    FileList fileList = (FileList) next;
                   
                    // Determine the root path.
                    fileSetBase = fileList.getDir(project);
                   
                    // Get the list of files.
                    srcFiles = fileList.getFiles(project);
                   
                }

                // Concatenate the files.
                if (srcFiles != null) {
View Full Code Here

        //
        boolean upToDate            = true;
        Enumeration enumTargetLists = targetFileLists.elements();
        while (enumTargetLists.hasMoreElements()) {
                
           FileList targetFL    = (FileList) enumTargetLists.nextElement();
           String[] targetFiles = targetFL.getFiles(project);
                
           for (int i = 0; i < targetFiles.length; i++) {
                   
              File dest = new File(targetFL.getDir(project), 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(project);

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

                 if (src.lastModified() > now) {
                    log("Warning: " + sourceFiles[i]
                        + " modified in the future.", Project.MSG_WARN);
                 }
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

        {
            throw new BuildException( "Reference ID " + sourcesFilesetId + " already exists" );
        }
        */

        FileList fileList = new FileList();
        fileList.setDir( getLocalRepository().getPath() );

        FileSet fileSet = new FileSet();
        fileSet.setProject( getProject() );
        fileSet.setDir( fileList.getDir( getProject() ) );

        FileSet sourcesFileSet = new FileSet();
        sourcesFileSet.setDir( getLocalRepository().getPath() );

        FileSet javadocsFileSet = new FileSet();
View Full Code Here

                    baseDirs.removeAllElements();
                }
            }

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

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

        //
        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

        //
        boolean upToDate            = true;
        Enumeration enumTargetLists = targetFileLists.elements();
        while (enumTargetLists.hasMoreElements()) {
                
           FileList targetFL    = (FileList) enumTargetLists.nextElement();
           String[] targetFiles = targetFL.getFiles(project);
                
           for (int i = 0; i < targetFiles.length; i++) {
                   
              File dest = new File(targetFL.getDir(project), 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);
              }
           }
        }

        //
        // Check targets vs source files specified via filesets
        //
        if (upToDate) {
           Enumeration enumSourceSets = sourceFileSets.elements();
           while (upToDate && enumSourceSets.hasMoreElements()) {
         
              FileSet sourceFS          = (FileSet) enumSourceSets.nextElement();
              DirectoryScanner sourceDS = sourceFS.getDirectoryScanner(project);
              String[] sourceFiles      = sourceDS.getIncludedFiles();

              int i = 0;
              do {
                 File src = new File(sourceFS.getDir(project), sourceFiles[i]);

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

                 Enumeration enumTargets = allTargets.elements();
                 while (upToDate && enumTargets.hasMoreElements()) {
                
                    File dest = (File)enumTargets.nextElement();
                    if (src.lastModified() > dest.lastModified()) {
                       log(dest.getPath() + " is out of date with respect to " +
                                sourceFiles[i], Project.MSG_VERBOSE);
                       upToDate = false;

                    }
                 }
              } while (upToDate && (++i < sourceFiles.length) );
           }
        }

        //
        // 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(project);

              int i = 0;
              do {
                 File src = new File(sourceFL.getDir(project), sourceFiles[i]);

                 if (src.lastModified() > now) {
                    log("Warning: "+sourceFiles[i]+" modified in the future.",
                        Project.MSG_WARN);
                 }
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.