ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs Zip.java
Date Sun, 13 Feb 2000 21:43:34 GMT
rubys       00/02/13 13:43:34

  Modified:    src/main/org/apache/tools/ant/taskdefs Zip.java
  Log:
  don't rebuild zip/jar files if they are up to date already
  
  Revision  Changes    Path
  1.5       +10 -2     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
  
  Index: Zip.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Zip.java	2000/02/10 18:04:29	1.4
  +++ Zip.java	2000/02/13 21:43:34	1.5
  @@ -92,8 +92,6 @@
       }
   
       public void execute() throws BuildException {
  -        project.log("Building "+ archiveType +": "+ zipFile.getAbsolutePath());
  -
           if (baseDir == null) {
               throw new BuildException("basedir attribute must be set!");
           }
  @@ -105,6 +103,16 @@
   
           String[] files = ds.getIncludedFiles();
           String[] dirs  = ds.getIncludedDirectories();
  +
  +        // quick exit if the target is up to date
  +        boolean upToDate = true;
  +        for (int i=0; i<files.length && upToDate; i++)
  +            if (new File(baseDir,files[i]).lastModified() > 
  +                zipFile.lastModified())
  +                upToDate = false;
  +        if (upToDate) return;
  +
  +        project.log("Building "+ archiveType +": "+ zipFile.getAbsolutePath());
   
           try {
               ZipOutputStream zOut = new ZipOutputStream(new FileOutputStream(zipFile));
  
  
  

Mime
View raw message