Search in sources :

Example 1 with DirectoryScanner

use of org.apache.tools.ant.DirectoryScanner in project tomcat by apache.

the class SignCode method execute.

@Override
public void execute() throws BuildException {
    List<File> filesToSign = new ArrayList<>();
    // signed.
    for (FileSet fileset : filesets) {
        DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
        File basedir = ds.getBasedir();
        String[] files = ds.getIncludedFiles();
        if (files.length > 0) {
            for (int i = 0; i < files.length; i++) {
                File file = new File(basedir, files[i]);
                filesToSign.add(file);
            }
        }
    }
    try {
        String signingSetID = makeSigningRequest(filesToSign);
        downloadSignedFiles(filesToSign, signingSetID);
    } catch (SOAPException | IOException e) {
        throw new BuildException(e);
    }
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) SOAPException(javax.xml.soap.SOAPException) ArrayList(java.util.ArrayList) IOException(java.io.IOException) BuildException(org.apache.tools.ant.BuildException) File(java.io.File)

Example 2 with DirectoryScanner

use of org.apache.tools.ant.DirectoryScanner in project hibernate-orm by hibernate.

the class SchemaExportTask method getFiles.

private String[] getFiles() {
    List<String> files = new LinkedList<String>();
    for (FileSet fileSet : fileSets) {
        final DirectoryScanner ds = fileSet.getDirectoryScanner(getProject());
        final String[] dsFiles = ds.getIncludedFiles();
        for (String dsFileName : dsFiles) {
            File f = new File(dsFileName);
            if (!f.isFile()) {
                f = new File(ds.getBasedir(), dsFileName);
            }
            files.add(f.getAbsolutePath());
        }
    }
    return ArrayHelper.toStringArray(files);
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) File(java.io.File) LinkedList(java.util.LinkedList)

Example 3 with DirectoryScanner

use of org.apache.tools.ant.DirectoryScanner in project hibernate-orm by hibernate.

the class SchemaUpdateTask method collectFiles.

private String[] collectFiles() {
    List<String> files = new LinkedList<String>();
    for (FileSet fileSet : fileSets) {
        final DirectoryScanner ds = fileSet.getDirectoryScanner(getProject());
        final String[] dsFiles = ds.getIncludedFiles();
        for (String dsFileName : dsFiles) {
            File f = new File(dsFileName);
            if (!f.isFile()) {
                f = new File(ds.getBasedir(), dsFileName);
            }
            files.add(f.getAbsolutePath());
        }
    }
    return ArrayHelper.toStringArray(files);
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) File(java.io.File) LinkedList(java.util.LinkedList)

Example 4 with DirectoryScanner

use of org.apache.tools.ant.DirectoryScanner in project hibernate-orm by hibernate.

the class SchemaValidatorTask method collectFiles.

private String[] collectFiles() {
    List<String> files = new ArrayList<String>();
    for (Object fileSet : fileSets) {
        final FileSet fs = (FileSet) fileSet;
        final DirectoryScanner ds = fs.getDirectoryScanner(getProject());
        for (String dsFile : ds.getIncludedFiles()) {
            File f = new File(dsFile);
            if (!f.isFile()) {
                f = new File(ds.getBasedir(), dsFile);
            }
            files.add(f.getAbsolutePath());
        }
    }
    return ArrayHelper.toStringArray(files);
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) ArrayList(java.util.ArrayList) File(java.io.File)

Example 5 with DirectoryScanner

use of org.apache.tools.ant.DirectoryScanner in project processing by processing.

the class AppBundlerTask method copyLibraryPathEntries.

private void copyLibraryPathEntries(File macOSDirectory) throws IOException {
    for (FileSet fileSet : libraryPath) {
        File libraryPathDirectory = fileSet.getDir();
        DirectoryScanner directoryScanner = fileSet.getDirectoryScanner(getProject());
        String[] includedFiles = directoryScanner.getIncludedFiles();
        for (String includedFile : includedFiles) {
            File source = new File(libraryPathDirectory, includedFile);
            File destination = new File(macOSDirectory, new File(includedFile).getName());
            copy(source, destination);
        }
    }
}
Also used : FileSet(org.apache.tools.ant.types.FileSet) DirectoryScanner(org.apache.tools.ant.DirectoryScanner) File(java.io.File)

Aggregations

DirectoryScanner (org.apache.tools.ant.DirectoryScanner)150 File (java.io.File)122 FileSet (org.apache.tools.ant.types.FileSet)84 BuildException (org.apache.tools.ant.BuildException)73 IOException (java.io.IOException)38 ArrayList (java.util.ArrayList)32 Project (org.apache.tools.ant.Project)14 Resource (org.apache.tools.ant.types.Resource)11 Test (org.junit.Test)11 FileResource (org.apache.tools.ant.types.resources.FileResource)8 HashMap (java.util.HashMap)7 Path (org.apache.tools.ant.types.Path)7 Hashtable (java.util.Hashtable)6 PatternSet (org.apache.tools.ant.types.PatternSet)6 FileWriter (java.io.FileWriter)5 LinkedList (java.util.LinkedList)5 List (java.util.List)5 StringTokenizer (java.util.StringTokenizer)5 Vector (java.util.Vector)5 DirSet (org.apache.tools.ant.types.DirSet)5