org.apache.tools.ant.taskdefs.Zip Java Examples

The following examples show how to use org.apache.tools.ant.taskdefs.Zip. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MakeJNLP.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void processIndirectFiles(Writer fileWriter, String dashcnb) throws IOException, BuildException {
    if (indirectFiles == null) {
        return;
    }
    DirectoryScanner scan = indirectFiles.getDirectoryScanner(getProject());
    Map<String,File> entries = new LinkedHashMap<>();
    for (String f : scan.getIncludedFiles()) {
        entries.put(f.replace(File.separatorChar, '/'), new File(scan.getBasedir(), f));
    }
    if (entries.isEmpty()) {
        return;
    }
    File ext = new File(new File(targetFile, dashcnb), "extra-files.jar");
    Zip jartask = (Zip) getProject().createTask("jar");
    jartask.setDestFile(ext);
    for (Map.Entry<String,File> entry : entries.entrySet()) {
        ZipFileSet zfs = new ZipFileSet();
        zfs.setFile(entry.getValue());
        zfs.setFullpath("META-INF/files/" + entry.getKey());
        jartask.addZipfileset(zfs);
    }
    jartask.execute();
    fileWriter.write(constructJarHref(ext, dashcnb));
    signOrCopy(ext, null);
}
 
Example #2
Source File: TestFile.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestFile createZip(Object path) {
    Zip zip = new Zip();
    zip.setWhenempty((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "create"));
    TestFile zipFile = file(path);
    zip.setDestFile(zipFile);
    zip.setBasedir(this);
    zip.setExcludes("**");
    execute(zip);
    return zipFile;
}
 
Example #3
Source File: TestFile.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestFile createZip(Object path) {
    Zip zip = new Zip();
    zip.setWhenempty((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "create"));
    TestFile zipFile = file(path);
    zip.setDestFile(zipFile);
    zip.setBasedir(this);
    zip.setExcludes("**");
    execute(zip);
    return zipFile;
}
 
Example #4
Source File: TestFile.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestFile createZip(Object path) {
    Zip zip = new Zip();
    zip.setWhenempty((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "create"));
    TestFile zipFile = file(path);
    zip.setDestFile(zipFile);
    zip.setBasedir(this);
    zip.setExcludes("**");
    execute(zip);
    return zipFile;
}
 
Example #5
Source File: TestFile.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestFile createZip(Object path) {
    Zip zip = new Zip();
    zip.setWhenempty((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "create"));
    TestFile zipFile = file(path);
    zip.setDestFile(zipFile);
    zip.setBasedir(this);
    zip.setExcludes("**");
    execute(zip);
    return zipFile;
}