diff --git a/WHATSNEW b/WHATSNEW index 43a4e766a..a90ed9e3e 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -182,6 +182,9 @@ Other changes: silently ignores the message. BuildListeners still should avoid accessing either stream. +* Added a comment attribute to the zip task. + Bugzilla report 22793. + Fixed bugs: ----------- diff --git a/docs/manual/CoreTasks/zip.html b/docs/manual/CoreTasks/zip.html index bfeb60a1b..ecac78e8d 100644 --- a/docs/manual/CoreTasks/zip.html +++ b/docs/manual/CoreTasks/zip.html @@ -184,6 +184,11 @@ to a value other than its default, "add".

Defaults to true. Since Ant 1.6.2 No + + comment + Comment to store in the archive. Since Ant 1.6.3 + No +

Parameters specified as nested elements

fileset

diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index 9a2664300..7c4321f0d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -114,6 +114,12 @@ public class Zip extends MatchingTask { */ private boolean roundUp = true; + /** + * Comment for the archive. + * @since Ant 1.6.3 + */ + private String comment = ""; + /** * This is the name/location of where to * create the .zip file. @@ -290,6 +296,26 @@ public class Zip extends MatchingTask { public void setKeepCompression(boolean keep) { keepCompression = keep; } + + /** + * Comment to use for archive. + * + * @param comment The content of the comment. + * @since Ant 1.6.3 + */ + public void setComment(String comment) { + this.comment = comment; + } + + /** + * Comment of the archive + * + * @return Comment of the archive. + * @since Ant 1.6.3 + */ + public String getComment() { + return comment; + } /** * Whether the file modification times will be rounded up to the @@ -484,6 +510,7 @@ public class Zip extends MatchingTask { } addResources(oldFiles, r, zOut); } + zOut.setComment(comment); finalizeZipOutputStream(zOut); // If we've been successful on an update, delete the