From a746e136656f7c68d06a7255162253206b4749fb Mon Sep 17 00:00:00 2001 From: Maarten Coene Date: Wed, 19 Sep 2018 21:05:48 +0200 Subject: [PATCH 1/3] The information of the -nice and -nouserlib flags was not formatted properly. --- src/main/org/apache/tools/ant/Main.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java index 33dae8cb6..704b56596 100644 --- a/src/main/org/apache/tools/ant/Main.java +++ b/src/main/org/apache/tools/ant/Main.java @@ -1046,10 +1046,10 @@ public class Main implements AntMain { System.out.println(" -inputhandler the class which will handle input requests"); System.out.println(" -find (s)earch for buildfile towards the root of"); System.out.println(" -s the filesystem and use it"); - System.out.println(" -nice number A niceness value for the main thread:" - + " 1 (lowest) to 10 (highest); 5 is the default"); - System.out.println(" -nouserlib Run ant without using the jar files from" - + " ${user.home}/.ant/lib"); + System.out.println(" -nice number A niceness value for the main thread:"); + System.out.println(" 1 (lowest) to 10 (highest); 5 is the default"); + System.out.println(" -nouserlib Run ant without using the jar files from"); + System.out.println(" ${user.home}/.ant/lib"); System.out.println(" -noclasspath Run ant without using CLASSPATH"); System.out.println(" -autoproxy Java1.5+: use the OS proxy settings"); System.out.println(" -main override Ant's normal entry point"); From a5796b5db00092b41dfcad273230451973d38b4e Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 28 Sep 2018 18:07:16 +0200 Subject: [PATCH 2/3] BZ 62534 add support for -provider* args of keytool --- WHATSNEW | 4 ++ manual/Tasks/signjar.html | 23 ++++++++ manual/Tasks/verifyjar.html | 23 ++++++++ .../ant/taskdefs/AbstractJarSignerTask.java | 54 +++++++++++++++++++ 4 files changed, 104 insertions(+) diff --git a/WHATSNEW b/WHATSNEW index 9d96ca56d..608527474 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -24,6 +24,10 @@ Other changes: * the selector has a new built-in algorithm 'lastmodified' which computes a value based upon the lastmodified time of the file. + * signjar and verifyjar now support the -providerName, -providerClass + and -providerArg command line options of keytool via new attributes. + Bugzilla Report 65234 + Changes from Ant 1.9.12 TO Ant 1.9.13 ===================================== diff --git a/manual/Tasks/signjar.html b/manual/Tasks/signjar.html index 32315c158..f6a7a376a 100644 --- a/manual/Tasks/signjar.html +++ b/manual/Tasks/signjar.html @@ -186,6 +186,29 @@ block name of digest algorithm No + + providername + name of a cryptographic service provider's name + when listed in the security properties file. + since Ant 1.9.14. + No + + + providerclass + name of a cryptographic service provider's master + class file when the service provider is not listed in the security + properties file. + since Ant 1.9.14. + No + + + providerarg + Represents an optional string input argument for + the constructor of provider_class_name. Ignored + if providerclass is not set. + since Ant 1.9.14. + No +

Parameters as nested elements

diff --git a/manual/Tasks/verifyjar.html b/manual/Tasks/verifyjar.html index 886075a79..bf442b728 100644 --- a/manual/Tasks/verifyjar.html +++ b/manual/Tasks/verifyjar.html @@ -105,6 +105,29 @@ supported since Ant 1.8.0. + + + + + + + + + + + + + + +
No
providernamename of a cryptographic service provider's name + when listed in the security properties file. + since Ant 1.9.14.No
providerclassname of a cryptographic service provider's master + class file when the service provider is not listed in the security + properties file. + since Ant 1.9.14.No
providerargRepresents an optional string input argument for + the constructor of provider_class_name. Ignored + if providerclass is not set. + since Ant 1.9.14.No

Parameters as nested elements

diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java index b2fe8d441..b15d2bc9f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java @@ -116,6 +116,13 @@ public abstract class AbstractJarSignerTask extends Task { */ private String executable; + /** + * Values for the providerName, providerClass, and providerArg options. + * + * @since Ant 1.9.14 + */ + private String providerName, providerClass, providerArg; + /** * Set the maximum memory to be used by the jarsigner process * @@ -230,6 +237,39 @@ public abstract class AbstractJarSignerTask extends Task { 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.9.14 + */ + 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.9.14 + */ + 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.9.14 + */ + public void setProviderArg(String providerArg) { + this.providerArg = providerArg; + } + /** * init processing logic; this is retained through our execution(s) */ @@ -347,6 +387,20 @@ public abstract class AbstractJarSignerTask extends Task { 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"); + } } /** From d100b900324ad91f3de6e8c323720e1676bbb28d Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Fri, 28 Sep 2018 18:23:25 +0200 Subject: [PATCH 3/3] add nested to signjar and verifyjar --- WHATSNEW | 4 +++ manual/Tasks/signjar.html | 10 ++++++- manual/Tasks/verifyjar.html | 10 ++++++- .../ant/taskdefs/AbstractJarSignerTask.java | 28 +++++++++++++++++++ .../apache/tools/ant/types/Commandline.java | 11 ++++++++ 5 files changed, 61 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 608527474..6cd11da77 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -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 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 ===================================== diff --git a/manual/Tasks/signjar.html b/manual/Tasks/signjar.html index f6a7a376a..88bdb4380 100644 --- a/manual/Tasks/signjar.html +++ b/manual/Tasks/signjar.html @@ -238,7 +238,15 @@ block environment variables -
No, and only one can be supplied
+ + arg + Use this to specify a keytool + command line argument not + explicitly supported via an attribute. + since Ant 1.9.14. + No + +

Examples

diff --git a/manual/Tasks/verifyjar.html b/manual/Tasks/verifyjar.html index bf442b728..b2df42623 100644 --- a/manual/Tasks/verifyjar.html +++ b/manual/Tasks/verifyjar.html @@ -152,7 +152,15 @@ supported environment variables No, and only one can be supplied - + + arg + Use this to specify a keytool + command line argument not + explicitly supported via an attribute. + since Ant 1.9.14. + No + +

Examples

diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java index b15d2bc9f..b81179728 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java @@ -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 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 <arg> 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); + } } diff --git a/src/main/org/apache/tools/ant/types/Commandline.java b/src/main/org/apache/tools/ant/types/Commandline.java index a1859ba79..77d953b24 100644 --- a/src/main/org/apache/tools/ant/types/Commandline.java +++ b/src/main/org/apache/tools/ant/types/Commandline.java @@ -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.