Browse Source

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
master
Conor MacNeill 23 years ago
parent
commit
984e12200a
14 changed files with 282 additions and 169 deletions
  1. +40
    -33
      proposal/mutant/ant1compat.xml
  2. +0
    -3
      proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java
  3. +0
    -4
      proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java
  4. +18
    -1
      proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java
  5. +0
    -6
      proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java
  6. +2
    -0
      proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java
  7. +4
    -9
      proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java
  8. +4
    -2
      proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java
  9. +18
    -0
      proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java
  10. +8
    -1
      proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java
  11. +72
    -40
      proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java
  12. +112
    -69
      proposal/mutant/src/java/common/org/apache/ant/common/model/Target.java
  13. +2
    -1
      proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java
  14. +2
    -0
      proposal/mutant/src/java/start/org/apache/ant/start/Main.java

+ 40
- 33
proposal/mutant/ant1compat.xml View File

@@ -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" />


+ 0
- 3
proposal/mutant/src/java/antcore/org/apache/ant/antcore/antlib/AntLibrarySpec.java View File

@@ -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


+ 0
- 4
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionContext.java View File

@@ -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
*


+ 18
- 1
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionFrame.java View File

@@ -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


+ 0
- 6
proposal/mutant/src/java/antcore/org/apache/ant/antcore/execution/ExecutionManager.java View File

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


+ 2
- 0
proposal/mutant/src/java/antcore/org/apache/ant/antcore/modelparser/TargetHandler.java View File

@@ -115,6 +115,8 @@ public class TargetHandler extends ElementHandler {
target.addDependency(dependency);
}
}
target.setIfCondition(getAttribute(IF_ATTR));
target.setUnlessCondition(getAttribute(UNLESS_ATTR));
}




+ 4
- 9
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Ant1Factory.java View File

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

/**


+ 4
- 2
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/ProjectComponent.java View File

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




+ 18
- 0
proposal/mutant/src/java/antlibs/ant1compat/org/apache/tools/ant/Task.java View File

@@ -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.
*


+ 8
- 1
proposal/mutant/src/java/antlibs/system/code/org/apache/ant/antlib/system/AntBase.java View File

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

}


+ 72
- 40
proposal/mutant/src/java/cli/org/apache/ant/cli/Commandline.java View File

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


+ 112
- 69
proposal/mutant/src/java/common/org/apache/ant/common/model/Target.java View File

@@ -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
* <http://www.apache.org/>.
* 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
* <http://www.apache.org/>.
*/
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 <a href="mailto:conor@apache.org">Conor MacNeill</a>
* @created 12 January 2002
* @author <a href="mailto:conor@apache.org">Conor MacNeill</a>
* @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) {


+ 2
- 1
proposal/mutant/src/java/common/org/apache/ant/common/util/FileUtils.java View File

@@ -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


+ 2
- 0
proposal/mutant/src/java/start/org/apache/ant/start/Main.java View File

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



Loading…
Cancel
Save