conor 02/02/06 02:15:05
Modified: proposal/mutant ant1compat.xml
proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib
AntLibrarySpec.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution
ExecutionContext.java ExecutionFrame.java
ExecutionManager.java
proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser
TargetHandler.java
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant
Ant1Factory.java ProjectComponent.java Task.java
proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system
AntBase.java
proposal/mutant/src/java/cli/org/apache/ant/cli
Commandline.java
proposal/mutant/src/java/common/org/apache/ant/common/model
Target.java
proposal/mutant/src/java/common/org/apache/ant/common/util
FileUtils.java
proposal/mutant/src/java/start/org/apache/ant/start
Main.java
Log:
Various changes to mutant.
Add capability to specify configs on command line
Clean up audit stuff
Add if/unless to targets
Implement inheritAll
Revision Changes Path
1.3 +40 -33 jakarta-ant/proposal/mutant/ant1compat.xml
Index: ant1compat.xml
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/ant1compat.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- ant1compat.xml 5 Feb 2002 11:59:28 -0000 1.2
+++ ant1compat.xml 6 Feb 2002 10:15:04 -0000 1.3
@@ -66,7 +66,7 @@
<patternset refid="converted"/>
</fileset>
- <path id="classpath.ant1compat">
+ <path id="classpath">
<pathelement location="${distlib.dir}/init.jar"/>
<fileset dir="${lib.dir}/parser" includes="*.jar"/>
<fileset dir="${lib.dir}/ant1compat" includes="*.jar"/>
@@ -79,95 +79,98 @@
<available property="jdk1.4+" classname="java.lang.CharSequence" />
<available property="bsf.present"
classname="com.ibm.bsf.BSFManager"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="netrexx.present"
classname="netrexx.lang.Rexx"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="trax.present"
classname="javax.xml.transform.Transformer"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="xslp.present"
classname="com.kvisco.xsl.XSLProcessor"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="xalan.present"
classname="org.apache.xalan.xslt.XSLTProcessorFactory"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="xalan2.present"
classname="org.apache.xalan.transformer.TransformerImpl"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="ejb.ejbc.present"
classname="weblogic.ejbc"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="ejb.DDCreator.present"
classname="weblogic.ejb.utils.DDCreator"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="ejb.wls.present"
classname="weblogic.Server"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="junit.present"
classname="junit.framework.TestCase"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="netcomp.present"
classname="com.oroinc.net.ftp.FTPClient"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="starteam.present"
classname="com.starbase.util.Platform"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="antlr.present"
classname="antlr.Tool"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="vaj.present"
classname="com.ibm.ivj.util.base.Workspace"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="stylebook.present"
classname="org.apache.stylebook.Engine"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="jakarta.regexp.present"
classname="org.apache.regexp.RE"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="jakarta.oro.present"
classname="org.apache.oro.text.regex.Perl5Matcher"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="jmf.present"
classname="javax.sound.sampled.Clip"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="icontract.present"
classname="com.reliablesystems.iContract.IContracted"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="jdepend.present"
classname="jdepend.framework.JDepend"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="log4j.present"
classname="org.apache.log4j.Category"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<!-- this is just a way to check for a TraX implementation -->
<available property="trax.impl.present"
resource="META-INF/services/javax.xml.transform.TransformerFactory"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="xalan.envcheck"
classname="org.apache.xalan.xslt.EnvironmentCheck"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="which.present"
classname="org.apache.env.Which"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="servlet.present"
classname="javax.servlet.Servlet"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available property="xerces.present"
classname="org.apache.xerces.parsers.SAXParser"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
<available property="bcel.present"
classname="org.apache.bcel.Constants"
- classpathref="classpath.ant1compat" />
+ classpathref="classpath" />
+ <available property="sunuue.present"
+ classname="sun.misc.UUEncoder"
+ classpathref="classpath" />
<condition property="javamail.complete">
<and>
<available classname="javax.activation.DataHandler"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
<available classname="javax.mail.Transport"
- classpathref="classpath.ant1compat"/>
+ classpathref="classpath"/>
</and>
</condition>
@@ -194,12 +197,12 @@
<fileset refid="ant1src"/>
</copy>
<depend destdir="${bin.dir}/ant1compat" srcdir="${bin.dir}/ant1src;${java.dir}/antlibs/ant1compat">
- <classpath refid="classpath.ant1compat"/>
+ <classpath refid="classpath"/>
</depend>
<javac destdir="${bin.dir}/ant1compat"
srcdir="${bin.dir}/ant1src;${java.dir}/antlibs/ant1compat"
includeAntRuntime="false" debug="${debug}">
- <classpath refid="classpath.ant1compat"/>
+ <classpath refid="classpath"/>
<exclude name="${regexp.package}/JakartaRegexp*.java"
unless="jakarta.regexp.present" />
<exclude name="${regexp.package}/JakartaOro*.java"
@@ -208,9 +211,14 @@
unless="jdk1.4+" />
<exclude name="${ant.package}/AntSecurityManager.java"
unless="jdk1.2+" />
+ <exclude name="${ant.package}/util/optional/NoExitSecurityManager.java"
+ unless="jdk1.2+" />
<exclude name="${ant.package}/listener/Log4jListener.java"
unless="log4j.present" />
+ <exclude name="${ant.package}/taskdefs/email/UUMailer.java" unless="sunuue.present"
/>
+ <exclude name="${ant.package}/taskdefs/email/MimeMailer.java" unless="javamail.complete"
/>
+
<exclude name="${optional.package}/IContract.java" unless="icontract.present"
/>
<exclude name="${optional.package}/Script.java" unless="bsf.present" />
<exclude name="${optional.package}/StyleBook.java" unless="stylebook.present"
/>
@@ -228,7 +236,6 @@
<exclude name="${optional.package}/ejb/IPlanet*.java" unless="ejbjar.support"
/>
<exclude name="${optional.package}/Javah.java" unless="jdk1.2+" />
<exclude name="${optional.package}/junit/*" unless="junit.present" />
- <exclude name="${optional.package}/net/MimeMail.java" unless="javamail.complete"
/>
<exclude name="${optional.package}/net/FTP.java" unless="netcomp.present" />
<exclude name="${optional.package}/net/TelnetTask.java" unless="netcomp.present"
/>
<exclude name="${optional.package}/scm/AntStarTeam*.java" unless="starteam.present"
/>
1.5 +0 -3 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java
Index: AntLibrarySpec.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- AntLibrarySpec.java 5 Feb 2002 11:49:04 -0000 1.4
+++ AntLibrarySpec.java 6 Feb 2002 10:15:04 -0000 1.5
@@ -106,9 +106,6 @@
/** Flag which indicates if tools.jar is required */
private boolean toolsJarRequired = false;
- /** Flag which indicates that this library is a system library */
- private boolean systemLibrary = false;
-
/**
* This flag indicates that this task processes XML and wishes to use
* the XML parser packaged with Ant
1.4 +0 -4 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java
Index: ExecutionContext.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- ExecutionContext.java 5 Feb 2002 11:49:04 -0000 1.3
+++ ExecutionContext.java 6 Feb 2002 10:15:04 -0000 1.4
@@ -56,7 +56,6 @@
import org.apache.ant.common.antlib.AntContext;
import org.apache.ant.common.model.ModelElement;
import org.apache.ant.common.util.ExecutionException;
-import org.apache.ant.common.util.FileUtils;
/**
* This is the core's implementation of the AntContext for all core objects.
@@ -74,9 +73,6 @@
/** the model in the build model with which this context is associated */
private ModelElement modelElement;
-
- /** General file utilities */
- private FileUtils fileUtils = new FileUtils();
/**
* Initilaise this context's environment
1.8 +18 -1 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java
Index: ExecutionFrame.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -u -r1.7 -r1.8
--- ExecutionFrame.java 5 Feb 2002 14:13:57 -0000 1.7
+++ ExecutionFrame.java 6 Feb 2002 10:15:04 -0000 1.8
@@ -604,6 +604,24 @@
throws ExecutionException {
Throwable failureCause = null;
Target target = project.getTarget(targetName);
+ String ifCondition = target.getIfCondition();
+ String unlessCondition = target.getUnlessCondition();
+
+ if (ifCondition != null) {
+ ifCondition = dataService.replacePropertyRefs(ifCondition.trim());
+ if (!isDataValueSet(ifCondition)) {
+ return;
+ }
+ }
+
+ if (unlessCondition != null) {
+ unlessCondition
+ = dataService.replacePropertyRefs(unlessCondition.trim());
+ if (isDataValueSet(unlessCondition)) {
+ return;
+ }
+ }
+
try {
Iterator taskIterator = target.getTasks();
eventSupport.fireTargetStarted(target);
@@ -832,7 +850,6 @@
= reflector.createElement(element, nestedElementName);
factory.registerCreatedElement(nestedElement);
if (nestedElement instanceof ExecutionComponent) {
- System.out.println("element is an execution component");
ExecutionComponent component
= (ExecutionComponent)nestedElement;
ExecutionContext context
1.5 +0 -6 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java
Index: ExecutionManager.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- ExecutionManager.java 5 Feb 2002 11:49:04 -0000 1.4
+++ ExecutionManager.java 6 Feb 2002 10:15:04 -0000 1.5
@@ -127,13 +127,11 @@
librarySpecs.clear();
// add any additional libraries.
- if (config != null) {
for (Iterator i = config.getLibraryLocations(); i.hasNext(); ) {
// try file first
String libLocation = (String)i.next();
libManager.loadLib(librarySpecs, libLocation);
}
- }
libManager.configLibraries(initConfig, librarySpecs, antLibraries);
addConfigLibPaths();
@@ -201,10 +199,6 @@
*/
private void addConfigLibPaths()
throws ExecutionException {
- if (config == null) {
- return;
- }
-
// now add any additional library Paths specified by the config
for (Iterator i = config.getLibraryIds(); i.hasNext(); ) {
String libraryId = (String)i.next();
1.2 +2 -0 jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java
Index: TargetHandler.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- TargetHandler.java 5 Feb 2002 11:49:05 -0000 1.1
+++ TargetHandler.java 6 Feb 2002 10:15:04 -0000 1.2
@@ -115,6 +115,8 @@
target.addDependency(dependency);
}
}
+ target.setIfCondition(getAttribute(IF_ATTR));
+ target.setUnlessCondition(getAttribute(UNLESS_ATTR));
}
1.3 +4 -9 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java
Index: Ant1Factory.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- Ant1Factory.java 5 Feb 2002 14:13:57 -0000 1.2
+++ Ant1Factory.java 6 Feb 2002 10:15:04 -0000 1.3
@@ -135,17 +135,12 @@
*/
public Object createTaskInstance(Class taskClass)
throws InstantiationException, IllegalAccessException {
- Object o = taskClass.newInstance();
- if (o instanceof ProjectComponent) {
- ((ProjectComponent)o).setProject(project);
+ Object instance = taskClass.newInstance();
+ if (instance instanceof ProjectComponent) {
+ ((ProjectComponent)instance).setProject(project);
}
- // XXX task.setTaskType(taskType);
-
- // set default value, can be changed by the user
- // XXX task.setTaskName(taskType);
-
- return o;
+ return instance;
}
/**
1.3 +4 -2 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java
Index: ProjectComponent.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- ProjectComponent.java 5 Feb 2002 11:49:05 -0000 1.2
+++ ProjectComponent.java 6 Feb 2002 10:15:04 -0000 1.3
@@ -141,8 +141,10 @@
* @param level the priority level of the message
*/
public void log(String message, int level) {
+ if (context != null) {
context.log(message, level);
}
+ }
/**
* Log a message as a build event
@@ -150,7 +152,7 @@
* @param message the message to be logged
*/
public void log(String message) {
- context.log(message, Project.MSG_INFO);
+ log(message, Project.MSG_INFO);
}
1.3 +18 -0 jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java
Index: Task.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- Task.java 5 Feb 2002 11:49:05 -0000 1.2
+++ Task.java 6 Feb 2002 10:15:04 -0000 1.3
@@ -53,6 +53,10 @@
*/
package org.apache.tools.ant;
+import org.apache.ant.common.antlib.AntContext;
+import org.apache.ant.common.util.ExecutionException;
+import org.apache.ant.common.model.BuildElement;
+
/**
* Ant1 Task facade
*
@@ -70,6 +74,20 @@
/** The description of this task */
protected String description = null;
+ /**
+ * Initialise this component
+ *
+ * @param context the core context for this component
+ * @exception ExecutionException if the component cannot be initialized
+ */
+ public void init(AntContext context) throws ExecutionException {
+ super.init(context);
+
+ BuildElement buildElement = (BuildElement)context.getModelElement();
+ taskType = buildElement.getType();
+ taskName = taskType;
+ }
+
/**
* Set the name to use in logging messages.
*
1.3 +8 -1 jakarta-ant/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java
Index: AntBase.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- AntBase.java 5 Feb 2002 11:59:28 -0000 1.2
+++ AntBase.java 6 Feb 2002 10:15:04 -0000 1.3
@@ -307,7 +307,14 @@
* @return the properties the sub-build will start with
*/
protected Map getProperties() {
+ if (!inheritAll) {
return properties;
+ }
+
+ // need to combine existing properties with new ones
+ Map subBuildProperties = dataService.getAllProperties();
+ subBuildProperties.putAll(properties);
+ return subBuildProperties;
}
}
1.5 +72 -40 jakarta-ant/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java
Index: Commandline.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -u -r1.4 -r1.5
--- Commandline.java 5 Feb 2002 11:49:06 -0000 1.4
+++ Commandline.java 6 Feb 2002 10:15:04 -0000 1.5
@@ -93,7 +93,7 @@
public final static String DEFAULT_ANT1_FILENAME = "build.xml";
/** The initialisation configuration for Ant */
- private InitConfig config;
+ private InitConfig initConfig;
/** Stream that we are using for logging */
private PrintStream out = System.out;
@@ -110,6 +110,9 @@
/** The command line properties */
private Map definedProperties = new HashMap();
+ /** The Config files to use in this run */
+ private List configFiles = new ArrayList();
+
/**
* This is the build file to run. By default it is a file: type URL but
* other URL protocols can be used.
@@ -186,8 +189,26 @@
* formed.
*/
private AntConfig getAntConfig(File configArea) throws ConfigException {
- try {
File configFile = new File(configArea, "antconfig.xml");
+ try {
+ return getAntConfigFile(configFile);
+ } catch (FileNotFoundException e) {
+ // ignore if files are not present
+ return null;
+ }
+ }
+
+ /**
+ * Read in a config file
+ *
+ * @param configFile the file containing the XML config
+ * @return the parsed config object
+ * @exception ConfigException if the config cannot be parsed
+ * @exception FileNotFoundException if the file cannot be found.
+ */
+ private AntConfig getAntConfigFile(File configFile)
+ throws ConfigException, FileNotFoundException {
+ try {
URL configFileURL = InitUtils.getFileURL(configFile);
ParseContext context = new ParseContext();
@@ -198,15 +219,36 @@
return configHandler.getAntConfig();
} catch (MalformedURLException e) {
throw new ConfigException("Unable to form URL to read config from "
- + configArea, e);
+ + configFile, e);
} catch (XMLParseException e) {
- if (!(e.getCause() instanceof FileNotFoundException)) {
+ if (e.getCause() instanceof FileNotFoundException) {
+ throw (FileNotFoundException)e.getCause();
+ }
+
throw new ConfigException("Unable to parse config file from "
- + configArea, e);
+ + configFile, e);
}
- // ignore missing config files
- return null;
}
+
+ /**
+ * Get an option value
+ *
+ * @param args the full list of command line arguments
+ * @param position the position in the args array where the value shoudl be
+ * @param argType the option type
+ * @return the value of the option
+ * @exception ConfigException if the option cannot be read
+ */
+ private String getOption(String[] args, int position, String argType)
+ throws ConfigException {
+ String value = null;
+ try {
+ value = args[position];
+ } catch (IndexOutOfBoundsException e) {
+ throw new ConfigException("You must specify a value for the "
+ + argType + " argument");
+ }
+ return value;
}
@@ -217,22 +259,29 @@
* @param initConfig Ant's initialization configuration
*/
private void process(String[] args, InitConfig initConfig) {
- this.config = initConfig;
+ this.initConfig = initConfig;
System.out.println("Ant Home is " + initConfig.getAntHome());
try {
parseArguments(args);
+ AntConfig config = new AntConfig();
AntConfig userConfig = getAntConfig(initConfig.getUserConfigArea());
AntConfig systemConfig
= getAntConfig(initConfig.getSystemConfigArea());
- AntConfig config = systemConfig;
- if (config == null) {
- config = userConfig;
- } else if (userConfig != null) {
+ if (systemConfig != null) {
+ config.merge(systemConfig);
+ }
+ if (userConfig != null) {
config.merge(userConfig);
}
+ for (Iterator i = configFiles.iterator(); i.hasNext(); ) {
+ File configFile = (File)i.next();
+ AntConfig runConfig = getAntConfigFile(configFile);
+ config.merge(runConfig);
+ }
+
if (!buildFileURL.getProtocol().equals("file")
&& !config.isRemoteProjectAllowed()) {
throw new ConfigException("Remote Projects are not allowed: "
@@ -284,6 +333,7 @@
return project;
}
+
/**
* Parse the command line arguments.
*
@@ -301,7 +351,7 @@
if (arg.equals("-buildfile") || arg.equals("-file")
|| arg.equals("-f")) {
try {
- String url = args[i++];
+ String url = getOption(args, i++, arg);
if (url.indexOf(":") == -1) {
// We convert any hash characters to their URL escape.
buildFileURL = InitUtils.getFileURL(new File(url));
@@ -312,14 +362,10 @@
System.err.println("Buildfile is not valid: " +
e.getMessage());
throw new ConfigException("Build file is not valid", e);
- } catch (ArrayIndexOutOfBoundsException e) {
- System.err.println("You must specify a buildfile when " +
- "using the -buildfile argument");
- return;
}
} else if (arg.equals("-logfile") || arg.equals("-l")) {
try {
- File logFile = new File(args[i++]);
+ File logFile = new File(getOption(args, i++, arg));
out = new PrintStream(new FileOutputStream(logFile));
err = out;
} catch (IOException ioe) {
@@ -327,10 +373,6 @@
"file. Make sure the path exists and " +
"you have write permissions.");
return;
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- System.err.println("You must specify a log file when " +
- "using the -log argument");
- return;
}
} else if (arg.equals("-quiet") || arg.equals("-q")) {
messageOutputLevel = MessageLevel.MSG_WARN;
@@ -340,27 +382,17 @@
} else if (arg.equals("-debug")) {
// printVersion();
messageOutputLevel = MessageLevel.MSG_DEBUG;
+ } else if (arg.equals("-config") || arg.equals("-c")) {
+ configFiles.add(new File(getOption(args, i++, arg)));
} else if (arg.equals("-listener")) {
- try {
- listeners.add(args[i++]);
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- System.err.println("You must specify a classname when " +
- "using the -listener argument");
- return;
- }
+ listeners.add(getOption(args, i++, arg));
} else if (arg.equals("-logger")) {
if (loggerClassname != null) {
System.err.println("Only one logger class may be " +
"specified.");
return;
}
- try {
- loggerClassname = args[i++];
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- System.err.println("You must specify a classname when " +
- "using the -logger argument");
- return;
- }
+ loggerClassname = getOption(args, i++, arg);
} else if (arg.startsWith("-D")) {
String name = arg.substring(2, arg.length());
String value = null;
@@ -368,8 +400,8 @@
if (posEq > 0) {
value = name.substring(posEq + 1);
name = name.substring(0, posEq);
- } else if (i < args.length - 1) {
- value = args[++i];
+ } else {
+ value = getOption(args, i++, arg);
}
definedProperties.put(name, value);
} else if (arg.startsWith("-")) {
1.2 +119 -76 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/model/Target.java
Index: Target.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/model/Target.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -u -r1.1 -r1.2
--- Target.java 5 Feb 2002 11:49:06 -0000 1.1
+++ Target.java 6 Feb 2002 10:15:04 -0000 1.2
@@ -78,6 +78,12 @@
/** The Target's description */
private String description;
+ /** Description of the Field */
+ private String ifCondition;
+
+ /** Description of the Field */
+ private String unlessCondition;
+
/**
* Construct the target, given its name
*
@@ -90,6 +96,24 @@
}
/**
+ * Sets the IfCondition of the Target
+ *
+ * @param ifCondition The new IfCondition value
+ */
+ public void setIfCondition(String ifCondition) {
+ this.ifCondition = ifCondition;
+ }
+
+ /**
+ * Sets the UnlessCondition of the Target
+ *
+ * @param unlessCondition The new UnlessCondition value
+ */
+ public void setUnlessCondition(String unlessCondition) {
+ this.unlessCondition = unlessCondition;
+ }
+
+ /**
* Sets the Target's description
*
* @param description The new description value
@@ -99,6 +123,24 @@
}
/**
+ * Gets the IfCondition of the Target
+ *
+ * @return The IfCondition value
+ */
+ public String getIfCondition() {
+ return ifCondition;
+ }
+
+ /**
+ * Gets the UnlessCondition of the Target
+ *
+ * @return The UnlessCondition value
+ */
+ public String getUnlessCondition() {
+ return unlessCondition;
+ }
+
+ /**
* Get this target's name.
*
* @return the target's name.
@@ -147,7 +189,8 @@
/**
* Add a dependency to this target
*
- * @param dependency the name of a target upon which this target depends
+ * @param dependency the name of a target upon which this target
+ * depends
*/
public void addDependency(String dependency) {
dependencies.add(dependency);
1.3 +2 -1 jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java
Index: FileUtils.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -u -r1.2 -r1.3
--- FileUtils.java 2 Feb 2002 14:50:33 -0000 1.2
+++ FileUtils.java 6 Feb 2002 10:15:05 -0000 1.3
@@ -221,7 +221,8 @@
}
StringBuffer sb = new StringBuffer();
- for (int i = 0; i < s.size(); i++) {
+ int size = s.size();
+ for (int i = 0; i < size; i++) {
if (i > 1) {
// not before the filesystem root and not after it, since root
// already contains one
1.4 +2 -0 jakarta-ant/proposal/mutant/src/java/start/org/apache/ant/start/Main.java
Index: Main.java
===================================================================
RCS file: /home/cvs/jakarta-ant/proposal/mutant/src/java/start/org/apache/ant/start/Main.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -u -r1.3 -r1.4
--- Main.java 2 Feb 2002 14:50:34 -0000 1.3
+++ Main.java 6 Feb 2002 10:15:05 -0000 1.4
@@ -243,6 +243,8 @@
= new URLClassLoader(LoaderUtils.getLocationURLs(cliJarLib,
"cli.jar"), coreLoader);
+ //System.out.println("System Loader config");
+ //LoaderUtils.dumpLoader(System.out, systemLoader);
// System.out.println("Front End Loader config");
// LoaderUtils.dumpLoader(System.out, frontEndLoader);
--
To unsubscribe, e-mail: <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
|