ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs SignJar.java
Date Thu, 13 Sep 2001 05:21:04 GMT
donaldp     01/09/12 22:21:04

  Modified:    .        build.xml
               src/main/org/apache/tools/ant/taskdefs SignJar.java
  Log:
  Reworked task to use files internall rather than strings so that the task doesn't have to
try and resolve things internally.
  
  Based on Daniel Hoppe <hoppe@sitewaerts.de> 's patch.
  
  Revision  Changes    Path
  1.184     +0 -1      jakarta-ant/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/build.xml,v
  retrieving revision 1.183
  retrieving revision 1.184
  diff -u -r1.183 -r1.184
  --- build.xml	2001/09/13 01:57:42	1.183
  +++ build.xml	2001/09/13 05:21:04	1.184
  @@ -594,7 +594,6 @@
            Creates the API documentation                             
          =================================================================== 
     -->
  -  
     <target name="javadoc_check">
       <uptodate property="javadoc.notrequired" 
                 targetfile="${build.javadocs}/packages.html" >
  
  
  
  1.9       +21 -25    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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SignJar.java	2001/06/19 11:50:30	1.8
  +++ SignJar.java	2001/09/13 05:21:04	1.9
  @@ -74,7 +74,7 @@
       /**
        * The name of the jar file.
        */
  -    protected String jar;
  +    protected File jar;
   
       /**
        * The alias of signer.
  @@ -84,12 +84,13 @@
       /**
        * The name of keystore file.
        */
  -    protected String keystore;
  +    protected File keystore;
  +
       protected String storepass;
       protected String storetype;
       protected String keypass;
  -    protected String sigfile;
  -    protected String signedjar;
  +    protected File sigfile;
  +    protected File signedjar;
       protected boolean verbose;
       protected boolean internalsf;
       protected boolean sectionsonly;
  @@ -104,7 +105,7 @@
        */
       protected boolean lazy;
   
  -    public void setJar(final String jar) {
  +    public void setJar(final File jar) {
           this.jar = jar;
       }
   
  @@ -112,7 +113,7 @@
           this.alias = alias;
       }
   
  -    public void setKeystore(final String keystore) {
  +    public void setKeystore(final File keystore) {
           this.keystore = keystore;
       }
   
  @@ -128,11 +129,11 @@
           this.keypass = keypass;
       }
   
  -    public void setSigfile(final String sigfile) {
  +    public void setSigfile(final File sigfile) {
           this.sigfile = sigfile;
       }
   
  -    public void setSignedjar(final String signedjar) {
  +    public void setSignedjar(final File signedjar) {
           this.signedjar = signedjar;
       }
   
  @@ -176,13 +177,13 @@
                   DirectoryScanner ds = fs.getDirectoryScanner(project);
                   String[] jarFiles = ds.getIncludedFiles();
                   for(int j=0; j<jarFiles.length; j++) {
  -                    doOneJar(jarFiles[j], null);
  +                    doOneJar( new File( jarFiles[j] ), null);
                   }
               }
           }
       }
   
  -    private void doOneJar(String jarSource, String jarTarget) throws BuildException {
  +    private void doOneJar(File jarSource, File jarTarget) throws BuildException {
           if (project.getJavaVersion().equals(Project.JAVA_1_1)) {
               throw new BuildException("The signjar task is only available on JDK versions
1.2 or greater");
           }
  @@ -204,7 +205,7 @@
   
           if (null != keystore) {
               cmd.createArg().setValue("-keystore");
  -            cmd.createArg().setValue(keystore);
  +            cmd.createArg().setValue( keystore.toString() );
           }
   
           if (null != storepass) {
  @@ -224,12 +225,12 @@
   
           if (null != sigfile) {
               cmd.createArg().setValue("-sigfile");
  -            cmd.createArg().setValue(sigfile);
  +            cmd.createArg().setValue( sigfile.toString() );
           }
   
           if (null != jarTarget) {
               cmd.createArg().setValue("-signedjar");
  -            cmd.createArg().setValue(jarTarget);
  +            cmd.createArg().setValue( jarTarget.toString() );
           }
   
           if (verbose) {
  @@ -243,27 +244,23 @@
           if (sectionsonly) {
               cmd.createArg().setValue("-sectionsonly");
           }
  -
  -        cmd.createArg().setValue(jarSource);
   
  +        cmd.createArg().setValue( jarSource.toString() );
   
           cmd.createArg().setValue(alias);
   
  -        log("Signing Jar : " + (new File(jarSource)).getAbsolutePath());
  +        log("Signing Jar : " + jarSource.getAbsolutePath());
           cmd.setFailonerror(true);
           cmd.setTaskName( getTaskName() );
           cmd.execute();
       }
   
  -    protected boolean isUpToDate(String jarSource, String jarTarget) {
  -        if( null == jarSource ) {
  +    protected boolean isUpToDate(File jarFile, File signedjarFile) {
  +        if( null == jarFile ) {
               return false;
           }
  -
  -        if( null != jarTarget ) {
   
  -            final File jarFile = new File(jarSource);
  -            final File signedjarFile = new File(jarTarget);
  +        if( null != signedjarFile ) {
   
               if(!jarFile.exists()) return false;
               if(!signedjarFile.exists()) return false;
  @@ -272,18 +269,17 @@
                   return true;
           } else {
               if( lazy ) {
  -                return isSigned(jarSource);
  +                return isSigned(jarFile);
               }
           }
   
           return false;
       }
   
  -    protected boolean isSigned(String jarFilename) {
  +    protected boolean isSigned(File file) {
           final String SIG_START = "META-INF/";
           final String SIG_END = ".SF";
   
  -        File file = new File(jarFilename);
           if( !file.exists() ) {
               return false;
           }
  
  
  

Mime
View raw message