@@ -38,6 +38,14 @@ Other changes: | |||||
* junitlauncher task now supports forking and can be used with JaCoCo | * junitlauncher task now supports forking and can be used with JaCoCo | ||||
(see https://github.com/jacoco/jacoco/issues/673). | (see https://github.com/jacoco/jacoco/issues/673). | ||||
* signjar and verifyjar now support the -providerName, -providerClass | |||||
and -providerArg command line options of keytool via new attributes. | |||||
Bugzilla Report 65234 | |||||
* signjar and verifyjar now supported nested <arg> elements for | |||||
command line arguments that are not supported explicitly by the | |||||
tasks via attributes. | |||||
Changes from Ant 1.10.4 TO Ant 1.10.5 | Changes from Ant 1.10.4 TO Ant 1.10.5 | ||||
===================================== | ===================================== | ||||
@@ -178,6 +178,29 @@ place.</p> | |||||
<td>name of TSA digest algorithm. <em>since Ant 1.10.2</em></td> | <td>name of TSA digest algorithm. <em>since Ant 1.10.2</em></td> | ||||
<td>No</td> | <td>No</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td>providername</td> | |||||
<td>name of a cryptographic service provider's name | |||||
when listed in the security properties file. | |||||
<em>since Ant 1.10.6</em>.</td> | |||||
<td>No</td> | |||||
</tr> | |||||
<tr> | |||||
<td>providerclass</td> | |||||
<td>name of a cryptographic service provider's master | |||||
class file when the service provider is not listed in the security | |||||
properties file. | |||||
<em>since Ant 1.10.6</em>.</td> | |||||
<td>No</td> | |||||
</tr> | |||||
<tr> | |||||
<td>providerarg</td> | |||||
<td>Represents an optional string input argument for | |||||
the constructor of provider_class_name. Ignored | |||||
if <code>providerclass</code> is not set. | |||||
<em>since Ant 1.10.6</em>.</td> | |||||
<td>No</td> | |||||
</tr> | |||||
</table> | </table> | ||||
<h3>Parameters as nested elements</h3> | <h3>Parameters as nested elements</h3> | ||||
<table class="attr"> | <table class="attr"> | ||||
@@ -207,7 +230,15 @@ place.</p> | |||||
variables</a></td> | variables</a></td> | ||||
<td>No, and only one can be supplied</td> | <td>No, and only one can be supplied</td> | ||||
</tr> | </tr> | ||||
</table> | |||||
<tr> | |||||
<td>arg</td> | |||||
<td>Use this to specify a <kbd>keytool</kbd> | |||||
<a href="../using.html#arg">command line argument</a> not | |||||
explicitly supported via an attribute. | |||||
<em>since Ant 1.10.6</em>.</td> | |||||
<td>No</td> | |||||
</tr> | |||||
</table> | |||||
<h3>Examples</h3> | <h3>Examples</h3> | ||||
<p>For instructions on generating a code signing certificate, see | <p>For instructions on generating a code signing certificate, see | ||||
@@ -100,6 +100,29 @@ the <var>jar</var> attribute. Nested paths are also supported.</p> | |||||
options as the Sun JDK <kbd>jarsigner</kbd> command. <em>since Ant 1.8.0</em>.</td> | options as the Sun JDK <kbd>jarsigner</kbd> command. <em>since Ant 1.8.0</em>.</td> | ||||
<td>No</td> | <td>No</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td>providername</td> | |||||
<td>name of a cryptographic service provider's name | |||||
when listed in the security properties file. | |||||
<em>since Ant 1.10.6</em>.</td> | |||||
<td>No</td> | |||||
</tr> | |||||
<tr> | |||||
<td>providerclass</td> | |||||
<td>name of a cryptographic service provider's master | |||||
class file when the service provider is not listed in the security | |||||
properties file. | |||||
<em>since Ant 1.10.6</em>.</td> | |||||
<td>No</td> | |||||
</tr> | |||||
<tr> | |||||
<td>providerarg</td> | |||||
<td>Represents an optional string input argument for | |||||
the constructor of provider_class_name. Ignored | |||||
if <code>providerclass</code> is not set. | |||||
<em>since Ant 1.10.6</em>.</td> | |||||
<td>No</td> | |||||
</tr> | |||||
</table> | </table> | ||||
<h3>Parameters as nested elements</h3> | <h3>Parameters as nested elements</h3> | ||||
<table class="attr"> | <table class="attr"> | ||||
@@ -124,6 +147,14 @@ the <var>jar</var> attribute. Nested paths are also supported.</p> | |||||
variables</a></td> | variables</a></td> | ||||
<td>No, and only one can be supplied</td> | <td>No, and only one can be supplied</td> | ||||
</tr> | </tr> | ||||
<tr> | |||||
<td>arg</td> | |||||
<td>Use this to specify a <kbd>keytool</kbd> | |||||
<a href="../using.html#arg">command line argument</a> not | |||||
explicitly supported via an attribute. | |||||
<em>since Ant 1.10.6</em>.</td> | |||||
<td>No</td> | |||||
</tr> | |||||
</table> | </table> | ||||
<h3>Examples</h3> | <h3>Examples</h3> | ||||
@@ -1,4 +1,4 @@ | |||||
/* | |||||
g/* | |||||
* Licensed to the Apache Software Foundation (ASF) under one or more | * Licensed to the Apache Software Foundation (ASF) under one or more | ||||
* contributor license agreements. See the NOTICE file distributed with | * contributor license agreements. See the NOTICE file distributed with | ||||
* this work for additional information regarding copyright ownership. | * this work for additional information regarding copyright ownership. | ||||
@@ -19,11 +19,14 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import java.io.File; | import java.io.File; | ||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.Vector; | import java.util.Vector; | ||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Task; | import org.apache.tools.ant.Task; | ||||
import org.apache.tools.ant.filters.LineContainsRegExp; | import org.apache.tools.ant.filters.LineContainsRegExp; | ||||
import org.apache.tools.ant.types.Commandline; | |||||
import org.apache.tools.ant.types.Environment; | import org.apache.tools.ant.types.Environment; | ||||
import org.apache.tools.ant.types.FileSet; | import org.apache.tools.ant.types.FileSet; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
@@ -116,6 +119,15 @@ public abstract class AbstractJarSignerTask extends Task { | |||||
*/ | */ | ||||
private String executable; | private String executable; | ||||
/** | |||||
* Values for the providerName, providerClass, and providerArg options. | |||||
* | |||||
* @since Ant 1.10.6 | |||||
*/ | |||||
private String providerName, providerClass, providerArg; | |||||
private List<Commandline.Argument> additionalArgs = new ArrayList(); | |||||
/** | /** | ||||
* Set the maximum memory to be used by the jarsigner process | * Set the maximum memory to be used by the jarsigner process | ||||
* | * | ||||
@@ -230,6 +242,49 @@ public abstract class AbstractJarSignerTask extends Task { | |||||
return path.createPath(); | return path.createPath(); | ||||
} | } | ||||
/** | |||||
* Sets the value for the -providerName command line argument. | |||||
* | |||||
* @param providerName the value for the -providerName command line argument | |||||
* | |||||
* @since Ant 1.10.6 | |||||
*/ | |||||
public void setProviderName(String providerName) { | |||||
this.providerName = providerName; | |||||
} | |||||
/** | |||||
* Sets the value for the -providerClass command line argument. | |||||
* | |||||
* @param providerClass the value for the -providerClass command line argument | |||||
* | |||||
* @since Ant 1.10.6 | |||||
*/ | |||||
public void setProviderClass(String providerClass) { | |||||
this.providerClass = providerClass; | |||||
} | |||||
/** | |||||
* Sets the value for the -providerArg command line argument. | |||||
* | |||||
* @param providerArg the value for the -providerArg command line argument | |||||
* | |||||
* @since Ant 1.10.6 | |||||
*/ | |||||
public void setProviderArg(String providerArg) { | |||||
this.providerArg = providerArg; | |||||
} | |||||
/** | |||||
* Adds a nested <arg> element that can be used to specify | |||||
* command line arguments not supported via specific attributes. | |||||
* | |||||
* @since Ant 1.10.6 | |||||
*/ | |||||
public void addArg(Commandline.Argument arg) { | |||||
additionalArgs.add(arg); | |||||
} | |||||
/** | /** | ||||
* init processing logic; this is retained through our execution(s) | * init processing logic; this is retained through our execution(s) | ||||
*/ | */ | ||||
@@ -311,6 +366,10 @@ public abstract class AbstractJarSignerTask extends Task { | |||||
for (Environment.Variable variable : sysProperties.getVariablesVector()) { | for (Environment.Variable variable : sysProperties.getVariablesVector()) { | ||||
declareSysProperty(cmd, variable); | declareSysProperty(cmd, variable); | ||||
} | } | ||||
for (Commandline.Argument arg : additionalArgs) { | |||||
addArgument(cmd, arg); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
@@ -346,6 +405,20 @@ public abstract class AbstractJarSignerTask extends Task { | |||||
addValue(cmd, "-storetype"); | addValue(cmd, "-storetype"); | ||||
addValue(cmd, storetype); | addValue(cmd, storetype); | ||||
} | } | ||||
if (null != providerName) { | |||||
addValue(cmd, "-providerName"); | |||||
addValue(cmd, providerName); | |||||
} | |||||
if (null != providerClass) { | |||||
addValue(cmd, "-providerClass"); | |||||
addValue(cmd, providerClass); | |||||
if (null != providerArg) { | |||||
addValue(cmd, "-providerArg"); | |||||
addValue(cmd, providerArg); | |||||
} | |||||
} else if (null != providerArg) { | |||||
log("Ignoring providerArg as providerClass has not been set"); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
@@ -417,4 +490,13 @@ public abstract class AbstractJarSignerTask extends Task { | |||||
protected void addValue(final ExecTask cmd, String value) { | protected void addValue(final ExecTask cmd, String value) { | ||||
cmd.createArg().setValue(value); | cmd.createArg().setValue(value); | ||||
} | } | ||||
/** | |||||
* add an argument to a command | |||||
* @param cmd command to manipulate | |||||
* @param arg argument to add | |||||
*/ | |||||
protected void addArgument(final ExecTask cmd, Commandline.Argument arg) { | |||||
cmd.createArg().copyFrom(arg); | |||||
} | |||||
} | } |
@@ -178,6 +178,17 @@ public class Commandline implements Cloneable { | |||||
this.suffix = suffix != null ? suffix : ""; | this.suffix = suffix != null ? suffix : ""; | ||||
} | } | ||||
/** | |||||
* Copies settings from a different argument. | |||||
* | |||||
* @since Ant 1.10.6 | |||||
*/ | |||||
public void copyFrom(Argument other) { | |||||
this.parts = other.parts; | |||||
this.prefix = other.prefix; | |||||
this.suffix = other.suffix; | |||||
} | |||||
/** | /** | ||||
* Return the constituent parts of this Argument. | * Return the constituent parts of this Argument. | ||||
* @return an array of strings. | * @return an array of strings. | ||||