ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@locus.apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs SignJar.java
Date Sun, 10 Dec 2000 08:30:54 GMT
donaldp     00/12/10 00:30:53

  Modified:    src/main/org/apache/tools/ant/taskdefs SignJar.java
  Log:
  Adapted Signjar so that it does not run every time unless absolutely required (or unable
to be determined if required).
  
  Submitted By: keeskuip@technologist.com
  
  Revision  Changes    Path
  1.6       +21 -2     jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java
  
  Index: SignJar.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SignJar.java	2000/11/25 01:10:07	1.5
  +++ SignJar.java	2000/12/10 08:30:53	1.6
  @@ -60,7 +60,7 @@
   /**
    * Sign a archive.
    * 
  - * @author Peter Donald <a href="mailto:donaldp@mad.scientist.com">donaldp@mad.scientist.com</a>
  + * @author Peter Donald <a href="mailto:donaldp@apache.org">donaldp@apache.org</a>
    */
   public class SignJar extends Task {
   
  @@ -148,6 +148,8 @@
               throw new BuildException("storepass attribute must be set");
           } 
   
  +        if(isUpToDate()) return;
  +
           final StringBuffer sb = new StringBuffer();
   
           final ExecTask cmd = (ExecTask) project.createTask("exec");
  @@ -204,6 +206,23 @@
           cmd.setFailonerror(true);
           cmd.setTaskName( getTaskName() );
           cmd.execute();
  -    } 
  +    }
  +
  +    protected boolean isUpToDate() {
  +
  +        if( null != jar && null != signedjar ) {
  +
  +            final File jarFile = new File(jar);
  +            final File signedjarFile = new File(signedjar);
  +            
  +            if(!jarFile.exists()) return false;
  +            if(!signedjarFile.exists()) return false;
  +            if(jarFile.equals(signedjarFile)) return false;
  +            if(signedjarFile.lastModified() > jarFile.lastModified())
  +                return true;
  +        }
  +
  +        return false;
  +    }
   }
   
  
  
  

Mime
View raw message