Browse Source

add nested <args> to signjar and verifyjar

master
Stefan Bodewig 6 years ago
parent
commit
d100b90032
5 changed files with 61 additions and 2 deletions
  1. +4
    -0
      WHATSNEW
  2. +9
    -1
      manual/Tasks/signjar.html
  3. +9
    -1
      manual/Tasks/verifyjar.html
  4. +28
    -0
      src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java
  5. +11
    -0
      src/main/org/apache/tools/ant/types/Commandline.java

+ 4
- 0
WHATSNEW View File

@@ -28,6 +28,10 @@ Other changes:
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.9.12 TO Ant 1.9.13
=====================================



+ 9
- 1
manual/Tasks/signjar.html View File

@@ -238,7 +238,15 @@ block</td>
<a href="exec.html#env">environment variables</a> </td>
<td valign="top" align="center">No, and only one can be supplied</td>
</tr>
</table>
<tr>
<td valign="top">arg</td>
<td valign="top">Use this to specify a <code>keytool</code>
<a href="../using.html#arg">command line argument</a> not
explicitly supported via an attribute.
<em>since Ant 1.9.14</em>.</td>
<td valign="top" align="center">No</td>
</tr>
</table>


<h3>Examples</h3>


+ 9
- 1
manual/Tasks/verifyjar.html View File

@@ -152,7 +152,15 @@ supported
<a href="exec.html#env">environment variables</a> </td>
<td valign="top" align="center">No, and only one can be supplied</td>
</tr>
</table>
<tr>
<td valign="top">arg</td>
<td valign="top">Use this to specify a <code>keytool</code>
<a href="../using.html#arg">command line argument</a> not
explicitly supported via an attribute.
<em>since Ant 1.9.14</em>.</td>
<td valign="top" align="center">No</td>
</tr>
</table>


<h3>Examples</h3>


+ 28
- 0
src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java View File

@@ -19,11 +19,14 @@
package org.apache.tools.ant.taskdefs;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
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.FileSet;
import org.apache.tools.ant.types.Path;
@@ -123,6 +126,8 @@ public abstract class AbstractJarSignerTask extends Task {
*/
private String providerName, providerClass, providerArg;

private List<Commandline.Argument> additionalArgs = new ArrayList();

/**
* Set the maximum memory to be used by the jarsigner process
*
@@ -270,6 +275,16 @@ public abstract class AbstractJarSignerTask extends Task {
this.providerArg = providerArg;
}

/**
* Adds a nested &lt;arg&gt; element that can be used to specify
* command line arguments not supported via specific attributes.
*
* @since Ant 1.9.14
*/
public void addArg(Commandline.Argument arg) {
additionalArgs.add(arg);
}

/**
* init processing logic; this is retained through our execution(s)
*/
@@ -351,6 +366,10 @@ public abstract class AbstractJarSignerTask extends Task {
for (Environment.Variable variable : sysProperties.getVariablesVector()) {
declareSysProperty(cmd, variable);
}

for (Commandline.Argument arg : additionalArgs) {
addArgument(cmd, arg);
}
}

/**
@@ -473,4 +492,13 @@ public abstract class AbstractJarSignerTask extends Task {
protected void addValue(final ExecTask cmd, String 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);
}
}

+ 11
- 0
src/main/org/apache/tools/ant/types/Commandline.java View File

@@ -182,6 +182,17 @@ public class Commandline implements Cloneable {
this.suffix = suffix != null ? suffix : "";
}

/**
* Copies settings from a different argument.
*
* @since Ant 1.9.14
*/
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 an array of strings.


Loading…
Cancel
Save