bodewig     2003/04/09 23:37:57

  Modified:    docs/manual/CoreTasks signjar.html
               src/main/org/apache/tools/ant/taskdefs SignJar.java
  Log:
  Fix <signjar>'s documentation (jar attribute is not required).
  
  PR: 18876
  
  At the same time fix the broken "do I have fileset child elements"
  check and warn users if nested filesets are ignored.
  
  Revision  Changes    Path
  1.10      +6 -5      ant/docs/manual/CoreTasks/signjar.html
  
  Index: signjar.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/CoreTasks/signjar.html,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- signjar.html      31 Dec 2002 14:16:13 -0000      1.9
  +++ signjar.html      10 Apr 2003 06:37:57 -0000      1.10
  @@ -14,8 +14,7 @@
   are not signed. The <tt>signjar</tt> attribute can point to the file to
   generate; if this file exists then
   its modification date is used as a cue as to whether to resign any JAR file.
  -<br>
  -<strong>Note:</strong> Requires Java 1.2 or later. </p>
  +</p>
   
   <h3>Parameters</h3>
   <table border="1" cellpadding="2" cellspacing="0">
  @@ -27,7 +26,8 @@
     <tr>
       <td valign="top">jar</td>
       <td valign="top">the jar file to sign</td>
  -    <td valign="top" align="center">Yes.</td>
  +    <td valign="top" align="center">Yes, unless nested filesets have
  +      been used.</td>
     </tr>
     <tr>
       <td valign="top">alias</td>
  @@ -102,7 +102,8 @@
     </tr>
     <tr>
       <td valign="top">fileset</td>
  -    <td valign="top">fileset of JAR files to sign</td>
  +    <td valign="top">fileset of JAR files to sign.  Will be ignored if
  +      the jar attribute of the task has been set.</td>
       <td valign="top" align="center">No</td>
     </tr>
   </table>
  @@ -114,7 +115,7 @@
   <p>signs the ant.jar with alias &quot;apache-group&quot; accessing the
   keystore and private key via &quot;secret&quot; password.</p>
   <hr>
  -<p align="center">Copyright &copy; 2000-2002 Apache Software Foundation. All 
rights
  +<p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All 
rights
   Reserved.</p>
   
   </body>
  
  
  
  1.29      +8 -8      ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java
  
  Index: SignJar.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/SignJar.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- SignJar.java      10 Feb 2003 14:13:36 -0000      1.28
  +++ SignJar.java      10 Apr 2003 06:37:57 -0000      1.29
  @@ -61,6 +61,7 @@
   import java.util.zip.ZipFile;
   import org.apache.tools.ant.BuildException;
   import org.apache.tools.ant.DirectoryScanner;
  +import org.apache.tools.ant.Project;
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.util.JavaEnvUtils;
  @@ -235,16 +236,19 @@
        * sign the jar(s)
        */
       public void execute() throws BuildException {
  -        if (null == jar && null == filesets) {
  +        if (null == jar && filesets.size() == 0) {
               throw new BuildException("jar must be set through jar attribute "
                                        + "or nested filesets");
           }
           if (null != jar) {
  +            if (filesets.size() != 0) {
  +                log("nested filesets will be ignored if the jar attribute 
has"
  +                    + " been specified.", Project.MSG_WARN);
  +            }
  +            
               doOneJar(jar, signedjar);
               return;
           } else {
  -            //Assume null != filesets
  -
               // deal with the filesets
               for (int i = 0; i < filesets.size(); i++) {
                   FileSet fs = (FileSet) filesets.elementAt(i);
  @@ -262,10 +266,6 @@
        */
       private void doOneJar(File jarSource, File jarTarget)
           throws BuildException {
  -        if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) {
  -            throw new BuildException("The signjar task is only available on "
  -                                     + "JDK versions 1.2 or greater");
  -        }
   
           if (null == alias) {
               throw new BuildException("alias attribute must be set");
  @@ -276,7 +276,7 @@
           }
   
           if (isUpToDate(jarSource, jarTarget)) {
  -          return;
  +            return;
           }
   
           final ExecTask cmd = (ExecTask) getProject().createTask("exec");
  
  
  

Reply via email to