Package org.apache.tools.ant.types

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


                    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


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

        if ( filesetId != null && getProject().getReference( filesetId ) != null )
        {
            throw new BuildException( "Reference ID " + filesetId + " already exists" );
        }

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

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

        if ( result.getArtifacts().isEmpty() )
        {
            fileSet.createExclude().setName( "**/**" );
        }
        else
        {
            for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
            {
                Artifact artifact = (Artifact) i.next();
                String filename = localRepo.pathOf( artifact );

                FileList.FileName file = new FileList.FileName();
                file.setName( filename );

                fileList.addConfiguredFile( file );

                fileSet.createInclude().setName( filename );
            }
        }

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.