Browse Source

add a force option to signjar. Based on submission by Pavel Jisl. PR 46891

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@763661 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 16 years ago
parent
commit
0cda41d5b7
4 changed files with 38 additions and 2 deletions
  1. +4
    -0
      WHATSNEW
  2. +4
    -0
      contributors.xml
  3. +7
    -1
      docs/manual/CoreTasks/signjar.html
  4. +23
    -1
      src/main/org/apache/tools/ant/taskdefs/SignJar.java

+ 4
- 0
WHATSNEW View File

@@ -363,6 +363,10 @@ Fixed bugs:
* 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


+ 4
- 0
contributors.xml View File

@@ -927,6 +927,10 @@
<first>Paulo</first>
<last>Gaspar</last>
</name>
<name>
<first>Pavel</first>
<last>Jisl</last>
</name>
<name>
<first>Paweł</first>
<last>Zuzelski</last>


+ 7
- 1
docs/manual/CoreTasks/signjar.html View File

@@ -149,9 +149,15 @@ block</td>
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">


+ 23
- 1
src/main/org/apache/tools/ant/taskdefs/SignJar.java View File

@@ -104,6 +104,11 @@ public class SignJar extends AbstractJarSignerTask {
*/
protected String tsacert;

/**
* force signing even if the jar is already signed.
*/
private boolean force = false;

/**
* error string for unit test verification: {@value}
*/
@@ -253,6 +258,23 @@ public class SignJar extends AbstractJarSignerTask {
this.tsacert = tsacert;
}

/**
* 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)
*
@@ -448,7 +470,7 @@ public class SignJar extends AbstractJarSignerTask {
* @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;


Loading…
Cancel
Save