You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Stefan Bodewig <bo...@bost.de> on 2000/05/18 10:23:33 UTC

[PATCH] make compression in Zip and Jar optional

Hi,

the appended patch adds a boolean compress attribute to the zip task,
which gets inherited by the jar task. 

If this attribute is set to false, files will be STORED instead of
DEFLATED. The default is to compress.

Rationale:

Older JVMs don't support compressed JAR files. The command line jar
tool addresses this via the 0 option, Ant doesn't have a way to
achieve the same effect.

Notes:

1. I had thought it would be quite straight forward to implement this
feature, just set the ZipOutputStream's method to STORED instead of
DEFLATED. 

Wrong, if you use STORED, you are expected to calculate the CRC32
checksum for the entries yourself - even before writing the data to
the stream. This I've learned the hard way, I couldn't find any hint
in the API docs. If anybody has a pointer to where this is documented
I'd like to hear.

2. While the zip task just ignored directories the jar task
added empty entries to the stream. 

Those empty entries really cause problems in STORED mode so I've
dropped them in jar as well. I couldn't see any problems with this
approach during my tests but maybe ...

Stefan