You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2009/04/09 16:17:39 UTC

svn commit: r763661 - in /ant/core/trunk: WHATSNEW contributors.xml docs/manual/CoreTasks/signjar.html src/main/org/apache/tools/ant/taskdefs/SignJar.java

Author: bodewig
Date: Thu Apr  9 14:17:38 2009
New Revision: 763661

URL: http://svn.apache.org/viewvc?rev=763661&view=rev
Log:
add a force option to signjar.  Based on submission by Pavel Jisl.  PR 46891

Modified:
    ant/core/trunk/WHATSNEW
    ant/core/trunk/contributors.xml
    ant/core/trunk/docs/manual/CoreTasks/signjar.html
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java

Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=763661&r1=763660&r2=763661&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Thu Apr  9 14:17:38 2009
@@ -363,6 +363,10 @@
  * The ant shell script should now support MSYS/MinGW as well.
    Bugzilla Report 46936.
 
+ * <signjar> has a new force attribute that allows re-signing of jars
+   that are already signed.
+   Bugzilla Report 46891.
+
 Other changes:
 --------------
  * A HostInfo task was added performing information on hosts, including info on 

Modified: ant/core/trunk/contributors.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/contributors.xml?rev=763661&r1=763660&r2=763661&view=diff
==============================================================================
--- ant/core/trunk/contributors.xml (original)
+++ ant/core/trunk/contributors.xml Thu Apr  9 14:17:38 2009
@@ -928,6 +928,10 @@
     <last>Gaspar</last>
   </name>
   <name>
+    <first>Pavel</first>
+    <last>Jisl</last>
+  </name>
+  <name>
     <first>Paweł</first>
     <last>Zuzelski</last>
   </name>

Modified: ant/core/trunk/docs/manual/CoreTasks/signjar.html
URL: http://svn.apache.org/viewvc/ant/core/trunk/docs/manual/CoreTasks/signjar.html?rev=763661&r1=763660&r2=763661&view=diff
==============================================================================
--- ant/core/trunk/docs/manual/CoreTasks/signjar.html (original)
+++ ant/core/trunk/docs/manual/CoreTasks/signjar.html Thu Apr  9 14:17:38 2009
@@ -149,9 +149,15 @@
       Must support the same command line options as the Sun JDK
       jarsigner command.
       <em>since Ant 1.8.0</em>.</td>
-    <td align="center" valign="top">all</td>
     <td align="center" valign="top">No</td>
   </tr>  
+  <tr>
+    <td valign="top">force</td>
+    <td valign="top">Whether to force signing of the jar file even if
+      it doesn't seem to be out of date or already signed.
+      <em>since Ant 1.8.0</em>.</td>
+    <td align="center" valign="top">No; default false</td>
+  </tr>  
 </table>
 <h3>Parameters as nested elements</h3>
 <table border="1" cellpadding="2" cellspacing="0">

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java?rev=763661&r1=763660&r2=763661&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java Thu Apr  9 14:17:38 2009
@@ -105,6 +105,11 @@
     protected String tsacert;
 
     /**
+     * force signing even if the jar is already signed.
+     */
+    private boolean force = false;
+
+    /**
      * error string for unit test verification: {@value}
      */
     public static final String ERROR_TODIR_AND_SIGNEDJAR
@@ -254,6 +259,23 @@
     }
 
     /**
+     * Whether to force signing of a jar even it is already signed.
+     * @since Ant 1.8.0
+     */
+    public void setForce(boolean b) {
+        force = b;
+    }
+
+    /**
+     * Should the task force signing of a jar even it is already
+     * signed?
+     * @since Ant 1.8.0
+     */
+    public boolean isForce() {
+        return force;
+    }
+
+    /**
      * sign the jar(s)
      *
      * @throws BuildException on errors
@@ -448,7 +470,7 @@
      * @return true if the signedjarFile is considered up to date
      */
     protected boolean isUpToDate(File jarFile, File signedjarFile) {
-        if (null == jarFile || !jarFile.exists()) {
+        if (isForce() || null == jarFile || !jarFile.exists()) {
             //these are pathological cases, but retained in case somebody
             //subclassed us.
             return false;