Package org.apache.tools.ant.types

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


            }
        }
    }

    private void addBuildFile(Path path, File buildFile) {
        FileList fl = new FileList();
        fl.setDir(buildFile.getParentFile());
        FileList.FileName fileName = new FileList.FileName();
        fileName.setName(buildFile.getName());
        fl.addConfiguredFile(fileName);
        path.addFilelist(fl);
    }
View Full Code Here


    return addSignaturesResource(new FileSet());
  }

  /** List of files with API signatures as <signaturesFileList/> nested element */
  public FileList createSignaturesFileList() {
    return addSignaturesResource(new FileList());
  }
View Full Code Here

          }
    }
    }

    private void addBuildFile(Path path, File buildFile) {
        FileList fl = new FileList();
        fl.setDir(buildFile.getParentFile());
        FileList.FileName fileName = new FileList.FileName();
        fileName.setName(buildFile.getName());
        fl.addConfiguredFile(fileName);
        path.addFilelist(fl);
    }
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

            }
        }

        // 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(new File(fromDir, srcFiles[j]));
            }
        }
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

                    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) {
                    ExtendedDirectoryScanner ds = new ExtendedDirectoryScanner();
                    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

                } 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

        {
            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() ) );

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

        FileSet sourcesFileSet = new FileSet();
        sourcesFileSet.setDir( sourcesFileList.getDir( getProject() ) );

        Set versions = new HashSet();
       
        if ( result.getArtifacts().isEmpty() )
        {
            fileSet.createExclude().setName( "**/**" );
        }
        else
        {
            for ( Iterator i = result.getArtifacts().iterator(); i.hasNext(); )
            {
                Artifact artifact = (Artifact) i.next();
                artifact.isSnapshot(); // MNG-2961: DefaultArtifact getBaseVersion is changed to "xxxx-SNAPSHOT" only if you first call isSnapshot()
                String filename = localRepo.pathOf( artifact );

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

                fileList.addConfiguredFile( file );

                fileSet.createInclude().setName( filename );
               
                versions.add( artifact.getBaseVersion() );

                if ( sourcesFilesetId != null )
                {
                    log( "Resolving dependencies sources...", Project.MSG_VERBOSE );
                    // get sources
                    Artifact sourcesArtifact =
                        artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(),
                                                                      artifact.getVersion(), "java-source", "sources" );
                    if ( sourcesArtifact != null )
                    {
                        try
                        {
                            resolver.resolve( sourcesArtifact, remoteArtifactRepositories, localRepo );
                            String sourcesFilename = localRepo.pathOf( sourcesArtifact );

                            FileList.FileName sourcesFile = new FileList.FileName();
                            sourcesFile.setName( sourcesFilename );

                            sourcesFileList.addConfiguredFile( sourcesFile );

                            sourcesFileSet.createInclude().setName( sourcesFilename );
                        }
                        catch ( ArtifactResolutionException e )
                        {
View Full Code Here

        catch ( InvalidDependencyVersionException e )
        {
            throw new BuildException( e.getMessage(), e );
        }

        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

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.