Browse Source

Add support of zip comment.

PR: 22793
Obtained from: Larry Shatzer


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277383 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
8d72468ce0
3 changed files with 35 additions and 0 deletions
  1. +3
    -0
      WHATSNEW
  2. +5
    -0
      docs/manual/CoreTasks/zip.html
  3. +27
    -0
      src/main/org/apache/tools/ant/taskdefs/Zip.java

+ 3
- 0
WHATSNEW View File

@@ -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:
-----------



+ 5
- 0
docs/manual/CoreTasks/zip.html View File

@@ -184,6 +184,11 @@ to a value other than its default, <code>&quot;add&quot;</code>.</b></p>
Defaults to true. <em>Since Ant 1.6.2</em></td>
<td align="center" valign="top">No</td>
</tr>
<tr>
<td valign="top">comment</td>
<td valign="top">Comment to store in the archive. <em>Since Ant 1.6.3</em></td>
<td valign="top" align="center">No</td>
</tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>fileset</h4>


+ 27
- 0
src/main/org/apache/tools/ant/taskdefs/Zip.java View File

@@ -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


Loading…
Cancel
Save