Examples of ZipFileSet


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

        entries.clear();
        addingNewFiles = false;
        doUpdate = savedDoUpdate;
        Enumeration e = filesetsFromGroupfilesets.elements();
        while (e.hasMoreElements()) {
            ZipFileSet zf = (ZipFileSet) e.nextElement();
            filesets.removeElement(zf);
        }
        filesetsFromGroupfilesets.removeAllElements();
    }
View Full Code Here

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

                                     + deploymentDescriptor
                                     + " does not exist.");
        }

        // Create a ZipFileSet for this file, and pass it up.
        ZipFileSet fs = new ZipFileSet();
        fs.setFile(deploymentDescriptor);
        fs.setFullpath("META-INF/application.xml");
        super.addFileset(fs);
    }
View Full Code Here

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

            archiver = tar;
        } else if ("zip".equals(artifact.getType())) {
            Zip zip = new Zip();
            zip.setDestFile(dest);
            ZipFileSet fs = new ZipFileSet();
            fs.setDir(source);
            fs.setPrefix(serverName);
            fs.setProject(project);
            fs.setExcludes("bin/");
            zip.addFileset(fs);

            fs = new ZipFileSet();
            fs.setDir(source);
            fs.setPrefix(serverName);
            fs.setProject(project);
            fs.setIncludes("bin/");
            fs.setExcludes("bin/*.bat");
            fs.setFileMode("755");
            zip.add(fs);

            fs = new ZipFileSet();
            fs.setDir(source);
            fs.setPrefix(serverName);
            fs.setProject(project);
            fs.setIncludes("bin/*.bat");
            zip.add(fs);

            for (Resource resource: this.project.getResources()) {
                File resourceFile = new File(resource.getDirectory());
                if (resourceFile.exists()) {
                    fs = new ZipFileSet();
                    fs.setPrefix(serverName);
                    fs.setProject(project);
                    fs.setDir(resourceFile);
                    fs.appendIncludes(resource.getIncludes().toArray(new String[0]));
                    fs.appendExcludes(resource.getExcludes().toArray(new String[0]));
                    zip.add(fs);
                }
            }

            archiver = zip;
View Full Code Here

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

    protected void processLibrary(Jar jarTask, Library lib, HashMap<File, ZipFileSet> fileSets, File srcDir) {
        final String jarName = jarTask.getDestFile().getName();
        final File f = getLibraryFile(lib, srcDir);

        ZipFileSet fs = fileSets.get(f);
        if (fs == null) {
            fs = new ZipFileSet();
            if (f.isFile()) {
                fs.setSrc(f);
            } else {
                fs.setDir(f);
            }
            fileSets.put(f, fs);
            jarTask.addFileset(fs);
        }
        fs.createExclude().setName("**/package.html");

        final String[] excludes = lib.getExcludes();
        for (int i = 0; i < excludes.length; i++) {
            final String exclude = excludes[i];
            if (exclude.equals("*")) {
                fs.createExclude().setName("**/*");               
            } else {
                String exp = exclude.replace('.', '/');
                fs.createExclude().setName(exp + ".*");
                fs.createExclude().setName(exp + ".class");
                if (!exp.endsWith("*")) {
                    fs.createExclude().setName(exp + "*");
                } else {
                    fs.createExclude().setName(exp);
                }
            }
        }

        final String[] exports = lib.getExports();
        for (int i = 0; i < exports.length; i++) {
            final String export = exports[i];
            if (export.equals("*")) {
                checkPackageExists(jarName, export, f);
                fs.createInclude().setName("**/*");               
            } else {
                String exp = export.replace('.', '/');
                fs.createInclude().setName(exp + ".*");
                if (!exp.endsWith("*")) {
                    checkPackageExists(jarName, exp, f);
                    fs.createInclude().setName(exp + "*");
                } else {
                    checkPackageExists(jarName, exp, f);
                    fs.createInclude().setName(exp);
                }
            }
        }
    }
View Full Code Here

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

    private File tmpDir = new File(System.getProperty("java.io.tmpdir"));

    private PluginBuilder packager;

    public ZipFileSet createDescriptors() {
        final ZipFileSet fs = new ZipFileSet();
        descriptorSets.add(fs);
        return fs;
    }
View Full Code Here

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

    private void copyFileSet(FileSet fileset, ZipOutputStream out) throws IOException {
      String prefix = null;
      String fullPath = null;
      if (fileset instanceof ZipFileSet) {
          ZipFileSet zfs = (ZipFileSet) fileset;
            fullPath = zfs.getFullpath(getProject());
          prefix = zfs.getPrefix(getProject());
            if (prefix != null && !prefix.endsWith("/"))
                prefix = prefix + "/";
      }
      DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
        String[] srcFiles = ds.getIncludedFiles();
View Full Code Here

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

                    }
                }

                if (doUpdate) {
                    addingNewFiles = false;
                    ZipFileSet oldFiles = new ZipFileSet();
                    oldFiles.setProject(getProject());
                    oldFiles.setSrc(renamedFile);
                    oldFiles.setDefaultexcludes(false);

                    for (int i = 0; i < addedFiles.size(); i++) {
                        PatternSet.NameEntry ne = oldFiles.createExclude();
                        ne.setName((String) addedFiles.elementAt(i));
                    }
                    DirectoryScanner ds =
                        oldFiles.getDirectoryScanner(getProject());
                    ((ZipScanner) ds).setEncoding(encoding);

                    String[] f = ds.getIncludedFiles();
                    Resource[] r = new Resource[f.length];
                    for (int i = 0; i < f.length; i++) {
View Full Code Here

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

            File basedir = scanner.getBasedir();
            for (int j = 0; j < files.length; j++) {

                logWhenWriting("Adding file " + files[j] + " to fileset",
                               Project.MSG_VERBOSE);
                ZipFileSet zf = new ZipFileSet();
                zf.setProject(getProject());
                zf.setSrc(new File(basedir, files[j]));
                add(zf);
                filesetsFromGroupfilesets.addElement(zf);
            }
        }
    }
View Full Code Here

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

                continue;
            }

            FileNameMapper myMapper = new IdentityMapper();
            if (filesets[i] instanceof ZipFileSet) {
                ZipFileSet zfs = (ZipFileSet) filesets[i];
                if (zfs.getFullpath(getProject()) != null
                    && !zfs.getFullpath(getProject()).equals("")) {
                    // in this case all files from origin map to
                    // the fullPath attribute of the zipfileset at
                    // destination
                    MergingMapper fm = new MergingMapper();
                    fm.setTo(zfs.getFullpath(getProject()));
                    myMapper = fm;

                } else if (zfs.getPrefix(getProject()) != null
                           && !zfs.getPrefix(getProject()).equals("")) {
                    GlobPatternMapper gm = new GlobPatternMapper();
                    gm.setFrom("*");
                    String prefix = zfs.getPrefix(getProject());
                    if (!prefix.endsWith("/") && !prefix.endsWith("\\")) {
                        prefix += "/";
                    }
                    gm.setTo(prefix + "*");
                    myMapper = gm;
View Full Code Here

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

    protected Resource[][] grabResources(FileSet[] filesets) {
        Resource[][] result = new Resource[filesets.length][];
        for (int i = 0; i < filesets.length; i++) {
            boolean skipEmptyNames = true;
            if (filesets[i] instanceof ZipFileSet) {
                ZipFileSet zfs = (ZipFileSet) filesets[i];
                skipEmptyNames = zfs.getPrefix(getProject()).equals("")
                    && zfs.getFullpath(getProject()).equals("");
            }
            DirectoryScanner rs =
                filesets[i].getDirectoryScanner(getProject());
            if (rs instanceof ZipScanner) {
                ((ZipScanner) rs).setEncoding(encoding);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.