Author: bodewig
Date: Tue Aug 25 04:31:56 2009
New Revision: 807474

URL: http://svn.apache.org/viewvc?rev=807474&view=rev
Log:
port comment from core <zip>

Modified:
    
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
    ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml

Modified: 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java?rev=807474&r1=807473&r2=807474&view=diff
==============================================================================
--- 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
 (original)
+++ 
ant/sandbox/antlibs/compress/trunk/src/main/org/apache/ant/compress/taskdefs/Zip.java
 Tue Aug 25 04:31:56 2009
@@ -34,6 +34,7 @@
  */
 public class Zip extends ArchiveBase {
     private int level = Deflater.DEFAULT_COMPRESSION;
+    private String comment = "";
 
     public Zip() {
         setFactory(new ZipStreamFactory() {
@@ -44,6 +45,7 @@
                         (ZipArchiveOutputStream) super.getArchiveStream(stream,
                                                                         
encoding);
                     o.setLevel(level);
+                    o.setComment(comment);
                     return o;
                 }
             });
@@ -86,4 +88,13 @@
     public void setLevel(int level) {
         this.level = level;
     }
+
+    /**
+     * Comment to use for archive.
+     *
+     * @param comment The content of the comment.
+     */
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
 }
\ No newline at end of file

Modified: ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml
URL: 
http://svn.apache.org/viewvc/ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml?rev=807474&r1=807473&r2=807474&view=diff
==============================================================================
--- ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml (original)
+++ ant/sandbox/antlibs/compress/trunk/src/tests/antunit/zip-test.xml Tue Aug 
25 04:31:56 2009
@@ -376,4 +376,12 @@
     </au:assertTrue>
   </target>
 
+  <target name="testComment" depends="setUp">
+    <cmp:zip destfile="${output}/test.zip" comment="This is a comment">
+      <file file="${ant.file}"/>
+    </cmp:zip>
+    <!-- not sure how to test this without a new condition, checked
+         with command line zip -->
+  </target>
+
 </project>


Reply via email to