|
|
@@ -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); |
|
|
|
|
|
} |
|
|
} |
|
|
} |