bodewig     2004/02/27 06:17:41

  Modified:    .        WHATSNEW
               docs/manual/CoreTasks ear.html jar.html war.html zip.html
               src/main/org/apache/tools/ant/taskdefs Zip.java
  Log:
  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.
  
  PR: 17934
  
  Revision  Changes    Path
  1.557     +5 -0      ant/WHATSNEW
  
  Index: WHATSNEW
  ===================================================================
  RCS file: /home/cvs/ant/WHATSNEW,v
  retrieving revision 1.556
  retrieving revision 1.557
  diff -u -r1.556 -r1.557
  --- WHATSNEW  27 Feb 2004 11:45:15 -0000      1.556
  +++ WHATSNEW  27 Feb 2004 14:17:41 -0000      1.557
  @@ -35,6 +35,11 @@
   
   * <touch> has filelist support.
   
  +* 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.1 to current Ant 1.6 CVS version
   =============================================
  
  
  
  1.18      +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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- ear.html  9 Feb 2004 21:50:05 -0000       1.17
  +++ ear.html  27 Feb 2004 14:17:41 -0000      1.18
  @@ -114,6 +114,20 @@
       <td valign="top">behavior when a duplicate file is found.  Valid values 
are &quot;add&quot;, &quot;preserve&quot;, and &quot;fail&quot;.  The default 
value is &quot;add&quot;.  </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.7</em></td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
   </table>
   <h3>Nested elements</h3>
   <h4>metainf</h4>
  
  
  
  1.30      +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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- jar.html  9 Feb 2004 21:50:05 -0000       1.29
  +++ jar.html  27 Feb 2004 14:17:41 -0000      1.30
  @@ -168,6 +168,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.7</em></td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
   </table>
   
   <h3>Nested elements</h3>
  
  
  
  1.22      +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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- war.html  9 Feb 2004 21:50:06 -0000       1.21
  +++ war.html  27 Feb 2004 14:17:41 -0000      1.22
  @@ -121,6 +121,20 @@
       <td valign="top">behavior when a duplicate file is found.  Valid values 
are &quot;add&quot;, &quot;preserve&quot;, and &quot;fail&quot;.  The default 
value is &quot;add&quot;.  </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.7</em></td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
   </table>
   <h3>Nested elements</h3>
   <h4>lib</h4>
  
  
  
  1.24      +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.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- zip.html  9 Feb 2004 21:50:06 -0000       1.23
  +++ zip.html  27 Feb 2004 14:17:41 -0000      1.24
  @@ -164,6 +164,20 @@
       <td valign="top">behavior when a duplicate file is found.  Valid values 
are &quot;add&quot;, &quot;preserve&quot;, and &quot;fail&quot;. The default 
value is &quot;add&quot;.  </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.7</em></td>
  +    <td align="center" valign="top">No</td>
  +  </tr>
   </table>
   <h3>Parameters specified as nested elements</h3>
   <h4>fileset</h4>
  
  
  
  1.122     +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.121
  retrieving revision 1.122
  diff -u -r1.121 -r1.122
  --- Zip.java  9 Feb 2004 21:05:21 -0000       1.121
  +++ Zip.java  27 Feb 2004 14:17:41 -0000      1.122
  @@ -112,6 +112,14 @@
       private boolean keepCompression = false;
   
       /**
  +     * Whether the file modification times will be rounded up to the
  +     * next even number of seconds.
  +     *
  +     * @since Ant 1.7
  +     */
  +    private boolean roundUp = true;
  +
  +    /**
        * This is the name/location of where to
        * create the .zip file.
        *
  @@ -289,6 +297,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.7
  +     */
  +    public void setRoundUp(boolean r) {
  +        roundUp = r;
  +    }
  +
  +    /**
        * validate and build
        */
       public void execute() throws BuildException {
  @@ -914,10 +940,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);
  @@ -1047,7 +1073,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]

Reply via email to