bodewig 2004/05/25 04:48:35
Modified: . Tag: ANT_16_BRANCH WHATSNEW
docs/manual/CoreTasks Tag: ANT_16_BRANCH ear.html jar.html
war.html zip.html
src/main/org/apache/tools/ant/taskdefs Tag: ANT_16_BRANCH
Zip.java
Log:
Merge fix for PR#17934
Revision Changes Path
No revision
No revision
1.503.2.92 +5 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.503.2.91
retrieving revision 1.503.2.92
diff -u -r1.503.2.91 -r1.503.2.92
--- WHATSNEW 18 May 2004 09:04:27 -0000 1.503.2.91
+++ WHATSNEW 25 May 2004 11:48:34 -0000 1.503.2.92
@@ -149,6 +149,11 @@
* Ignore built distributions. Bugzilla Report 28997.
+* A new roundup attribute on <zip> and related task can be used to
+ control whether the file modification times inside the archive will
+ be rounded up or down (since zips only store modification times with
+ a granularity of two seconds). The default remains to round up.
+ Bugzilla Report 17934.
Changes from Ant 1.6.0 to Ant 1.6.1
=============================================
No revision
No revision
1.16.2.3 +14 -0 ant/docs/manual/CoreTasks/ear.html
Index: ear.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/ear.html,v
retrieving revision 1.16.2.2
retrieving revision 1.16.2.3
diff -u -r1.16.2.2 -r1.16.2.3
--- ear.html 9 Feb 2004 22:12:07 -0000 1.16.2.2
+++ ear.html 25 May 2004 11:48:35 -0000 1.16.2.3
@@ -115,6 +115,20 @@
<td valign="top">behavior when a duplicate file is found. Valid values
are "add", "preserve", and "fail". The default
value is "add". </td>
<td valign="top" align="center">No</td>
</tr>
+ <tr>
+ <td valign="top">roundup</td>
+ <td valign="top">Whether the file modification times will be
+ rounded up to the next even number of seconds.<br>
+ Zip archives store file modification times with a granularity of
+ two seconds, so the times will either be rounded up or down. If
+ you round down, the archive will always seem out-of-date when you
+ rerun the task, so the default is to round up. Rounding up may
+ lead to a different type of problems like JSPs inside a web
+ archive that seem to be slightly more recent than precompiled
+ pages, rendering precompilation useless.<br>
+ Defaults to true. <em>Since Ant 1.6.2</em></td>
+ <td align="center" valign="top">No</td>
+ </tr>
</table>
<h3>Nested elements</h3>
<h4>metainf</h4>
1.28.2.4 +14 -0 ant/docs/manual/CoreTasks/jar.html
Index: jar.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/jar.html,v
retrieving revision 1.28.2.3
retrieving revision 1.28.2.4
diff -u -r1.28.2.3 -r1.28.2.4
--- jar.html 13 May 2004 07:13:50 -0000 1.28.2.3
+++ jar.html 25 May 2004 11:48:35 -0000 1.28.2.4
@@ -175,6 +175,20 @@
<td valign="top">The encoding used to read the JAR manifest, when a
manifest file is specified.</td>
<td valign="top" align="center">No, defaults to the platform
encoding.</td>
</tr>
+ <tr>
+ <td valign="top">roundup</td>
+ <td valign="top">Whether the file modification times will be
+ rounded up to the next even number of seconds.<br>
+ Zip archives store file modification times with a granularity of
+ two seconds, so the times will either be rounded up or down. If
+ you round down, the archive will always seem out-of-date when you
+ rerun the task, so the default is to round up. Rounding up may
+ lead to a different type of problems like JSPs inside a web
+ archive that seem to be slightly more recent than precompiled
+ pages, rendering precompilation useless.<br>
+ Defaults to true. <em>Since Ant 1.6.2</em></td>
+ <td align="center" valign="top">No</td>
+ </tr>
</table>
<h3>Nested elements</h3>
1.20.2.3 +14 -0 ant/docs/manual/CoreTasks/war.html
Index: war.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/war.html,v
retrieving revision 1.20.2.2
retrieving revision 1.20.2.3
diff -u -r1.20.2.2 -r1.20.2.3
--- war.html 9 Feb 2004 22:12:07 -0000 1.20.2.2
+++ war.html 25 May 2004 11:48:35 -0000 1.20.2.3
@@ -122,6 +122,20 @@
<td valign="top">behavior when a duplicate file is found. Valid values
are "add", "preserve", and "fail". The default
value is "add". </td>
<td valign="top" align="center">No</td>
</tr>
+ <tr>
+ <td valign="top">roundup</td>
+ <td valign="top">Whether the file modification times will be
+ rounded up to the next even number of seconds.<br>
+ Zip archives store file modification times with a granularity of
+ two seconds, so the times will either be rounded up or down. If
+ you round down, the archive will always seem out-of-date when you
+ rerun the task, so the default is to round up. Rounding up may
+ lead to a different type of problems like JSPs inside a web
+ archive that seem to be slightly more recent than precompiled
+ pages, rendering precompilation useless.<br>
+ Defaults to true. <em>Since Ant 1.6.2</em></td>
+ <td align="center" valign="top">No</td>
+ </tr>
</table>
<h3>Nested elements</h3>
<h4>lib</h4>
1.21.2.4 +14 -0 ant/docs/manual/CoreTasks/zip.html
Index: zip.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/zip.html,v
retrieving revision 1.21.2.3
retrieving revision 1.21.2.4
diff -u -r1.21.2.3 -r1.21.2.4
--- zip.html 9 Feb 2004 22:12:07 -0000 1.21.2.3
+++ zip.html 25 May 2004 11:48:35 -0000 1.21.2.4
@@ -165,6 +165,20 @@
<td valign="top">behavior when a duplicate file is found. Valid values
are "add", "preserve", and "fail". The default
value is "add". </td>
<td valign="top" align="center">No</td>
</tr>
+ <tr>
+ <td valign="top">roundup</td>
+ <td valign="top">Whether the file modification times will be
+ rounded up to the next even number of seconds.<br>
+ Zip archives store file modification times with a granularity of
+ two seconds, so the times will either be rounded up or down. If
+ you round down, the archive will always seem out-of-date when you
+ rerun the task, so the default is to round up. Rounding up may
+ lead to a different type of problems like JSPs inside a web
+ archive that seem to be slightly more recent than precompiled
+ pages, rendering precompilation useless.<br>
+ Defaults to true. <em>Since Ant 1.6.2</em></td>
+ <td align="center" valign="top">No</td>
+ </tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>fileset</h4>
No revision
No revision
1.116.2.8 +31 -3 ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.116.2.7
retrieving revision 1.116.2.8
diff -u -r1.116.2.7 -r1.116.2.8
--- Zip.java 16 Apr 2004 09:35:59 -0000 1.116.2.7
+++ Zip.java 25 May 2004 11:48:35 -0000 1.116.2.8
@@ -107,6 +107,14 @@
private boolean keepCompression = false;
/**
+ * Whether the file modification times will be rounded up to the
+ * next even number of seconds.
+ *
+ * @since Ant 1.6.2
+ */
+ private boolean roundUp = true;
+
+ /**
* This is the name/location of where to
* create the .zip file.
*
@@ -284,6 +292,24 @@
}
/**
+ * Whether the file modification times will be rounded up to the
+ * next even number of seconds.
+ *
+ * <p>Zip archives store file modification times with a
+ * granularity of two seconds, so the times will either be rounded
+ * up or down. If you round down, the archive will always seem
+ * out-of-date when you rerun the task, so the default is to round
+ * up. Rounding up may lead to a different type of problems like
+ * JSPs inside a web archive that seem to be slightly more recent
+ * than precompiled pages, rendering precompilation useless.</p>
+ *
+ * @since Ant 1.6.2
+ */
+ public void setRoundUp(boolean r) {
+ roundUp = r;
+ }
+
+ /**
* validate and build
*/
public void execute() throws BuildException {
@@ -917,10 +943,10 @@
ZipEntry ze = new ZipEntry (vPath);
if (dir != null && dir.exists()) {
// ZIPs store time with a granularity of 2 seconds, round up
- ze.setTime(dir.lastModified() + 1999);
+ ze.setTime(dir.lastModified() + (roundUp ? 1999 : 0));
} else {
// ZIPs store time with a granularity of 2 seconds, round up
- ze.setTime(System.currentTimeMillis() + 1999);
+ ze.setTime(System.currentTimeMillis() + (roundUp ? 1999 :
0));
}
ze.setSize (0);
ze.setMethod (ZipEntry.STORED);
@@ -1050,7 +1076,9 @@
FileInputStream fIn = new FileInputStream(file);
try {
// ZIPs store time with a granularity of 2 seconds, round up
- zipFile(fIn, zOut, vPath, file.lastModified() + 1999, null,
mode);
+ zipFile(fIn, zOut, vPath,
+ file.lastModified() + (roundUp ? 1999 : 0),
+ null, mode);
} finally {
fIn.close();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]