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

The following examples show how to use org.apache.tools.ant.taskdefs.Zip. These examples are extracted from open source projects. 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 Project: netbeans   Source File: MakeJNLP.java    License: 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 Project: pushfish-android   Source File: TestFile.java    License: 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 Project: pushfish-android   Source File: TestFile.java    License: 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 Project: Pushjet-Android   Source File: TestFile.java    License: 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 Project: Pushjet-Android   Source File: TestFile.java    License: 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;
}