ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Copydir.java
Date Tue, 27 Jun 2000 10:42:26 GMT
bodewig     00/06/27 03:42:25

  Modified:    .        build.xml
               docs     index.html
               src/main/org/apache/tools/ant/taskdefs Copydir.java
  Log:
  Added forceoverwrite attribute to copydir.
  
  Revision  Changes    Path
  1.25      +4 -1      jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- build.xml	2000/06/27 10:35:42	1.24
  +++ build.xml	2000/06/27 10:42:20	1.25
  @@ -78,7 +78,10 @@
       <filter token="VERSION" value="${version}" />
       <filter token="DATE" value="${TODAY}" />
       <filter token="TIME" value="${TSTAMP}" />
  -    <copydir src="${src.dir}" dest="${build.classes}" filtering="on">
  +    <copydir src="${src.dir}" 
  +             dest="${build.classes}" 
  +             filtering="on"
  +             forceoverwrite="true">
         <include name="**/version.txt" />
       </copydir>
     </target>
  
  
  
  1.31      +6 -0      jakarta-ant/docs/index.html
  
  Index: index.html
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/docs/index.html,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- index.html	2000/06/27 10:35:51	1.30
  +++ index.html	2000/06/27 10:42:22	1.31
  @@ -694,6 +694,12 @@
         the copy</td>
       <td valign="top" align="center">No</td>
     </tr>
  +  <tr>
  +    <td valign="top">forceoverwrite</td>
  +    <td valign="top">overwrite existing files even if the destination
  +      files are newer (default is false).</td>
  +    <td valign="top" align="center">No</td>
  +  </tr>
   </table>
   <h3>Examples</h3>
   <pre>  &lt;copydir src=&quot;${src}/resources&quot;
  
  
  
  1.8       +7 -1      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java
  
  Index: Copydir.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Copydir.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Copydir.java	2000/06/23 14:17:17	1.7
  +++ Copydir.java	2000/06/27 10:42:24	1.8
  @@ -70,6 +70,7 @@
       private File srcDir;
       private File destDir;
       private boolean filtering = false;
  +    private boolean forceOverwrite = false;
       private Hashtable filecopyList = new Hashtable();
   
       public void setSrc(String src) {
  @@ -84,6 +85,10 @@
           filtering = Project.toBoolean(filter);
       }
   
  +    public void setForceoverwrite(String force) {
  +        forceOverwrite = Project.toBoolean(force);
  +    }
  +
       public void execute() throws BuildException {
           if (srcDir == null) {
               throw new BuildException("srcdir attribute must be set!", 
  @@ -122,7 +127,8 @@
               String filename = files[i];
               File srcFile = new File(from, filename);
               File destFile = new File(to, filename);
  -            if (srcFile.lastModified() > destFile.lastModified()) {
  +            if (forceOverwrite ||
  +                (srcFile.lastModified() > destFile.lastModified())) {
                   filecopyList.put(srcFile.getAbsolutePath(),
                       destFile.getAbsolutePath());
               }
  
  
  

Mime
View raw message