PR: 21899 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@275010 13f79535-47bb-0310-9956-ffa450edef68master
@@ -548,6 +548,9 @@ If set to true, the process will be spawned. Bugzilla Report 5907. | |||||
<parallel> to throw an exception if any thread fails without | <parallel> to throw an exception if any thread fails without | ||||
waiting for all other threads to complete. | waiting for all other threads to complete. | ||||
* <zip> and friends will consume far less memory than they used to | |||||
when run with compress="false". Bugzilla Report 21899. | |||||
Changes from Ant 1.5.2 to Ant 1.5.3 | Changes from Ant 1.5.2 to Ant 1.5.3 | ||||
=================================== | =================================== | ||||
@@ -3891,6 +3891,43 @@ | |||||
valign="top" align="left"> | valign="top" align="left"> | ||||
Commercial | Commercial | ||||
</td> | </td> | ||||
</tr> | |||||
</table> | |||||
<h4 class="subsection"> | |||||
<a name="Zelix KlassMaster Java Obfuscator"></a> | |||||
Zelix KlassMaster Java Obfuscator | |||||
</h4> | |||||
<p>The task ZKMTask allows the Zelix KlassMaster Java obfuscator to be integrated into an Ant build.</p> | |||||
<table class="externals" cellspacing="1" cellpadding="4"> | |||||
<tr> | |||||
<th colspan="1" rowspan="1" | |||||
valign="top" align="left"> | |||||
Compatibility: | |||||
</th> | |||||
<td colspan="1" rowspan="1" | |||||
valign="top" align="left"> | |||||
Ant 1.4.1 | |||||
</td> | |||||
</tr> | |||||
<tr> | |||||
<th colspan="1" rowspan="1" | |||||
valign="top" align="left"> | |||||
URL: | |||||
</th> | |||||
<td colspan="1" rowspan="1" | |||||
valign="top" align="left"> | |||||
<a href="http://www.zelix.com/klassmaster/docs/buildToolApi.html">Zelix KlassMaster Ant Task</a> | |||||
</td> | |||||
</tr> | |||||
<tr> | |||||
<th colspan="1" rowspan="1" | |||||
valign="top" align="left"> | |||||
License: | |||||
</th> | |||||
<td colspan="1" rowspan="1" | |||||
valign="top" align="left"> | |||||
Commercial | |||||
</td> | |||||
</tr> | </tr> | ||||
</table> | </table> | ||||
@@ -27,6 +27,12 @@ | |||||
<ant antfile="zip.xml" target="cleanup" /> | <ant antfile="zip.xml" target="cleanup" /> | ||||
</target> | </target> | ||||
<target name="testUncompressedZipTask"> | |||||
<ant antfile="zip.xml" target="uncompressed-feather" /> | |||||
<unzip src="asf-logo.gif.zip" dest="." /> | |||||
<ant antfile="zip.xml" target="cleanup" /> | |||||
</target> | |||||
<target name="realTest"> | <target name="realTest"> | ||||
<unzip src="expected/asf-logo.gif.zip" dest="." /> | <unzip src="expected/asf-logo.gif.zip" dest="." /> | ||||
</target> | </target> | ||||
@@ -55,6 +55,12 @@ | |||||
includes="asf-logo.gif" /> | includes="asf-logo.gif" /> | ||||
</target> | </target> | ||||
<target name="uncompressed-feather"> | |||||
<zip destFile="asf-logo.gif.zip" | |||||
basedir=".." | |||||
includes="asf-logo.gif" compress="false"/> | |||||
</target> | |||||
<!-- legacy attribute support --> | <!-- legacy attribute support --> | ||||
<target name="test8"> | <target name="test8"> | ||||
<zip zipfile="test8.zip" basedir="." > | <zip zipfile="test8.zip" basedir="." > | ||||
@@ -977,15 +977,11 @@ public class Zip extends MatchingTask { | |||||
/* | /* | ||||
* ZipOutputStream.putNextEntry expects the ZipEntry to | * ZipOutputStream.putNextEntry expects the ZipEntry to | ||||
* know its size and the CRC sum before you start writing | * know its size and the CRC sum before you start writing | ||||
* the data when using STORED mode. | |||||
* the data when using STORED mode - unless it is seekable. | |||||
* | * | ||||
* This forces us to process the data twice. | * This forces us to process the data twice. | ||||
* | |||||
* In DEFLATED mode, it will take advantage of a Zip | |||||
* Version 2 feature where size can be stored after the | |||||
* data (as the data itself signals end of data). | |||||
*/ | */ | ||||
if (!doCompress) { | |||||
if (!zOut.isSeekable() && !doCompress) { | |||||
long size = 0; | long size = 0; | ||||
CRC32 cal = new CRC32(); | CRC32 cal = new CRC32(); | ||||
if (!in.markSupported()) { | if (!in.markSupported()) { | ||||
@@ -80,12 +80,12 @@ import java.util.zip.ZipException; | |||||
* file.</p> | * file.</p> | ||||
* | * | ||||
* <p>If RandomAccessFile cannot be used, this implementation will use | * <p>If RandomAccessFile cannot be used, this implementation will use | ||||
* a Data Descriptor to store size and | |||||
* CRC information for DEFLATED entries, this means, you don't need to | |||||
* a Data Descriptor to store size and CRC information for {@link | |||||
* #DEFLATED DEFLATED} entries, this means, you don't need to | |||||
* calculate them yourself. Unfortunately this is not possible for | * calculate them yourself. Unfortunately this is not possible for | ||||
* the STORED method, here setting the CRC and uncompressed size | |||||
* information is required before {@link #putNextEntry putNextEntry} | |||||
* will be called.</p> | |||||
* the {@link #STORED STORED} method, here setting the CRC and | |||||
* uncompressed size information is required before {@link | |||||
* #putNextEntry putNextEntry} can be called.</p> | |||||
* | * | ||||
* @author Stefan Bodewig | * @author Stefan Bodewig | ||||
* @author Richard Evans | * @author Richard Evans | ||||
@@ -290,6 +290,20 @@ public class ZipOutputStream extends FilterOutputStream { | |||||
} | } | ||||
} | } | ||||
/** | |||||
* Is this archive writing to a seekable stream (i.e. a random | |||||
* access file)? | |||||
* | |||||
* <p>For seekable streams, you don't need to calculate the CRC or | |||||
* uncompressed size for {@link #STORED STORED} entries before | |||||
* invoking {@link #putEntry putEntry}. | |||||
* | |||||
* @since 1.17 | |||||
*/ | |||||
public boolean isSeekable() { | |||||
return raf != null; | |||||
} | |||||
/** | /** | ||||
* The encoding to use for filenames and the file comment. | * The encoding to use for filenames and the file comment. | ||||
* | * | ||||
@@ -101,6 +101,13 @@ public class UnzipTest extends BuildFileTest { | |||||
project.resolveFile("asf-logo.gif"))); | project.resolveFile("asf-logo.gif"))); | ||||
} | } | ||||
public void testTestUncompressedZipTask() throws java.io.IOException { | |||||
FileUtils fileUtils = FileUtils.newFileUtils(); | |||||
executeTarget("testUncompressedZipTask"); | |||||
assertTrue(fileUtils.contentEquals(project.resolveFile("../asf-logo.gif"), | |||||
project.resolveFile("asf-logo.gif"))); | |||||
} | |||||
/* | /* | ||||
* PR 11100 | * PR 11100 | ||||
*/ | */ | ||||