Summary: | Zip task does not support DEFLATE method for directories | ||
---|---|---|---|
Product: | Ant | Reporter: | Matt Accola <mraccola> |
Component: | Core tasks | Assignee: | Ant Notifications List <notifications> |
Status: | NEW --- | ||
Severity: | enhancement | ||
Priority: | P2 | ||
Version: | 1.8.1 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All |
Description
Matt Accola
2011-11-11 14:14:16 UTC
ZipCopySpecVisitor.java is not part of Ant. Why would anybody want to create archives using DEFLATE for directories? They don't have any content to compress and a DEFLATEd diretory entry will end up requiring more space than a STOREd one. Sorry about the bad reference. The source code reference is line 1664 of Zip.java. I'm no expert on compression methods so I don't know the value of setting the method at the directory level. The reason why I personally need it is so that I can compare a JAR file created by Ant's jar task to another JAR file produced by a different tool (in my case Gradle). This is important for me to make sure that the artifacts produced are identical. If gradle doesn't use Ant's zip package (or Apache Commons Compress) but rather java.util.zip there will be many differences (internal and external attributes, possibly UTF encoding flags, likely more). I don't think you can achieve binary identical archives if the underlying implementations are different at all. Outside of your very specific use-case adding an attribute to the zip task to DEFLATE directory entries (along with the cost of testing, documenting and maintaining said flag) doesn't really seem to make sense. I really appreciate your quick responses and understand your position. For now I am working around by changing the Ant source code and building my own custom Ant JARs. That is working well. Actually after the change I can do a complete comparison using the ZipDiff tool located here, http://zipdiff.sourceforge.net/ Just as an FYI here is a link to the Gradle class that sets the DEFLATED method: https://github.com/gradle/gradle/blob/master/subprojects/core/src/main/groovy/org/gradle/api/internal/file/archive/ZipCopySpecVisitor.java |