git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@271760 13f79535-47bb-0310-9956-ffa450edef68master
@@ -155,7 +155,7 @@ | |||||
<javac destdir="${bin.dir}/antlibs/${libset}" srcdir="${java.dir}/antlibs/${libset}" debug="${debug}"> | <javac destdir="${bin.dir}/antlibs/${libset}" srcdir="${java.dir}/antlibs/${libset}" debug="${debug}"> | ||||
<classpath refid="classpath.antlibs"/> | <classpath refid="classpath.antlibs"/> | ||||
</javac> | </javac> | ||||
<jar basedir="${bin.dir}/antlibs/${libset}" jarfile="${distlib.dir}/antlibs/${libset}.tsk"> | |||||
<jar basedir="${bin.dir}/antlibs/${libset}" jarfile="${distlib.dir}/antlibs/${libset}.jar"> | |||||
<metainf dir="${java.dir}/antlibs/${libset}" | <metainf dir="${java.dir}/antlibs/${libset}" | ||||
includes="antlib.xml"/> | includes="antlib.xml"/> | ||||
</jar> | </jar> | ||||
@@ -66,7 +66,7 @@ | |||||
<fileset dir="${lib.dir}/parser" includes="*.jar"/> | <fileset dir="${lib.dir}/parser" includes="*.jar"/> | ||||
<fileset dir="${lib.dir}/ant1compat" includes="*.jar"/> | <fileset dir="${lib.dir}/ant1compat" includes="*.jar"/> | ||||
<pathelement location="${distlib.dir}/common/common.jar"/> | <pathelement location="${distlib.dir}/common/common.jar"/> | ||||
<pathelement location="${distlib.dir}/antlibs/system.tsk"/> | |||||
<pathelement location="${distlib.dir}/antlibs/system.jar"/> | |||||
</path> | </path> | ||||
<target name="check_for_optional_packages"> | <target name="check_for_optional_packages"> | ||||
@@ -69,7 +69,7 @@ public class CoreFileService implements FileService { | |||||
private Frame frame; | private Frame frame; | ||||
/** General file utilities */ | /** General file utilities */ | ||||
private FileUtils fileUtils = new FileUtils(); | |||||
private FileUtils fileUtils = FileUtils.newFileUtils(); | |||||
/** | /** | ||||
* Constructor | * Constructor | ||||
@@ -744,7 +744,7 @@ public class Frame implements DemuxOutputReceiver { | |||||
if (base == null) { | if (base == null) { | ||||
baseDir = projectFileParent; | baseDir = projectFileParent; | ||||
} else { | } else { | ||||
FileUtils fileUtils = new FileUtils(); | |||||
FileUtils fileUtils = FileUtils.newFileUtils(); | |||||
baseDir = fileUtils.resolveFile(projectFileParent, base); | baseDir = fileUtils.resolveFile(projectFileParent, base); | ||||
} | } | ||||
} else { | } else { | ||||
@@ -64,11 +64,11 @@ import java.util.Stack; | |||||
import java.util.Vector; | import java.util.Vector; | ||||
import org.apache.ant.common.antlib.AntContext; | import org.apache.ant.common.antlib.AntContext; | ||||
import org.apache.ant.common.antlib.AntLibFactory; | import org.apache.ant.common.antlib.AntLibFactory; | ||||
import org.apache.ant.common.event.MessageLevel; | |||||
import org.apache.ant.common.service.ComponentService; | import org.apache.ant.common.service.ComponentService; | ||||
import org.apache.ant.common.service.DataService; | import org.apache.ant.common.service.DataService; | ||||
import org.apache.ant.common.service.FileService; | import org.apache.ant.common.service.FileService; | ||||
import org.apache.ant.common.util.ExecutionException; | import org.apache.ant.common.util.ExecutionException; | ||||
import org.apache.ant.common.event.MessageLevel; | |||||
import org.apache.ant.common.util.PropertyUtils; | import org.apache.ant.common.util.PropertyUtils; | ||||
import org.apache.tools.ant.types.FilterSet; | import org.apache.tools.ant.types.FilterSet; | ||||
import org.apache.tools.ant.types.FilterSetCollection; | import org.apache.tools.ant.types.FilterSetCollection; | ||||
@@ -83,42 +83,44 @@ import org.apache.tools.ant.util.FileUtils; | |||||
public class Project implements org.apache.ant.common.event.BuildListener { | public class Project implements org.apache.ant.common.event.BuildListener { | ||||
/** String which indicates Java version 1.0 */ | /** String which indicates Java version 1.0 */ | ||||
public static final String JAVA_1_0 = "1.0"; | |||||
public final static String JAVA_1_0 = "1.0"; | |||||
/** String which indicates Java version 1.1 */ | /** String which indicates Java version 1.1 */ | ||||
public static final String JAVA_1_1 = "1.1"; | |||||
public final static String JAVA_1_1 = "1.1"; | |||||
/** String which indicates Java version 1.2 */ | /** String which indicates Java version 1.2 */ | ||||
public static final String JAVA_1_2 = "1.2"; | |||||
public final static String JAVA_1_2 = "1.2"; | |||||
/** String which indicates Java version 1.3 */ | /** String which indicates Java version 1.3 */ | ||||
public static final String JAVA_1_3 = "1.3"; | |||||
public final static String JAVA_1_3 = "1.3"; | |||||
/** String which indicates Java version 1.4 */ | /** String which indicates Java version 1.4 */ | ||||
public static final String JAVA_1_4 = "1.4"; | |||||
public final static String JAVA_1_4 = "1.4"; | |||||
/** | /** | ||||
* @see MessageLevel.MSG_ERR | * @see MessageLevel.MSG_ERR | ||||
*/ | */ | ||||
public static final int MSG_ERR = MessageLevel.MSG_ERR; | |||||
public final static int MSG_ERR = MessageLevel.MSG_ERR; | |||||
/** | /** | ||||
* @see MessageLevel.MSG_WARN | * @see MessageLevel.MSG_WARN | ||||
*/ | */ | ||||
public static final int MSG_WARN = MessageLevel.MSG_WARN; | |||||
public final static int MSG_WARN = MessageLevel.MSG_WARN; | |||||
/** | /** | ||||
* @see MessageLevel.MSG_INFO | * @see MessageLevel.MSG_INFO | ||||
*/ | */ | ||||
public static final int MSG_INFO = MessageLevel.MSG_INFO; | |||||
public final static int MSG_INFO = MessageLevel.MSG_INFO; | |||||
/** | /** | ||||
* @see MessageLevel.MSG_VERBOSE | * @see MessageLevel.MSG_VERBOSE | ||||
*/ | */ | ||||
public static final int MSG_VERBOSE = MessageLevel.MSG_VERBOSE; | |||||
public final static int MSG_VERBOSE = MessageLevel.MSG_VERBOSE; | |||||
/** | /** | ||||
* @see MessageLevel.MSG_DEBUG | * @see MessageLevel.MSG_DEBUG | ||||
*/ | */ | ||||
public static final int MSG_DEBUG = MessageLevel.MSG_DEBUG; | |||||
public final static int MSG_DEBUG = MessageLevel.MSG_DEBUG; | |||||
/** The java version detected that Ant is running on */ | /** The java version detected that Ant is running on */ | ||||
private static String javaVersion; | private static String javaVersion; | ||||
/** the factory which created this project instance. This is used to | |||||
define new types and tasks */ | |||||
/** | |||||
* the factory which created this project instance. This is used to | |||||
* define new types and tasks | |||||
*/ | |||||
private AntLibFactory factory; | private AntLibFactory factory; | ||||
/** Collection of Ant1 type definitions */ | /** Collection of Ant1 type definitions */ | ||||
@@ -199,14 +201,6 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||||
return javaVersion; | return javaVersion; | ||||
} | } | ||||
/** | |||||
* get the target hashtable | |||||
* @return hashtable, the contents of which can be cast to Target | |||||
*/ | |||||
public Hashtable getTargets() { | |||||
return new Hashtable(); // XXX can't get targets | |||||
} | |||||
/** | /** | ||||
* returns the boolean equivalent of a string, which is considered true | * returns the boolean equivalent of a string, which is considered true | ||||
* if either "on", "true", or "yes" is found, ignoring case. | * if either "on", "true", or "yes" is found, ignoring case. | ||||
@@ -302,6 +296,24 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||||
} | } | ||||
} | } | ||||
/** | |||||
* Gets the Antlib factory of the Project | |||||
* | |||||
* @return The project's associated factory object | |||||
*/ | |||||
public AntLibFactory getFactory() { | |||||
return factory; | |||||
} | |||||
/** | |||||
* get the target hashtable | |||||
* | |||||
* @return hashtable, the contents of which can be cast to Target | |||||
*/ | |||||
public Hashtable getTargets() { | |||||
return new Hashtable();// XXX can't get targets | |||||
} | |||||
/** | /** | ||||
* Gets the buildListeners of the Project | * Gets the buildListeners of the Project | ||||
* | * | ||||
@@ -878,7 +890,7 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||||
} | } | ||||
try { | try { | ||||
Object taskObject = componentService.createComponent(factory, | |||||
Object taskObject = componentService.createComponent(factory, | |||||
context.getClassLoader(), taskClass, false, taskType); | context.getClassLoader(), taskClass, false, taskType); | ||||
if (taskObject instanceof Task) { | if (taskObject instanceof Task) { | ||||
task = (Task)taskObject; | task = (Task)taskObject; | ||||
@@ -897,15 +909,13 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||||
/** | /** | ||||
* Creates a new instance of a data type. | * Creates a new instance of a data type. | ||||
* | |||||
* | |||||
* @param typeName The name of the data type to create an instance of. | * @param typeName The name of the data type to create an instance of. | ||||
* Must not be <code>null</code>. | |||||
* | |||||
* @return an instance of the specified data type, or <code>null</code> if | |||||
* the data type name is not recognised. | |||||
* | |||||
* @exception BuildException if the data type name is recognised but | |||||
* instance creation fails. | |||||
* Must not be <code>null</code>. | |||||
* @return an instance of the specified data type, or <code>null</code> | |||||
* if the data type name is not recognised. | |||||
* @exception BuildException if the data type name is recognised but | |||||
* instance creation fails. | |||||
*/ | */ | ||||
public Object createDataType(String typeName) throws BuildException { | public Object createDataType(String typeName) throws BuildException { | ||||
Class typeClass = (Class)dataClassDefinitions.get(typeName); | Class typeClass = (Class)dataClassDefinitions.get(typeName); | ||||
@@ -915,14 +925,14 @@ public class Project implements org.apache.ant.common.event.BuildListener { | |||||
} | } | ||||
try { | try { | ||||
Object dataInstance = componentService.createComponent(factory, | |||||
Object dataInstance = componentService.createComponent(factory, | |||||
context.getClassLoader(), typeClass, false, typeName); | context.getClassLoader(), typeClass, false, typeName); | ||||
return dataInstance; | return dataInstance; | ||||
} catch (Throwable e) { | } catch (Throwable e) { | ||||
throw new BuildException(e); | throw new BuildException(e); | ||||
} | } | ||||
} | } | ||||
/** send build started event to the listeners */ | /** send build started event to the listeners */ | ||||
protected void fireBuildStarted() { | protected void fireBuildStarted() { | ||||
BuildEvent event = new BuildEvent(this); | BuildEvent event = new BuildEvent(this); | ||||
@@ -170,6 +170,7 @@ public abstract class Task extends ProjectComponent | |||||
taskType = componentType; | taskType = componentType; | ||||
taskName = componentType; | taskName = componentType; | ||||
init(); | |||||
} | } | ||||
@@ -52,6 +52,17 @@ | |||||
* <http://www.apache.org/>. | * <http://www.apache.org/>. | ||||
*/ | */ | ||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import java.io.File; | |||||
import java.util.ArrayList; | |||||
import java.util.Iterator; | |||||
import java.util.List; | |||||
import org.apache.ant.antlib.system.AntBase; | |||||
import org.apache.ant.common.antlib.AntContext; | |||||
import org.apache.ant.common.antlib.AntLibFactory; | |||||
import org.apache.ant.common.service.ComponentService; | |||||
import org.apache.ant.common.util.ExecutionException; | |||||
import org.apache.tools.ant.BuildException; | |||||
import org.apache.tools.ant.Task; | |||||
/** | /** | ||||
* Ant facade over system version of Ant | * Ant facade over system version of Ant | ||||
@@ -59,6 +70,146 @@ package org.apache.tools.ant.taskdefs; | |||||
* @author <a href="mailto:conor@apache.org">Conor MacNeill</a> | * @author <a href="mailto:conor@apache.org">Conor MacNeill</a> | ||||
* @created 31 January 2002 | * @created 31 January 2002 | ||||
*/ | */ | ||||
public class Ant extends org.apache.ant.antlib.system.Ant { | |||||
public class Ant extends Task { | |||||
/** The core Ant implementation to actually use */ | |||||
private org.apache.ant.antlib.system.Ant realAnt = null; | |||||
/** The properties created by this task */ | |||||
private List properties = new ArrayList(); | |||||
/** | |||||
* If true, inherit all properties from parent Project If false, inherit | |||||
* only userProperties and those defined inside the ant call itself | |||||
* | |||||
* @param value true if the sub-build should receive all properties from | |||||
* this build | |||||
*/ | |||||
public void setInheritAll(boolean value) { | |||||
realAnt.setInheritAll(value); | |||||
} | |||||
/** | |||||
* If true, inherit all references from parent Project If false, inherit | |||||
* only those defined inside the ant call itself | |||||
* | |||||
* @param value true if the subbuild should receive all references from | |||||
* the current build. | |||||
*/ | |||||
public void setInheritRefs(boolean value) { | |||||
realAnt.setInheritRefs(value); | |||||
} | |||||
/** | |||||
* The directory which will be the base directory for the build | |||||
* | |||||
* @param d the base directory for the new build | |||||
*/ | |||||
public void setDir(File d) { | |||||
realAnt.setDir(d); | |||||
} | |||||
/** | |||||
* set the build file, it can be either absolute or relative. If it is | |||||
* absolute, <tt>dir</tt> will be ignored, if it is relative it will be | |||||
* resolved relative to <tt>dir</tt> . | |||||
* | |||||
* @param s the name of the ant file either absolute or relative to the | |||||
* sub-build's basedir | |||||
*/ | |||||
public void setAntfile(String s) { | |||||
realAnt.setAntFile(s); | |||||
} | |||||
/** | |||||
* set the target to execute. If none is defined it will execute the | |||||
* default target of the build file | |||||
* | |||||
* @param s the target to eb executed in the sub-build | |||||
*/ | |||||
public void setTarget(String s) { | |||||
realAnt.setTarget(s); | |||||
} | |||||
/** | |||||
* XXX Sets the output of the Ant | |||||
* | |||||
* @param s name of the file to store output. | |||||
*/ | |||||
public void setOutput(String s) { | |||||
// realAnt.setOutput(s); | |||||
} | |||||
/** Initialize the task */ | |||||
public void init() { | |||||
AntContext context = getAntContext(); | |||||
try { | |||||
ComponentService componentService = getComponentService(); | |||||
AntLibFactory factory = getProject().getFactory(); | |||||
realAnt = (org.apache.ant.antlib.system.Ant) | |||||
componentService.createComponent(factory, | |||||
context.getClassLoader(), | |||||
org.apache.ant.antlib.system.Ant.class, false, "antcall"); | |||||
} catch (ExecutionException e) { | |||||
throw new BuildException(e); | |||||
} | |||||
} | |||||
/** | |||||
* Do the execution. | |||||
* | |||||
* @exception BuildException XXX Description of Exception | |||||
*/ | |||||
public void execute() throws BuildException { | |||||
for (Iterator i = properties.iterator(); i.hasNext(); ) { | |||||
Property property = (Property)i.next(); | |||||
AntBase.Property newProperty = new AntBase.Property(); | |||||
newProperty.setName(property.getName()); | |||||
newProperty.setValue(property.getValue()); | |||||
realAnt.addProperty(newProperty); | |||||
} | |||||
try { | |||||
realAnt.execute(); | |||||
} catch (ExecutionException e) { | |||||
throw new BuildException(e); | |||||
} | |||||
} | |||||
/** | |||||
* Create a nested property element. | |||||
* | |||||
* @return the Property object to be configured. | |||||
*/ | |||||
public Property createProperty() { | |||||
Property property = new Property(); | |||||
properties.add(property); | |||||
return property; | |||||
} | |||||
/** | |||||
* create a reference element that identifies a data type that should be | |||||
* carried over to the new project. | |||||
* | |||||
* @param r the reference to be added to the call | |||||
*/ | |||||
public void addReference(AntBase.Reference r) { | |||||
try { | |||||
realAnt.addReference(r); | |||||
} catch (ExecutionException e) { | |||||
throw new BuildException(e); | |||||
} | |||||
} | |||||
/** | |||||
* Gets the componentService | |||||
* | |||||
* @return the componentService instance provided by the core | |||||
* @exception ExecutionException if the service is not available. | |||||
*/ | |||||
private ComponentService getComponentService() throws ExecutionException { | |||||
AntContext context = getAntContext(); | |||||
return (ComponentService)context.getCoreService(ComponentService.class); | |||||
} | |||||
} | } | ||||
@@ -52,8 +52,17 @@ | |||||
* <http://www.apache.org/>. | * <http://www.apache.org/>. | ||||
*/ | */ | ||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import java.util.ArrayList; | |||||
import java.util.Iterator; | |||||
import java.util.List; | |||||
import org.apache.ant.antlib.system.AntBase; | |||||
import org.apache.ant.antlib.system.AntCall; | import org.apache.ant.antlib.system.AntCall; | ||||
import org.apache.ant.common.antlib.AntContext; | |||||
import org.apache.ant.common.antlib.AntLibFactory; | |||||
import org.apache.ant.common.service.ComponentService; | |||||
import org.apache.ant.common.util.ExecutionException; | |||||
import org.apache.tools.ant.BuildException; | |||||
import org.apache.tools.ant.Task; | |||||
/** | /** | ||||
* CallTarget facade over AntCall | * CallTarget facade over AntCall | ||||
@@ -61,6 +70,95 @@ import org.apache.ant.antlib.system.AntCall; | |||||
* @author <a href="mailto:conor@apache.org">Conor MacNeill</a> | * @author <a href="mailto:conor@apache.org">Conor MacNeill</a> | ||||
* @created 31 January 2002 | * @created 31 January 2002 | ||||
*/ | */ | ||||
public class CallTarget extends AntCall { | |||||
public class CallTarget extends Task { | |||||
/** The core AntCall implementation to actually use */ | |||||
private AntCall antCall = null; | |||||
/** The properties created by this task */ | |||||
private List properties = new ArrayList(); | |||||
/** | |||||
* If true, inherit all properties from parent Project If false, inherit | |||||
* only userProperties and those defined inside the antcall call itself | |||||
* | |||||
* @param inherit the new inheritAll value | |||||
*/ | |||||
public void setInheritAll(boolean inherit) { | |||||
antCall.setInheritAll(inherit); | |||||
} | |||||
/** | |||||
* Sets the target of the CallTarget | |||||
* | |||||
* @param target the new target value | |||||
*/ | |||||
public void setTarget(String target) { | |||||
antCall.setTarget(target); | |||||
} | |||||
/** Initialize the task */ | |||||
public void init() { | |||||
AntContext context = getAntContext(); | |||||
try { | |||||
ComponentService componentService = getComponentService(); | |||||
AntLibFactory factory = getProject().getFactory(); | |||||
antCall = (AntCall)componentService.createComponent(factory, | |||||
context.getClassLoader(), AntCall.class, false, "antcall"); | |||||
} catch (ExecutionException e) { | |||||
throw new BuildException(e); | |||||
} | |||||
} | |||||
/** execute the call */ | |||||
public void execute() { | |||||
for (Iterator i = properties.iterator(); i.hasNext(); ) { | |||||
Property property = (Property)i.next(); | |||||
AntBase.Property newProperty = new AntBase.Property(); | |||||
newProperty.setName(property.getName()); | |||||
newProperty.setValue(property.getValue()); | |||||
antCall.addProperty(newProperty); | |||||
} | |||||
try { | |||||
antCall.execute(); | |||||
} catch (ExecutionException e) { | |||||
throw new BuildException(e); | |||||
} | |||||
} | |||||
/** | |||||
* Create a nested param element. | |||||
* | |||||
* @return the Property object to be configured. | |||||
*/ | |||||
public Property createParam() { | |||||
Property property = new Property(); | |||||
properties.add(property); | |||||
return property; | |||||
} | |||||
/** | |||||
* create a reference element that identifies a data type that should be | |||||
* carried over to the new project. | |||||
* | |||||
* @param r the reference to be added to the call | |||||
*/ | |||||
public void addReference(AntBase.Reference r) { | |||||
try { | |||||
antCall.addReference(r); | |||||
} catch (ExecutionException e) { | |||||
throw new BuildException(e); | |||||
} | |||||
} | |||||
/** | |||||
* Gets the componentService | |||||
* | |||||
* @return the componentService instance provided by the core | |||||
* @exception ExecutionException if the service is not available. | |||||
*/ | |||||
private ComponentService getComponentService() throws ExecutionException { | |||||
AntContext context = getAntContext(); | |||||
return (ComponentService)context.getCoreService(ComponentService.class); | |||||
} | |||||
} | } | ||||
@@ -56,6 +56,7 @@ import java.io.File; | |||||
import org.apache.ant.common.service.ExecService; | import org.apache.ant.common.service.ExecService; | ||||
import org.apache.ant.common.util.ExecutionException; | import org.apache.ant.common.util.ExecutionException; | ||||
import org.apache.ant.common.service.MagicProperties; | import org.apache.ant.common.service.MagicProperties; | ||||
import org.apache.ant.common.util.FileUtils; | |||||
/** | /** | ||||
* The Ant task - used to execute a different build file | * The Ant task - used to execute a different build file | ||||
@@ -65,7 +66,7 @@ import org.apache.ant.common.service.MagicProperties; | |||||
*/ | */ | ||||
public class Ant extends AntBase { | public class Ant extends AntBase { | ||||
/** The ant file to be run */ | /** The ant file to be run */ | ||||
private File antFile; | |||||
private String antFileName; | |||||
/** the base directory to use for the run */ | /** the base directory to use for the run */ | ||||
private File baseDir; | private File baseDir; | ||||
/** File to capture any output */ | /** File to capture any output */ | ||||
@@ -74,10 +75,10 @@ public class Ant extends AntBase { | |||||
/** | /** | ||||
* sets the file containing the XML representation model to build | * sets the file containing the XML representation model to build | ||||
* | * | ||||
* @param antFile the file to build | |||||
* @param antFileName the file to build | |||||
*/ | */ | ||||
public void setAntFile(File antFile) { | |||||
this.antFile = antFile; | |||||
public void setAntFile(String antFileName) { | |||||
this.antFileName = antFileName; | |||||
} | } | ||||
/** | /** | ||||
@@ -107,12 +108,18 @@ public class Ant extends AntBase { | |||||
if (baseDir == null) { | if (baseDir == null) { | ||||
baseDir = getAntContext().getBaseDir(); | baseDir = getAntContext().getBaseDir(); | ||||
} | } | ||||
if (antFile == null) { | |||||
File antFile = null; | |||||
if (antFileName == null) { | |||||
antFile = new File(baseDir, "build.ant"); | antFile = new File(baseDir, "build.ant"); | ||||
if (!antFile.exists()) { | if (!antFile.exists()) { | ||||
antFile = new File(baseDir, "build.xml"); | antFile = new File(baseDir, "build.xml"); | ||||
} | } | ||||
} else { | |||||
antFile | |||||
= FileUtils.newFileUtils().resolveFile(baseDir, antFileName); | |||||
} | } | ||||
setProperty(MagicProperties.BASEDIR, baseDir.getAbsolutePath()); | setProperty(MagicProperties.BASEDIR, baseDir.getAbsolutePath()); | ||||
ExecService execService | ExecService execService | ||||
@@ -21,7 +21,7 @@ public class Ant1CompatBuilder { | |||||
"${lib.dir}/ant1compat", "*.jar"); | "${lib.dir}/ant1compat", "*.jar"); | ||||
helper.addPathElementToPath("classpath", "${distlib.dir}/init.jar"); | helper.addPathElementToPath("classpath", "${distlib.dir}/init.jar"); | ||||
helper.addPathElementToPath("classpath", "${distlib.dir}/common/common.jar"); | helper.addPathElementToPath("classpath", "${distlib.dir}/common/common.jar"); | ||||
helper.addPathElementToPath("classpath", "${distlib.dir}/antlibs/system.tsk"); | |||||
helper.addPathElementToPath("classpath", "${distlib.dir}/antlibs/system.jar"); | |||||
} | } | ||||
protected void check_for_optional_packages(BuildHelper helper) { | protected void check_for_optional_packages(BuildHelper helper) { | ||||
} | } | ||||
@@ -83,7 +83,7 @@ public class MutantBuilder { | |||||
helper.addPathElementToPath("classpath.antlibs", "${distlib.dir}/common/common.jar"); | helper.addPathElementToPath("classpath.antlibs", "${distlib.dir}/common/common.jar"); | ||||
helper.addPathToPath("classpath.antlibs", "classpath.common"); | helper.addPathToPath("classpath.antlibs", "classpath.common"); | ||||
helper.javac("${java.dir}/antlibs/${libset}", "${bin.dir}/antlibs/${libset}", "classpath.antlibs"); | helper.javac("${java.dir}/antlibs/${libset}", "${bin.dir}/antlibs/${libset}", "classpath.antlibs"); | ||||
helper.jar("${bin.dir}/antlibs/${libset}", "${distlib.dir}/antlibs/${libset}.tsk", | |||||
helper.jar("${bin.dir}/antlibs/${libset}", "${distlib.dir}/antlibs/${libset}.jar", | |||||
"${java.dir}/antlibs/${libset}", "antlib.xml"); | "${java.dir}/antlibs/${libset}", "antlib.xml"); | ||||
} | } | ||||
protected void main(BuildHelper helper) { | protected void main(BuildHelper helper) { | ||||
@@ -68,6 +68,21 @@ import java.util.StringTokenizer; | |||||
* @created 21 January 2002 | * @created 21 January 2002 | ||||
*/ | */ | ||||
public class FileUtils { | public class FileUtils { | ||||
/** Empty constructor. */ | |||||
protected FileUtils() { | |||||
} | |||||
/** | |||||
* Factory method. | |||||
* | |||||
* @return The FileUtils instance to actually use. May be a subclass of | |||||
* this class. | |||||
*/ | |||||
public static FileUtils newFileUtils() { | |||||
return new FileUtils(); | |||||
} | |||||
/** | /** | ||||
* Interpret the filename as a file relative to the given file - unless | * Interpret the filename as a file relative to the given file - unless | ||||
* the filename already represents an absolute filename. | * the filename already represents an absolute filename. | ||||
@@ -76,8 +91,7 @@ public class FileUtils { | |||||
* must be an absolute file and must not contain "./" or | * must be an absolute file and must not contain "./" or | ||||
* "../" sequences (same for \ instead of /). If it is | * "../" sequences (same for \ instead of /). If it is | ||||
* null, this call is equivalent to | * null, this call is equivalent to | ||||
* <code>new java.io.File(filename)</code> | |||||
* . | |||||
* <code>new java.io.File(filename)</code>. | |||||
* @param filename the filename to be resolved | * @param filename the filename to be resolved | ||||
* @return an absolute file that doesn't contain "./" or | * @return an absolute file that doesn't contain "./" or | ||||
* "../" sequences and uses the correct separator for the | * "../" sequences and uses the correct separator for the | ||||
@@ -102,8 +116,8 @@ public class FileUtils { | |||||
} | } | ||||
File helpFile = new File(file.getAbsolutePath()); | File helpFile = new File(file.getAbsolutePath()); | ||||
StringTokenizer tok | |||||
= new StringTokenizer(platformFilename, File.separator); | |||||
StringTokenizer tok | |||||
= new StringTokenizer(platformFilename, File.separator); | |||||
while (tok.hasMoreTokens()) { | while (tok.hasMoreTokens()) { | ||||
String part = tok.nextToken(); | String part = tok.nextToken(); | ||||
if (part.equals("..")) { | if (part.equals("..")) { | ||||