From 984e12200a21e70c9ec9086f8c69e86aaa0d7de9 Mon Sep 17 00:00:00 2001 From: Conor MacNeill Date: Wed, 6 Feb 2002 10:15:05 +0000 Subject: [PATCH] Various changes to mutant. Add capability to specify configs on command line Clean up audit stuff Add if/unless to targets Implement inheritAll git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271172 13f79535-47bb-0310-9956-ffa450edef68 --- proposal/mutant/ant1compat.xml | 73 +++---- .../ant/antcore/antlib/AntLibrarySpec.java | 3 - .../antcore/execution/ExecutionContext.java | 4 - .../ant/antcore/execution/ExecutionFrame.java | 19 +- .../antcore/execution/ExecutionManager.java | 6 - .../antcore/modelparser/TargetHandler.java | 2 + .../org/apache/tools/ant/Ant1Factory.java | 13 +- .../apache/tools/ant/ProjectComponent.java | 6 +- .../ant1compat/org/apache/tools/ant/Task.java | 18 ++ .../org/apache/ant/antlib/system/AntBase.java | 9 +- .../cli/org/apache/ant/cli/Commandline.java | 112 +++++++---- .../org/apache/ant/common/model/Target.java | 181 +++++++++++------- .../org/apache/ant/common/util/FileUtils.java | 3 +- .../java/start/org/apache/ant/start/Main.java | 2 + 14 files changed, 282 insertions(+), 169 deletions(-) diff --git a/proposal/mutant/ant1compat.xml b/proposal/mutant/ant1compat.xml index 4b89f002e..5cfd8852e 100644 --- a/proposal/mutant/ant1compat.xml +++ b/proposal/mutant/ant1compat.xml @@ -66,7 +66,7 @@ - + @@ -79,95 +79,98 @@ + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath"/> + classpathref="classpath"/> + classpathref="classpath"/> + classpathref="classpath"/> + classpathref="classpath" /> + classpathref="classpath"/> + classpathref="classpath"/> + classpathref="classpath"/> + classpathref="classpath"/> + classpathref="classpath"/> + classpathref="classpath" /> + classpathref="classpath" /> + classpathref="classpath"/> + classpathref="classpath" /> + classpathref="classpath" /> + + classpathref="classpath"/> + classpathref="classpath"/> @@ -194,12 +197,12 @@ - + - + + + + + @@ -228,7 +236,6 @@ - diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java index c3c270d4f..1a74361c3 100755 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java @@ -106,9 +106,6 @@ public class AntLibrarySpec { /** 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 diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java index d71190ce8..bf28d8318 100755 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java @@ -56,7 +56,6 @@ import java.io.File; 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. @@ -75,9 +74,6 @@ public class ExecutionContext implements AntContext { /** 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 * diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java index 3153d6bfa..5cc8abf7f 100755 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java @@ -604,6 +604,24 @@ public class ExecutionFrame { 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 @@ public class ExecutionFrame { = 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 diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java index 1f4e5aefb..538872ba5 100755 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java @@ -127,13 +127,11 @@ public class ExecutionManager { 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 @@ public class ExecutionManager { */ 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(); diff --git a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java index 8ee9efd3c..91dc980b3 100644 --- a/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java +++ b/proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java @@ -115,6 +115,8 @@ public class TargetHandler extends ElementHandler { target.addDependency(dependency); } } + target.setIfCondition(getAttribute(IF_ATTR)); + target.setUnlessCondition(getAttribute(UNLESS_ATTR)); } diff --git a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java index 5681e1818..8e9b94481 100644 --- a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java +++ b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java @@ -135,17 +135,12 @@ public class Ant1Factory extends StandardLibFactory { */ 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; } /** diff --git a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java index c30671e27..2accd420e 100644 --- a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java +++ b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java @@ -141,7 +141,9 @@ public abstract class ProjectComponent { * @param level the priority level of the message */ public void log(String message, int level) { - context.log(message, level); + if (context != null) { + context.log(message, level); + } } /** @@ -150,7 +152,7 @@ public abstract class ProjectComponent { * @param message the message to be logged */ public void log(String message) { - context.log(message, Project.MSG_INFO); + log(message, Project.MSG_INFO); } diff --git a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java index c2fa2ed1f..398020aed 100644 --- a/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java +++ b/proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java @@ -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 @@ public abstract class Task extends ProjectComponent /** 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. * diff --git a/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java b/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java index 877001b72..b39742347 100644 --- a/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java +++ b/proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java @@ -307,7 +307,14 @@ public abstract class AntBase extends AbstractTask { * @return the properties the sub-build will start with */ protected Map getProperties() { - return properties; + if (!inheritAll) { + return properties; + } + + // need to combine existing properties with new ones + Map subBuildProperties = dataService.getAllProperties(); + subBuildProperties.putAll(properties); + return subBuildProperties; } } diff --git a/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java b/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java index c77291c24..965397309 100755 --- a/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java +++ b/proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java @@ -93,7 +93,7 @@ public class Commandline { 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 @@ public class Commandline { /** 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 @@ public class Commandline { * formed. */ private AntConfig getAntConfig(File configArea) throws ConfigException { + 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 { - File configFile = new File(configArea, "antconfig.xml"); URL configFileURL = InitUtils.getFileURL(configFile); ParseContext context = new ParseContext(); @@ -198,17 +219,38 @@ public class Commandline { 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)) { - throw new ConfigException("Unable to parse config file from " - + configArea, e); + if (e.getCause() instanceof FileNotFoundException) { + throw (FileNotFoundException)e.getCause(); } - // ignore missing config files - return null; + + throw new ConfigException("Unable to parse config file from " + + configFile, e); } } + /** + * 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; + } + /** * Start the command line front end for mutant. @@ -217,22 +259,29 @@ public class Commandline { * @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 @@ public class Commandline { return project; } + /** * Parse the command line arguments. * @@ -301,7 +351,7 @@ public class Commandline { 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 @@ public class Commandline { 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 @@ public class Commandline { "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 @@ public class Commandline { } 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 @@ public class Commandline { 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("-")) { @@ -385,7 +417,7 @@ public class Commandline { if (buildFileURL == null) { File defaultBuildFile = new File(DEFAULT_BUILD_FILENAME); if (!defaultBuildFile.exists()) { - File ant1BuildFile = new File(DEFAULT_ANT1_FILENAME); + File ant1BuildFile = new File(DEFAULT_ANT1_FILENAME); if (ant1BuildFile.exists()) { defaultBuildFile = ant1BuildFile; } diff --git a/proposal/mutant/src/java/common/org/apache/ant/common/model/Target.java b/proposal/mutant/src/java/common/org/apache/ant/common/model/Target.java index 11347cd8f..da24fc392 100644 --- a/proposal/mutant/src/java/common/org/apache/ant/common/model/Target.java +++ b/proposal/mutant/src/java/common/org/apache/ant/common/model/Target.java @@ -1,55 +1,55 @@ /* - * The Apache Software License, Version 1.1 + * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights - * reserved. + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. * - * 4. The names "The Jakarta Project", "Ant", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact apache@apache.org. + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . */ package org.apache.ant.common.model; import java.util.ArrayList; @@ -59,30 +59,36 @@ import java.util.List; import org.apache.ant.common.util.Location; /** - * A Target is a collection of tasks. It may have dependencies on other - * targets + * A Target is a collection of tasks. It may have dependencies on other + * targets * - * @author Conor MacNeill - * @created 12 January 2002 + * @author Conor MacNeill + * @created 12 January 2002 */ public class Target extends ModelElement { - /** This target's dependencies on other targets, if any */ + /** This target's dependencies on other targets, if any */ private List dependencies = new ArrayList(); - /** This target's list of tasks */ + /** This target's list of tasks */ private List tasks = new ArrayList(); - /** The target's name. */ + /** The target's name. */ private String name; - /** The Target's description */ + /** 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 + * Construct the target, given its name * - * @param location the location of the element - * @param name the target's name. + * @param location the location of the element + * @param name the target's name. */ public Target(Location location, String name) { super(location); @@ -90,27 +96,63 @@ public class Target extends ModelElement { } /** - * Sets the Target's description + * 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 + * @param description The new description value */ public void setDescription(String description) { this.description = description; } /** - * Get this target's name. + * 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. + * @return the target's name. */ public String getName() { return name; } /** - * Gets the Target's description + * Gets the Target's description * - * @return The description value + * @return The description value */ public String getDescription() { return description; @@ -118,45 +160,46 @@ public class Target extends ModelElement { /** - * Get this target's dependencies. + * Get this target's dependencies. * - * @return an iterator over the target's dependencies. + * @return an iterator over the target's dependencies. */ public Iterator getDependencies() { return dependencies.iterator(); } /** - * Get the tasks for this target + * Get the tasks for this target * - * @return an iterator over the set of tasks for this target. + * @return an iterator over the set of tasks for this target. */ public Iterator getTasks() { return tasks.iterator(); } /** - * Add a task to this target + * Add a task to this target * - * @param task the task to be added to the target. + * @param task the task to be added to the target. */ public void addTask(BuildElement task) { tasks.add(task); } /** - * Add a dependency to this target + * 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); } /** - * Validate that this build element is configured correctly + * Validate that this build element is configured correctly * - * @exception ModelException if the element is invalid + * @exception ModelException if the element is invalid */ public void validate() throws ModelException { if (name == null) { diff --git a/proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java b/proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java index d7b6afdc8..a326e0bad 100644 --- a/proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java +++ b/proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java @@ -221,7 +221,8 @@ public class FileUtils { } 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 diff --git a/proposal/mutant/src/java/start/org/apache/ant/start/Main.java b/proposal/mutant/src/java/start/org/apache/ant/start/Main.java index 69e23fee6..511d44504 100755 --- a/proposal/mutant/src/java/start/org/apache/ant/start/Main.java +++ b/proposal/mutant/src/java/start/org/apache/ant/start/Main.java @@ -243,6 +243,8 @@ public class Main { = 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);