Deprecated the variable so that that anyone directly referencing variable will get warning and suggestion to use the accessor. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273155 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -60,11 +60,15 @@ package org.apache.tools.ant; | |||
| * | |||
| * @author Conor MacNeill | |||
| */ | |||
| public abstract class ProjectComponent { | |||
| /** Project object of this component. */ | |||
| protected Project project = null; | |||
| /** | |||
| * Project object of this component. | |||
| * @deprecated You should not be directly accessing this variable | |||
| * directly. You should access project object via the getProject() | |||
| * or setProject() accessor/mutators. | |||
| */ | |||
| protected Project project; | |||
| /** Sole constructor. */ | |||
| public ProjectComponent() { | |||
| @@ -61,7 +61,7 @@ import java.util.Enumeration; | |||
| * | |||
| * Use Project.createTask to create a new task instance rather than | |||
| * using this class directly for construction. | |||
| * | |||
| * | |||
| * @see Project#createTask | |||
| */ | |||
| public abstract class Task extends ProjectComponent { | |||
| @@ -71,8 +71,8 @@ public abstract class Task extends ProjectComponent { | |||
| protected String description = null; | |||
| /** Location within the build file of this task definition. */ | |||
| protected Location location = Location.UNKNOWN_LOCATION; | |||
| /** | |||
| * Name of this task to be used for logging purposes. | |||
| /** | |||
| * Name of this task to be used for logging purposes. | |||
| * This defaults to the same as the type, but may be | |||
| * overridden by the user. For instance, the name "java" | |||
| * isn't terribly descriptive for a task used within | |||
| @@ -84,7 +84,7 @@ public abstract class Task extends ProjectComponent { | |||
| protected String taskType = null; | |||
| /** Wrapper for this object, used to configure it at runtime. */ | |||
| protected RuntimeConfigurable wrapper; | |||
| /** | |||
| /** | |||
| * Whether or not this task is invalid. A task becomes invalid | |||
| * if a conflicting class is specified as the implementation for | |||
| * its type. | |||
| @@ -114,7 +114,7 @@ public abstract class Task extends ProjectComponent { | |||
| public Target getOwningTarget() { | |||
| return target; | |||
| } | |||
| /** | |||
| * Sets the name to use in logging messages. | |||
| * | |||
| @@ -128,7 +128,7 @@ public abstract class Task extends ProjectComponent { | |||
| /** | |||
| * Returns the name to use in logging messages. | |||
| * | |||
| * @return the name to use in logging messages. | |||
| * @return the name to use in logging messages. | |||
| */ | |||
| public String getTaskName() { | |||
| return taskName; | |||
| @@ -144,14 +144,14 @@ public abstract class Task extends ProjectComponent { | |||
| this.taskType = type; | |||
| } | |||
| /** | |||
| /** | |||
| * Sets a description of the current action. This may be used for logging | |||
| * purposes. | |||
| * | |||
| * @param desc Description of the current action. | |||
| * | |||
| * @param desc Description of the current action. | |||
| * May be <code>null</code>, indicating that no description is | |||
| * available. | |||
| * | |||
| * | |||
| */ | |||
| public void setDescription(String desc) { | |||
| description = desc; | |||
| @@ -159,7 +159,7 @@ public abstract class Task extends ProjectComponent { | |||
| /** | |||
| * Returns the description of the current action. | |||
| * | |||
| * | |||
| * @return the description of the current action, or <code>null</code> if | |||
| * no description is available. | |||
| */ | |||
| @@ -176,10 +176,10 @@ public abstract class Task extends ProjectComponent { | |||
| public void init() throws BuildException {} | |||
| /** | |||
| * Called by the project to let the task do its work. This method may be | |||
| * called more than once, if the task is invoked more than once. | |||
| * For example, | |||
| * if target1 and target2 both depend on target3, then running | |||
| * Called by the project to let the task do its work. This method may be | |||
| * called more than once, if the task is invoked more than once. | |||
| * For example, | |||
| * if target1 and target2 both depend on target3, then running | |||
| * "ant target1 target2" will run all tasks in target3 twice. | |||
| * | |||
| * @exception BuildException if something goes wrong with the build | |||
| @@ -188,11 +188,11 @@ public abstract class Task extends ProjectComponent { | |||
| /** | |||
| * Returns the file/location where this task was defined. | |||
| * | |||
| * @return the file/location where this task was defined. | |||
| * | |||
| * @return the file/location where this task was defined. | |||
| * Should not return <code>null</code>. Location.UNKNOWN_LOCATION | |||
| * is used for unknown locations. | |||
| * | |||
| * | |||
| * @see Location#UNKNOWN_LOCATION | |||
| */ | |||
| public Location getLocation() { | |||
| @@ -201,11 +201,11 @@ public abstract class Task extends ProjectComponent { | |||
| /** | |||
| * Sets the file/location where this task was defined. | |||
| * | |||
| * | |||
| * @param location The file/location where this task was defined. | |||
| * Should not be <code>null</code> - use | |||
| * Location.UNKNOWN_LOCATION if the location isn't known. | |||
| * | |||
| * | |||
| * @see Location#UNKNOWN_LOCATION | |||
| */ | |||
| public void setLocation(Location location) { | |||
| @@ -214,7 +214,7 @@ public abstract class Task extends ProjectComponent { | |||
| /** | |||
| * Returns the wrapper used for runtime configuration. | |||
| * | |||
| * | |||
| * @return the wrapper used for runtime configuration. This | |||
| * method will generate a new wrapper (and cache it) | |||
| * if one isn't set already. | |||
| @@ -232,7 +232,7 @@ public abstract class Task extends ProjectComponent { | |||
| * This method should be used only by the ProjectHelper and ant internals. | |||
| * It is public to allow helper plugins to operate on tasks, normal tasks | |||
| * should never use it. | |||
| * | |||
| * | |||
| * @param wrapper The wrapper to be used for runtime configuration. | |||
| * May be <code>null</code>, in which case the next call | |||
| * to getRuntimeConfigurableWrapper will generate a new | |||
| @@ -248,7 +248,7 @@ public abstract class Task extends ProjectComponent { | |||
| // unless I've missed something. | |||
| /** | |||
| * Configures this task - if it hasn't been done already. | |||
| * If the task has been invalidated, it is replaced with an | |||
| * If the task has been invalidated, it is replaced with an | |||
| * UnknownElement task which uses the new definition in the project. | |||
| * | |||
| * @exception BuildException if the task cannot be configured. | |||
| @@ -256,56 +256,56 @@ public abstract class Task extends ProjectComponent { | |||
| public void maybeConfigure() throws BuildException { | |||
| if (!invalid) { | |||
| if (wrapper != null) { | |||
| wrapper.maybeConfigure(project); | |||
| wrapper.maybeConfigure(getProject()); | |||
| } | |||
| } else { | |||
| getReplacement(); | |||
| } | |||
| } | |||
| /** | |||
| /** | |||
| * Handles a line of output by logging it with the INFO priority. | |||
| * | |||
| * | |||
| * @param line The line of output to log. Should not be <code>null</code>. | |||
| */ | |||
| protected void handleOutput(String line) { | |||
| log(line, Project.MSG_INFO); | |||
| } | |||
| /** | |||
| /** | |||
| * Handles an error line by logging it with the INFO priority. | |||
| * | |||
| * | |||
| * @param line The error line to log. Should not be <code>null</code>. | |||
| */ | |||
| protected void handleErrorOutput(String line) { | |||
| log(line, Project.MSG_ERR); | |||
| } | |||
| /** | |||
| * Logs a message with the default (INFO) priority. | |||
| * | |||
| /** | |||
| * Logs a message with the default (INFO) priority. | |||
| * | |||
| * @param msg The message to be logged. Should not be <code>null</code>. | |||
| */ | |||
| public void log(String msg) { | |||
| log(msg, Project.MSG_INFO); | |||
| } | |||
| /** | |||
| */ | |||
| public void log(String msg) { | |||
| log(msg, Project.MSG_INFO); | |||
| } | |||
| /** | |||
| * Logs a mesage with the given priority. This delegates | |||
| * the actual logging to the project. | |||
| * | |||
| * | |||
| * @param msg The message to be logged. Should not be <code>null</code>. | |||
| * @param msgLevel The message priority at which this message is to | |||
| * @param msgLevel The message priority at which this message is to | |||
| * be logged. | |||
| */ | |||
| public void log(String msg, int msgLevel) { | |||
| project.log(this, msg, msgLevel); | |||
| } | |||
| */ | |||
| public void log(String msg, int msgLevel) { | |||
| getProject().log(this, msg, msgLevel); | |||
| } | |||
| /** | |||
| * Performs this task if it's still valid, or gets a replacement | |||
| * version and performs that otherwise. | |||
| * | |||
| * | |||
| * Performing a task consists of firing a task started event, | |||
| * configuring the task, executing it, and then firing task finished | |||
| * event. If a runtime exception is thrown, the task finished event | |||
| @@ -314,10 +314,10 @@ public abstract class Task extends ProjectComponent { | |||
| public final void perform() { | |||
| if (!invalid) { | |||
| try { | |||
| project.fireTaskStarted(this); | |||
| getProject().fireTaskStarted(this); | |||
| maybeConfigure(); | |||
| execute(); | |||
| project.fireTaskFinished(this, null); | |||
| getProject().fireTaskFinished(this, null); | |||
| } catch (RuntimeException exc) { | |||
| if (exc instanceof BuildException) { | |||
| BuildException be = (BuildException) exc; | |||
| @@ -325,7 +325,7 @@ public abstract class Task extends ProjectComponent { | |||
| be.setLocation(getLocation()); | |||
| } | |||
| } | |||
| project.fireTaskFinished(this, exc); | |||
| getProject().fireTaskFinished(this, exc); | |||
| throw exc; | |||
| } | |||
| } else { | |||
| @@ -367,7 +367,7 @@ public abstract class Task extends ProjectComponent { | |||
| private UnknownElement getReplacement() { | |||
| if (replacement == null) { | |||
| replacement = new UnknownElement(taskType); | |||
| replacement.setProject(project); | |||
| replacement.setProject(getProject()); | |||
| replacement.setTaskType(taskType); | |||
| replacement.setTaskName(taskName); | |||
| replacement.setLocation(location); | |||
| @@ -393,7 +393,7 @@ public abstract class Task extends ProjectComponent { | |||
| while (enum.hasMoreElements()) { | |||
| RuntimeConfigurable childWrapper = | |||
| (RuntimeConfigurable) enum.nextElement(); | |||
| UnknownElement childElement = | |||
| UnknownElement childElement = | |||
| new UnknownElement(childWrapper.getElementTag()); | |||
| parentElement.addChild(childElement); | |||
| childElement.setRuntimeConfigurableWrapper(childWrapper); | |||
| @@ -122,7 +122,7 @@ public class TaskAdapter extends Task { | |||
| setProjectM = | |||
| c.getMethod("setProject", new Class[] {Project.class}); | |||
| if (setProjectM != null) { | |||
| setProjectM.invoke(proxy, new Object[] {project}); | |||
| setProjectM.invoke(proxy, new Object[] {getProject()}); | |||
| } | |||
| } catch (NoSuchMethodException e) { | |||
| // ignore this if the class being used as a task does not have | |||
| @@ -121,7 +121,7 @@ public class UnknownElement extends Task { | |||
| handleChildren(realThing, wrapper); | |||
| wrapper.maybeConfigure(project); | |||
| wrapper.maybeConfigure(getProject()); | |||
| } | |||
| /** | |||
| @@ -209,7 +209,7 @@ public class UnknownElement extends Task { | |||
| realChild = makeTask(child, childWrapper, false); | |||
| ((TaskContainer) parent).addTask((Task) realChild); | |||
| } else { | |||
| realChild = ih.createElement(project, parent, child.getTag()); | |||
| realChild = ih.createElement(getProject(), parent, child.getTag()); | |||
| } | |||
| childWrapper.setProxy(realChild); | |||
| @@ -238,7 +238,7 @@ public class UnknownElement extends Task { | |||
| protected Object makeObject(UnknownElement ue, RuntimeConfigurable w) { | |||
| Object o = makeTask(ue, w, true); | |||
| if (o == null) { | |||
| o = project.createDataType(ue.getTag()); | |||
| o = getProject().createDataType(ue.getTag()); | |||
| } | |||
| if (o == null) { | |||
| throw getNotFoundException("task or type", ue.getTag()); | |||
| @@ -263,7 +263,7 @@ public class UnknownElement extends Task { | |||
| */ | |||
| protected Task makeTask(UnknownElement ue, RuntimeConfigurable w, | |||
| boolean onTopLevel) { | |||
| Task task = project.createTask(ue.getTag()); | |||
| Task task = getProject().createTask(ue.getTag()); | |||
| if (task == null && !onTopLevel) { | |||
| throw getNotFoundException("task", ue.getTag()); | |||
| } | |||
| @@ -309,9 +309,9 @@ public abstract class AbstractCvsTask extends Task { | |||
| // | |||
| Execute exe = new Execute(getExecuteStreamHandler(), null); | |||
| exe.setAntRun(project); | |||
| exe.setAntRun(getProject()); | |||
| if (dest == null) { | |||
| dest = project.getBaseDir(); | |||
| dest = getProject().getBaseDir(); | |||
| } | |||
| if (!dest.exists()) { | |||
| @@ -152,7 +152,7 @@ public class Ant extends Task { | |||
| newProject = new Project(); | |||
| newProject.setJavaVersionProperty(); | |||
| newProject.addTaskDefinition("property", | |||
| (Class) project.getTaskDefinitions() | |||
| (Class) getProject().getTaskDefinitions() | |||
| .get("property")); | |||
| } | |||
| @@ -208,7 +208,7 @@ public class Ant extends Task { | |||
| private void initializeProject() { | |||
| newProject.setInputHandler(getProject().getInputHandler()); | |||
| Vector listeners = project.getBuildListeners(); | |||
| Vector listeners = getProject().getBuildListeners(); | |||
| final int count = listeners.size(); | |||
| for (int i = 0; i < count; i++) { | |||
| newProject.addBuildListener((BuildListener) listeners.elementAt(i)); | |||
| @@ -233,7 +233,7 @@ public class Ant extends Task { | |||
| } | |||
| } | |||
| Hashtable taskdefs = project.getTaskDefinitions(); | |||
| Hashtable taskdefs = getProject().getTaskDefinitions(); | |||
| Enumeration et = taskdefs.keys(); | |||
| while (et.hasMoreElements()) { | |||
| String taskName = (String) et.nextElement(); | |||
| @@ -245,7 +245,7 @@ public class Ant extends Task { | |||
| newProject.addTaskDefinition(taskName, taskClass); | |||
| } | |||
| Hashtable typedefs = project.getDataTypeDefinitions(); | |||
| Hashtable typedefs = getProject().getDataTypeDefinitions(); | |||
| Enumeration e = typedefs.keys(); | |||
| while (e.hasMoreElements()) { | |||
| String typeName = (String) e.nextElement(); | |||
| @@ -322,7 +322,7 @@ public class Ant extends Task { | |||
| } | |||
| if ((dir == null) && (inheritAll)) { | |||
| dir = project.getBaseDir(); | |||
| dir = getProject().getBaseDir(); | |||
| } | |||
| initializeProject(); | |||
| @@ -334,7 +334,7 @@ public class Ant extends Task { | |||
| dir.getAbsolutePath()); | |||
| } | |||
| } else { | |||
| dir = project.getBaseDir(); | |||
| dir = getProject().getBaseDir(); | |||
| } | |||
| overrideProperties(); | |||
| @@ -358,8 +358,8 @@ public class Ant extends Task { | |||
| // Are we trying to call the target in which we are defined (or | |||
| // the build file if this is a top level task)? | |||
| if (newProject.getBaseDir().equals(project.getBaseDir()) && | |||
| newProject.getProperty("ant.file").equals(project.getProperty("ant.file")) | |||
| if (newProject.getBaseDir().equals(getProject().getBaseDir()) && | |||
| newProject.getProperty("ant.file").equals(getProject().getProperty("ant.file")) | |||
| && getOwningTarget() != null | |||
| && (getOwningTarget().getName().equals("") || | |||
| getOwningTarget().getName().equals(target))) { | |||
| @@ -411,7 +411,7 @@ public class Ant extends Task { | |||
| * requested. | |||
| */ | |||
| private void addReferences() throws BuildException { | |||
| Hashtable thisReferences = (Hashtable) project.getReferences().clone(); | |||
| Hashtable thisReferences = (Hashtable) getProject().getReferences().clone(); | |||
| Hashtable newReferences = newProject.getReferences(); | |||
| Enumeration e; | |||
| if (references.size() > 0) { | |||
| @@ -460,7 +460,7 @@ public class Ant extends Task { | |||
| * keep our fingers crossed.</p> | |||
| */ | |||
| private void copyReference(String oldKey, String newKey) { | |||
| Object orig = project.getReference(oldKey); | |||
| Object orig = getProject().getReference(oldKey); | |||
| Class c = orig.getClass(); | |||
| Object copy = orig; | |||
| try { | |||
| @@ -127,27 +127,25 @@ public class AntStructure extends Task { | |||
| out = new PrintWriter(new FileWriter(output)); | |||
| } | |||
| printHead(out, project.getTaskDefinitions().keys(), | |||
| project.getDataTypeDefinitions().keys()); | |||
| printHead(out, getProject().getTaskDefinitions().keys(), | |||
| getProject().getDataTypeDefinitions().keys()); | |||
| printTargetDecl(out); | |||
| Enumeration dataTypes = project.getDataTypeDefinitions().keys(); | |||
| Enumeration dataTypes = getProject().getDataTypeDefinitions().keys(); | |||
| while (dataTypes.hasMoreElements()) { | |||
| String typeName = (String) dataTypes.nextElement(); | |||
| printElementDecl(out, typeName, | |||
| (Class) project.getDataTypeDefinitions().get(typeName)); | |||
| (Class) getProject().getDataTypeDefinitions().get(typeName)); | |||
| } | |||
| Enumeration tasks = project.getTaskDefinitions().keys(); | |||
| Enumeration tasks = getProject().getTaskDefinitions().keys(); | |||
| while (tasks.hasMoreElements()) { | |||
| String taskName = (String) tasks.nextElement(); | |||
| printElementDecl(out, taskName, | |||
| (Class) project.getTaskDefinitions().get(taskName)); | |||
| (Class) getProject().getTaskDefinitions().get(taskName)); | |||
| } | |||
| printTail(out); | |||
| } catch (IOException ioe) { | |||
| throw new BuildException("Error writing " | |||
| + output.getAbsolutePath(), ioe, location); | |||
| @@ -359,8 +357,6 @@ public class AntStructure extends Task { | |||
| } | |||
| } | |||
| private void printTail(PrintWriter out) {} | |||
| /** | |||
| * Does this String match the XML-NMTOKEN production? | |||
| */ | |||
| @@ -109,7 +109,7 @@ public class Available extends Task implements Condition { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (this.classpath == null) { | |||
| this.classpath = new Path(project); | |||
| this.classpath = new Path(getProject()); | |||
| } | |||
| return this.classpath.createPath(); | |||
| } | |||
| @@ -141,7 +141,7 @@ public class Available extends Task implements Condition { | |||
| */ | |||
| public Path createFilepath() { | |||
| if (this.filepath == null) { | |||
| this.filepath = new Path(project); | |||
| this.filepath = new Path(getProject()); | |||
| } | |||
| return this.filepath.createPath(); | |||
| } | |||
| @@ -184,9 +184,9 @@ public class Available extends Task implements Condition { | |||
| * | |||
| * @param file the name of the file which is required. | |||
| */ | |||
| public void setFile(File f) { | |||
| public void setFile(File file) { | |||
| this.file = FileUtils.newFileUtils() | |||
| .removeLeadingPath(getProject().getBaseDir(), f); | |||
| .removeLeadingPath(getProject().getBaseDir(), file); | |||
| } | |||
| /** | |||
| @@ -264,7 +264,7 @@ public class Available extends Task implements Condition { | |||
| * Evaluate the availability of a resource. | |||
| * | |||
| * @return boolean is the resource is available. | |||
| * @exception if the condition is not configured correctly | |||
| * @exception BuildException if the condition is not configured correctly | |||
| */ | |||
| public boolean eval() throws BuildException { | |||
| if (classname == null && file == null && resource == null) { | |||
| @@ -281,8 +281,8 @@ public class Available extends Task implements Condition { | |||
| } | |||
| if (classpath != null) { | |||
| classpath.setProject(project); | |||
| this.loader = new AntClassLoader(project, classpath); | |||
| classpath.setProject(getProject()); | |||
| this.loader = new AntClassLoader(getProject(), classpath); | |||
| } | |||
| String appendix = ""; | |||
| @@ -344,7 +344,7 @@ public class Available extends Task implements Condition { | |||
| */ | |||
| private boolean checkFile() { | |||
| if (filepath == null) { | |||
| return checkFile(project.resolveFile(file), file); | |||
| return checkFile(getProject().resolveFile(file), file); | |||
| } else { | |||
| String[] paths = filepath.list(); | |||
| for (int i = 0; i < paths.length; ++i) { | |||
| @@ -209,7 +209,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
| isCondition = false; | |||
| boolean value = validateAndExecute(); | |||
| if (verifyProperty != null) { | |||
| project.setNewProperty(verifyProperty, | |||
| getProject().setNewProperty(verifyProperty, | |||
| new Boolean(value).toString()); | |||
| } | |||
| } | |||
| @@ -314,10 +314,10 @@ public class Checksum extends MatchingTask implements Condition { | |||
| int sizeofFileSet = filesets.size(); | |||
| for (int i = 0; i < sizeofFileSet; i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| for (int j = 0; j < srcFiles.length; j++) { | |||
| File src = new File(fs.getDir(project), srcFiles[j]); | |||
| File src = new File(fs.getDir(getProject()), srcFiles[j]); | |||
| addToIncludeFileMap(src); | |||
| } | |||
| } | |||
| @@ -400,7 +400,7 @@ public class Checksum extends MatchingTask implements Condition { | |||
| if (isCondition) { | |||
| checksumMatches = checksum.equals(property); | |||
| } else { | |||
| project.setNewProperty(prop, checksum); | |||
| getProject().setNewProperty(prop, checksum); | |||
| } | |||
| } else if (destination instanceof java.io.File) { | |||
| if (isCondition) { | |||
| @@ -193,7 +193,7 @@ public class Chmod extends ExecuteOn { | |||
| location); | |||
| } | |||
| if (defaultSetDefined && defaultSet.getDir(project) != null) { | |||
| if (defaultSetDefined && defaultSet.getDir(getProject()) != null) { | |||
| addFileset(defaultSet); | |||
| } | |||
| super.checkConfiguration(); | |||
| @@ -206,11 +206,11 @@ public class Chmod extends ExecuteOn { | |||
| * second branch of the if statement below catches for backwards | |||
| * compatibility. | |||
| */ | |||
| if (defaultSetDefined || defaultSet.getDir(project) == null) { | |||
| if (defaultSetDefined || defaultSet.getDir(getProject()) == null) { | |||
| try { | |||
| super.execute(); | |||
| } finally { | |||
| if (defaultSetDefined && defaultSet.getDir(project) != null) { | |||
| if (defaultSetDefined && defaultSet.getDir(getProject()) != null) { | |||
| filesets.removeElement(defaultSet); | |||
| } | |||
| } | |||
| @@ -218,7 +218,7 @@ public class Chmod extends ExecuteOn { | |||
| // we are chmodding the given directory | |||
| Execute execute = prepareExec(); | |||
| Commandline cloned = (Commandline) cmdl.clone(); | |||
| cloned.createArgument().setValue(defaultSet.getDir(project) | |||
| cloned.createArgument().setValue(defaultSet.getDir(getProject()) | |||
| .getPath()); | |||
| try { | |||
| execute.setCommandline(cloned.getCommandline()); | |||
| @@ -246,10 +246,10 @@ public class Concat extends Task { | |||
| // determine the files from the set which need to be | |||
| // concatenated. | |||
| DirectoryScanner scanner = | |||
| fileSet.getDirectoryScanner(project); | |||
| fileSet.getDirectoryScanner(getProject()); | |||
| // Determine the root path. | |||
| fileSetBase = fileSet.getDir(project); | |||
| fileSetBase = fileSet.getDir(getProject()); | |||
| // Get the list of files. | |||
| srcFiles = scanner.getIncludedFiles(); | |||
| @@ -259,10 +259,10 @@ public class Concat extends Task { | |||
| FileList fileList = (FileList) next; | |||
| // Determine the root path. | |||
| fileSetBase = fileList.getDir(project); | |||
| fileSetBase = fileList.getDir(getProject()); | |||
| // Get the list of files. | |||
| srcFiles = fileList.getFiles(project); | |||
| srcFiles = fileList.getFiles(getProject()); | |||
| } | |||
| @@ -455,8 +455,8 @@ public class Concat extends Task { | |||
| String text = textBuffer.toString(); | |||
| // Replace ${property} strings. | |||
| text = ProjectHelper.replaceProperties(project, text, | |||
| project.getProperties()); | |||
| text = ProjectHelper.replaceProperties(getProject(), text, | |||
| getProject().getProperties()); | |||
| // Set up a writer if necessary. | |||
| FileWriter writer = null; | |||
| @@ -282,7 +282,7 @@ public class Copy extends Task { | |||
| throw new BuildException("Cannot define more than one mapper", | |||
| location); | |||
| } | |||
| mapperElement = new Mapper(project); | |||
| mapperElement = new Mapper(getProject()); | |||
| return mapperElement; | |||
| } | |||
| @@ -351,8 +351,8 @@ public class Copy extends Task { | |||
| // deal with the filesets | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| File fromDir = fs.getDir(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| File fromDir = fs.getDir(getProject()); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| String[] srcDirs = ds.getIncludedDirectories(); | |||
| @@ -416,7 +416,7 @@ public class Copy extends Task { | |||
| "Cannot concatenate multiple files into a single file."); | |||
| } else { | |||
| FileSet fs = (FileSet) filesets.elementAt(0); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| if (srcFiles.length == 0) { | |||
| @@ -517,7 +517,7 @@ public class Copy extends Task { | |||
| new FilterSetCollection(); | |||
| if (filtering) { | |||
| executionFilters | |||
| .addFilterSet(project.getGlobalFilterSet()); | |||
| .addFilterSet(getProject().getGlobalFilterSet()); | |||
| } | |||
| for (Enumeration filterEnum = filterSets.elements(); | |||
| filterEnum.hasMoreElements();) { | |||
| @@ -527,7 +527,7 @@ public class Copy extends Task { | |||
| fileUtils.copyFile(fromFile, toFile, executionFilters, | |||
| filterChains, forceOverwrite, | |||
| preserveLastModified, encoding, | |||
| project); | |||
| getProject()); | |||
| } catch (IOException ioe) { | |||
| String msg = "Failed to copy " + fromFile + " to " + toFile | |||
| + " due to " + ioe.getMessage(); | |||
| @@ -137,7 +137,7 @@ public class Copydir extends MatchingTask { | |||
| String fromFile = (String) enum.nextElement(); | |||
| String toFile = (String) filecopyList.get(fromFile); | |||
| try { | |||
| project.copyFile(fromFile, toFile, filtering, | |||
| getProject().copyFile(fromFile, toFile, filtering, | |||
| forceOverwrite); | |||
| } catch (IOException ioe) { | |||
| String msg = "Failed to copy " + fromFile + " to " | |||
| @@ -120,7 +120,7 @@ public class Copyfile extends Task { | |||
| if (forceOverwrite | |||
| || srcFile.lastModified() > destFile.lastModified()) { | |||
| try { | |||
| project.copyFile(srcFile, destFile, filtering, forceOverwrite); | |||
| getProject().copyFile(srcFile, destFile, filtering, forceOverwrite); | |||
| } catch (IOException ioe) { | |||
| String msg = "Error copying file: " + srcFile.getAbsolutePath() | |||
| + " due to " + ioe.getMessage(); | |||
| @@ -117,7 +117,7 @@ public abstract class Definer extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (this.classpath == null) { | |||
| this.classpath = new Path(project); | |||
| this.classpath = new Path(getProject()); | |||
| } | |||
| return this.classpath.createPath(); | |||
| } | |||
| @@ -246,7 +246,7 @@ public abstract class Definer extends Task { | |||
| */ | |||
| private AntClassLoader createLoader() { | |||
| // magic property | |||
| if (project.getProperty(REUSE_LOADER_REF) != null) { | |||
| if (getProject().getProperty(REUSE_LOADER_REF) != null) { | |||
| // Generate the 'reuse' name automatically from the reference. | |||
| // This allows <taskdefs> that work on both ant1.4 and ant1.5. | |||
| // ( in 1.4 it'll require the task/type to be in classpath if they | |||
| @@ -258,7 +258,7 @@ public abstract class Definer extends Task { | |||
| // If a loader has been set ( either by loaderRef or magic property ) | |||
| if (loaderId != null) { | |||
| Object reusedLoader = project.getReference(loaderId); | |||
| Object reusedLoader = getProject().getReference(loaderId); | |||
| if (reusedLoader != null) { | |||
| if (reusedLoader instanceof AntClassLoader) { | |||
| return (AntClassLoader)reusedLoader; | |||
| @@ -272,9 +272,9 @@ public abstract class Definer extends Task { | |||
| AntClassLoader al = null; | |||
| if (classpath != null) { | |||
| al = new AntClassLoader(project, classpath, !reverseLoader); | |||
| al = new AntClassLoader(getProject(), classpath, !reverseLoader); | |||
| } else { | |||
| al = new AntClassLoader(project, Path.systemClasspath, | |||
| al = new AntClassLoader(getProject(), Path.systemClasspath, | |||
| !reverseLoader); | |||
| } | |||
| // need to load Task via system classloader or the new | |||
| @@ -286,8 +286,8 @@ public abstract class Definer extends Task { | |||
| // If the loader is new, record it for future uses by other | |||
| // task/typedefs | |||
| if (loaderId != null) { | |||
| if (project.getReference(loaderId) == null) { | |||
| project.addReference(loaderId, al); | |||
| if (getProject().getReference(loaderId) == null) { | |||
| getProject().addReference(loaderId, al); | |||
| } | |||
| } | |||
| @@ -331,10 +331,10 @@ public class Delete extends MatchingTask { | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| try { | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] files = ds.getIncludedFiles(); | |||
| String[] dirs = ds.getIncludedDirectories(); | |||
| removeFiles(fs.getDir(project), files, dirs); | |||
| removeFiles(fs.getDir(getProject()), files, dirs); | |||
| } catch (BuildException be) { | |||
| // directory doesn't exist or is not readable | |||
| if (failonerror) { | |||
| @@ -195,12 +195,12 @@ public class DependSet extends MatchingTask { | |||
| continue; | |||
| } | |||
| DirectoryScanner targetDS = targetFS.getDirectoryScanner(project); | |||
| DirectoryScanner targetDS = targetFS.getDirectoryScanner(getProject()); | |||
| String[] targetFiles = targetDS.getIncludedFiles(); | |||
| for (int i = 0; i < targetFiles.length; i++) { | |||
| File dest = new File(targetFS.getDir(project), targetFiles[i]); | |||
| File dest = new File(targetFS.getDir(getProject()), targetFiles[i]); | |||
| allTargets.addElement(dest); | |||
| if (dest.lastModified() > now) { | |||
| @@ -224,11 +224,11 @@ public class DependSet extends MatchingTask { | |||
| while (enumTargetLists.hasMoreElements()) { | |||
| FileList targetFL = (FileList) enumTargetLists.nextElement(); | |||
| String[] targetFiles = targetFL.getFiles(project); | |||
| String[] targetFiles = targetFL.getFiles(getProject()); | |||
| for (int i = 0; i < targetFiles.length; i++) { | |||
| File dest = new File(targetFL.getDir(project), targetFiles[i]); | |||
| File dest = new File(targetFL.getDir(getProject()), targetFiles[i]); | |||
| if (!dest.exists()) { | |||
| log(targetFiles[i] + " does not exist.", Project.MSG_VERBOSE); | |||
| upToDate = false; | |||
| @@ -264,10 +264,10 @@ public class DependSet extends MatchingTask { | |||
| while (upToDate && enumSourceLists.hasMoreElements()) { | |||
| FileList sourceFL = (FileList) enumSourceLists.nextElement(); | |||
| String[] sourceFiles = sourceFL.getFiles(project); | |||
| String[] sourceFiles = sourceFL.getFiles(getProject()); | |||
| for (int i = 0; upToDate && i < sourceFiles.length; i++) { | |||
| File src = new File(sourceFL.getDir(project), sourceFiles[i]); | |||
| File src = new File(sourceFL.getDir(getProject()), sourceFiles[i]); | |||
| if (src.lastModified() > now) { | |||
| log("Warning: " + sourceFiles[i] | |||
| @@ -298,11 +298,11 @@ public class DependSet extends MatchingTask { | |||
| while (upToDate && enumSourceSets.hasMoreElements()) { | |||
| FileSet sourceFS = (FileSet) enumSourceSets.nextElement(); | |||
| DirectoryScanner sourceDS = sourceFS.getDirectoryScanner(project); | |||
| DirectoryScanner sourceDS = sourceFS.getDirectoryScanner(getProject()); | |||
| String[] sourceFiles = sourceDS.getIncludedFiles(); | |||
| for (int i = 0; upToDate && i < sourceFiles.length; i++) { | |||
| File src = new File(sourceFS.getDir(project), sourceFiles[i]); | |||
| File src = new File(sourceFS.getDir(getProject()), sourceFiles[i]); | |||
| if (src.lastModified() > now) { | |||
| log("Warning: " + sourceFiles[i] | |||
| @@ -131,7 +131,7 @@ public class Echo extends Task { | |||
| * Set a multiline message. | |||
| */ | |||
| public void addText(String msg) { | |||
| message += project.replaceProperties(msg); | |||
| message += getProject().replaceProperties(msg); | |||
| } | |||
| /** | |||
| @@ -87,8 +87,6 @@ public class Exec extends Task { | |||
| protected PrintWriter fos = null; | |||
| private boolean failOnError = false; | |||
| private static final int BUFFER_SIZE = 512; | |||
| public Exec() { | |||
| System.err.println("As of Ant 1.2 released in October 2000, " | |||
| + "the Exec class"); | |||
| @@ -116,31 +114,31 @@ public class Exec extends Task { | |||
| // default directory to the project's base directory | |||
| if (dir == null) { | |||
| dir = project.getBaseDir(); | |||
| dir = getProject().getBaseDir(); | |||
| } | |||
| if (myos.toLowerCase().indexOf("windows") >= 0) { | |||
| if (!dir.equals(project.resolveFile("."))) { | |||
| if (!dir.equals(getProject().resolveFile("."))) { | |||
| if (myos.toLowerCase().indexOf("nt") >= 0) { | |||
| command = "cmd /c cd " + dir + " && " + command; | |||
| } else { | |||
| String ant = project.getProperty("ant.home"); | |||
| String ant = getProject().getProperty("ant.home"); | |||
| if (ant == null) { | |||
| throw new BuildException("Property 'ant.home' not " | |||
| + "found", location); | |||
| } | |||
| String antRun = project.resolveFile(ant + "/bin/antRun.bat").toString(); | |||
| String antRun = getProject().resolveFile(ant + "/bin/antRun.bat").toString(); | |||
| command = antRun + " " + dir + " " + command; | |||
| } | |||
| } | |||
| } else { | |||
| String ant = project.getProperty("ant.home"); | |||
| String ant = getProject().getProperty("ant.home"); | |||
| if (ant == null) { | |||
| throw new BuildException("Property 'ant.home' not found", | |||
| location); | |||
| } | |||
| String antRun = project.resolveFile(ant + "/bin/antRun").toString(); | |||
| String antRun = getProject().resolveFile(ant + "/bin/antRun").toString(); | |||
| command = antRun + " " + dir + " " + command; | |||
| } | |||
| @@ -159,9 +157,9 @@ public class Exec extends Task { | |||
| // copy input and error to the output stream | |||
| StreamPumper inputPumper = | |||
| new StreamPumper(proc.getInputStream(), Project.MSG_INFO, this); | |||
| new StreamPumper(proc.getInputStream(), Project.MSG_INFO); | |||
| StreamPumper errorPumper = | |||
| new StreamPumper(proc.getErrorStream(), Project.MSG_WARN, this); | |||
| new StreamPumper(proc.getErrorStream(), Project.MSG_WARN); | |||
| // starts pumping away the generated output/error | |||
| inputPumper.start(); | |||
| @@ -193,7 +191,7 @@ public class Exec extends Task { | |||
| } | |||
| public void setDir(String d) { | |||
| this.dir = project.resolveFile(d); | |||
| this.dir = getProject().resolveFile(d); | |||
| } | |||
| public void setOs(String os) { | |||
| @@ -233,16 +231,13 @@ public class Exec extends Task { | |||
| private int messageLevel; | |||
| private boolean endOfStream = false; | |||
| private int SLEEP_TIME = 5; | |||
| private Exec parent; | |||
| public StreamPumper(InputStream is, int messageLevel, Exec parent) { | |||
| public StreamPumper(InputStream is, int messageLevel) { | |||
| this.din = new BufferedReader(new InputStreamReader(is)); | |||
| this.messageLevel = messageLevel; | |||
| this.parent = parent; | |||
| } | |||
| public void pumpStream() throws IOException { | |||
| byte[] buf = new byte[BUFFER_SIZE]; | |||
| if (!endOfStream) { | |||
| String line = din.readLine(); | |||
| @@ -216,7 +216,7 @@ public class ExecTask extends Task { | |||
| protected void maybeSetResultPropertyValue(int result) { | |||
| String res = Integer.toString(result); | |||
| if (resultProperty != null) { | |||
| project.setNewProperty(resultProperty, res); | |||
| getProject().setNewProperty(resultProperty, res); | |||
| } | |||
| } | |||
| @@ -301,7 +301,7 @@ public class ExecTask extends Task { | |||
| protected Execute prepareExec() throws BuildException { | |||
| // default directory to the project's base directory | |||
| if (dir == null) { | |||
| dir = project.getBaseDir(); | |||
| dir = getProject().getBaseDir(); | |||
| } | |||
| Execute exe = new Execute(createHandler(), createWatchdog()); | |||
| exe.setAntRun(getProject()); | |||
| @@ -351,7 +351,7 @@ public class ExecTask extends Task { | |||
| } | |||
| val.append(line); | |||
| } | |||
| project.setNewProperty(outputprop, val.toString()); | |||
| getProject().setNewProperty(outputprop, val.toString()); | |||
| } | |||
| } | |||
| @@ -180,7 +180,7 @@ public class ExecuteOn extends ExecTask { | |||
| throw new BuildException("Cannot define more than one mapper", | |||
| location); | |||
| } | |||
| mapperElement = new Mapper(project); | |||
| mapperElement = new Mapper(getProject()); | |||
| return mapperElement; | |||
| } | |||
| @@ -219,8 +219,8 @@ public class ExecuteOn extends ExecTask { | |||
| Vector baseDirs = new Vector(); | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| File base = fs.getDir(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| File base = fs.getDir(getProject()); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| if (!"dir".equals(type)) { | |||
| String[] s = getFiles(base, ds); | |||
| @@ -115,7 +115,7 @@ public class Exit extends Task { | |||
| if (message == null) { | |||
| message = ""; | |||
| } | |||
| message += project.replaceProperties(msg); | |||
| message += getProject().replaceProperties(msg); | |||
| } | |||
| private boolean testIfCondition() { | |||
| @@ -123,14 +123,14 @@ public class Exit extends Task { | |||
| return true; | |||
| } | |||
| return project.getProperty(ifCondition) != null; | |||
| return getProject().getProperty(ifCondition) != null; | |||
| } | |||
| private boolean testUnlessCondition() { | |||
| if (unlessCondition == null || "".equals(unlessCondition)) { | |||
| return true; | |||
| } | |||
| return project.getProperty(unlessCondition) == null; | |||
| return getProject().getProperty(unlessCondition) == null; | |||
| } | |||
| } | |||
| @@ -130,8 +130,8 @@ public class Expand extends Task { | |||
| if (filesets.size() > 0) { | |||
| for (int j = 0; j < filesets.size(); j++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(j); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| File fromDir = fs.getDir(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| File fromDir = fs.getDir(getProject()); | |||
| String[] files = ds.getIncludedFiles(); | |||
| for (int i = 0; i < files.length; ++i) { | |||
| @@ -183,7 +183,7 @@ public class Expand extends Task { | |||
| boolean included = false; | |||
| for (int v = 0; v < patternsets.size(); v++) { | |||
| PatternSet p = (PatternSet) patternsets.elementAt(v); | |||
| String[] incls = p.getIncludePatterns(project); | |||
| String[] incls = p.getIncludePatterns(getProject()); | |||
| if (incls != null) { | |||
| for (int w = 0; w < incls.length; w++) { | |||
| boolean isIncl = | |||
| @@ -194,7 +194,7 @@ public class Expand extends Task { | |||
| } | |||
| } | |||
| } | |||
| String[] excls = p.getExcludePatterns(project); | |||
| String[] excls = p.getExcludePatterns(getProject()); | |||
| if (excls != null) { | |||
| for (int w = 0; w < excls.length; w++) { | |||
| boolean isExcl = | |||
| @@ -119,7 +119,7 @@ public class Filter extends Task { | |||
| } | |||
| if (isSingleFilter) { | |||
| project.getGlobalFilterSet().addFilter(token, value); | |||
| getProject().getGlobalFilterSet().addFilter(token, value); | |||
| } | |||
| if (isFiltersFromFile) { | |||
| @@ -129,6 +129,6 @@ public class Filter extends Task { | |||
| protected void readFilters() throws BuildException { | |||
| log("Reading filters from " + filtersFile, Project.MSG_VERBOSE); | |||
| project.getGlobalFilterSet().readFiltersFromFile(filtersFile); | |||
| getProject().getGlobalFilterSet().readFiltersFromFile(filtersFile); | |||
| } | |||
| } | |||
| @@ -400,7 +400,7 @@ public class GenerateKey extends Task { | |||
| } | |||
| log("Generating Key for " + alias); | |||
| final ExecTask cmd = (ExecTask) project.createTask("exec"); | |||
| final ExecTask cmd = (ExecTask) getProject().createTask("exec"); | |||
| cmd.setExecutable("keytool"); | |||
| Commandline.Argument arg = cmd.createArg(); | |||
| arg.setLine(sb.toString()); | |||
| @@ -155,7 +155,7 @@ public class Input extends Task { | |||
| value = defaultvalue; | |||
| } | |||
| if (addproperty != null) { | |||
| project.setNewProperty(addproperty, value); | |||
| getProject().setNewProperty(addproperty, value); | |||
| } | |||
| } | |||
| @@ -204,7 +204,7 @@ public abstract class JDBCTask extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (this.classpath == null) { | |||
| this.classpath = new Path(project); | |||
| this.classpath = new Path(getProject()); | |||
| } | |||
| return this.classpath.createPath(); | |||
| } | |||
| @@ -383,7 +383,7 @@ public abstract class JDBCTask extends Task { | |||
| log( | |||
| "Loading " + driver + " using AntClassLoader with classpath " + classpath, | |||
| Project.MSG_VERBOSE); | |||
| loader = new AntClassLoader(project, classpath); | |||
| loader = new AntClassLoader(getProject(), classpath); | |||
| if (caching) { | |||
| loaderMap.put(driver, loader); | |||
| } | |||
| @@ -196,7 +196,7 @@ public class Java extends Task { | |||
| * Adds a path to the classpath. | |||
| */ | |||
| public Path createClasspath() { | |||
| return cmdl.createClasspath(project).createPath(); | |||
| return cmdl.createClasspath(getProject()).createPath(); | |||
| } | |||
| /** | |||
| @@ -403,7 +403,7 @@ public class Java extends Task { | |||
| outStream = | |||
| new PrintStream(new FileOutputStream(out.getAbsolutePath(), | |||
| append)); | |||
| exe.execute(project); | |||
| exe.execute(getProject()); | |||
| } catch (IOException io) { | |||
| throw new BuildException(io, location); | |||
| } finally { | |||
| @@ -412,7 +412,7 @@ public class Java extends Task { | |||
| } | |||
| } | |||
| } else { | |||
| exe.execute(project); | |||
| exe.execute(getProject()); | |||
| } | |||
| } | |||
| @@ -433,10 +433,10 @@ public class Java extends Task { | |||
| createWatchdog()); | |||
| } | |||
| exe.setAntRun(project); | |||
| exe.setAntRun(getProject()); | |||
| if (dir == null) { | |||
| dir = project.getBaseDir(); | |||
| dir = getProject().getBaseDir(); | |||
| } else if (!dir.exists() || !dir.isDirectory()) { | |||
| throw new BuildException(dir.getAbsolutePath() | |||
| + " is not a valid directory", | |||
| @@ -214,7 +214,7 @@ public class Javac extends MatchingTask { | |||
| */ | |||
| public Path createSrc() { | |||
| if (src == null) { | |||
| src = new Path(project); | |||
| src = new Path(getProject()); | |||
| } | |||
| return src.createPath(); | |||
| } | |||
| @@ -282,7 +282,7 @@ public class Javac extends MatchingTask { | |||
| */ | |||
| public Path createSourcepath() { | |||
| if (compileSourcepath == null) { | |||
| compileSourcepath = new Path(project); | |||
| compileSourcepath = new Path(getProject()); | |||
| } | |||
| return compileSourcepath.createPath(); | |||
| } | |||
| @@ -317,7 +317,7 @@ public class Javac extends MatchingTask { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (compileClasspath == null) { | |||
| compileClasspath = new Path(project); | |||
| compileClasspath = new Path(getProject()); | |||
| } | |||
| return compileClasspath.createPath(); | |||
| } | |||
| @@ -354,7 +354,7 @@ public class Javac extends MatchingTask { | |||
| */ | |||
| public Path createBootclasspath() { | |||
| if (bootclasspath == null) { | |||
| bootclasspath = new Path(project); | |||
| bootclasspath = new Path(getProject()); | |||
| } | |||
| return bootclasspath.createPath(); | |||
| } | |||
| @@ -391,7 +391,7 @@ public class Javac extends MatchingTask { | |||
| */ | |||
| public Path createExtdirs() { | |||
| if (extdirs == null) { | |||
| extdirs = new Path(project); | |||
| extdirs = new Path(getProject()); | |||
| } | |||
| return extdirs.createPath(); | |||
| } | |||
| @@ -666,7 +666,7 @@ public class Javac extends MatchingTask { | |||
| // compile lists | |||
| String[] list = src.list(); | |||
| for (int i = 0; i < list.length; i++) { | |||
| File srcDir = project.resolveFile(list[i]); | |||
| File srcDir = getProject().resolveFile(list[i]); | |||
| if (!srcDir.exists()) { | |||
| throw new BuildException("srcdir \"" | |||
| + srcDir.getPath() | |||
| @@ -535,7 +535,7 @@ public class Javadoc extends Task { | |||
| */ | |||
| public Path createSourcepath() { | |||
| if (sourcePath == null) { | |||
| sourcePath = new Path(project); | |||
| sourcePath = new Path(getProject()); | |||
| } | |||
| return sourcePath.createPath(); | |||
| } | |||
| @@ -570,7 +570,7 @@ public class Javadoc extends Task { | |||
| while (tok.hasMoreTokens()) { | |||
| String f = tok.nextToken(); | |||
| SourceFile sf = new SourceFile(); | |||
| sf.setFile(project.resolveFile(f)); | |||
| sf.setFile(getProject().resolveFile(f)); | |||
| addSource(sf); | |||
| } | |||
| } | |||
| @@ -806,7 +806,7 @@ public class Javadoc extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| classpath = new Path(project); | |||
| classpath = new Path(getProject()); | |||
| } | |||
| return classpath.createPath(); | |||
| } | |||
| @@ -840,7 +840,7 @@ public class Javadoc extends Task { | |||
| */ | |||
| public Path createBootclasspath() { | |||
| if (bootclasspath == null) { | |||
| bootclasspath = new Path(project); | |||
| bootclasspath = new Path(getProject()); | |||
| } | |||
| return bootclasspath.createPath(); | |||
| } | |||
| @@ -1067,7 +1067,7 @@ public class Javadoc extends Task { | |||
| if (!tok.hasMoreTokens()) { | |||
| throw new BuildException(linkOfflineError); | |||
| } | |||
| le.setPackagelistLoc(project.resolveFile(tok.nextToken())); | |||
| le.setPackagelistLoc(getProject().resolveFile(tok.nextToken())); | |||
| } | |||
| } | |||
| @@ -1823,7 +1823,7 @@ public class Javadoc extends Task { | |||
| JavadocOutputStream out = new JavadocOutputStream(Project.MSG_INFO); | |||
| JavadocOutputStream err = new JavadocOutputStream(Project.MSG_WARN); | |||
| Execute exe = new Execute(new PumpStreamHandler(out, err)); | |||
| exe.setAntRun(project); | |||
| exe.setAntRun(getProject()); | |||
| /* | |||
| * No reason to change the working directory as all filenames and | |||
| @@ -2012,7 +2012,7 @@ public class Javadoc extends Task { | |||
| * Convenience method to expand properties. | |||
| */ | |||
| protected String expand(String content) { | |||
| return project.replaceProperties(content); | |||
| return getProject().replaceProperties(content); | |||
| } | |||
| } | |||
| @@ -188,7 +188,7 @@ public final class LoadFile extends Task { | |||
| crh.setBufferSize(size); | |||
| crh.setPrimaryReader(instream); | |||
| crh.setFilterChains(filterChains); | |||
| crh.setProject(project); | |||
| crh.setProject(getProject()); | |||
| instream = crh.getAssembledReader(); | |||
| text = crh.readFully(instream); | |||
| @@ -196,7 +196,7 @@ public final class LoadFile extends Task { | |||
| if (text != null) { | |||
| if (text.length() > 0) { | |||
| project.setNewProperty(property, text); | |||
| getProject().setNewProperty(property, text); | |||
| log("loaded " + text.length() + " characters", | |||
| Project.MSG_VERBOSE); | |||
| log(property + " := " + text, Project.MSG_DEBUG); | |||
| @@ -158,7 +158,7 @@ public final class LoadProperties extends Task { | |||
| crh.setBufferSize(size); | |||
| crh.setPrimaryReader(instream); | |||
| crh.setFilterChains(filterChains); | |||
| crh.setProject(project); | |||
| crh.setProject(getProject()); | |||
| instream = crh.getAssembledReader(); | |||
| String text = crh.readFully(instream); | |||
| @@ -182,7 +182,7 @@ public final class LoadProperties extends Task { | |||
| final String value = props.getProperty(key); | |||
| if (key != null && value != null | |||
| && value.trim().length() > 0) { | |||
| project.setNewProperty(key, value); | |||
| getProject().setNewProperty(key, value); | |||
| } | |||
| } | |||
| tis.close(); | |||
| @@ -209,7 +209,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer { | |||
| protected DirectoryScanner getDirectoryScanner(File baseDir) { | |||
| fileset.setDir(baseDir); | |||
| fileset.setDefaultexcludes(useDefaultExcludes); | |||
| return fileset.getDirectoryScanner(project); | |||
| return fileset.getDirectoryScanner(getProject()); | |||
| } | |||
| /** | |||
| @@ -291,7 +291,6 @@ public abstract class MatchingTask extends Task implements SelectorContainer { | |||
| * Add a new selector into this container. | |||
| * | |||
| * @param selector the new selector to add | |||
| * @return the selector that was added | |||
| */ | |||
| public void appendSelector(FileSelector selector) { | |||
| fileset.appendSelector(selector); | |||
| @@ -160,7 +160,7 @@ public class Move extends Copy { | |||
| new FilterSetCollection(); | |||
| if (filtering) { | |||
| executionFilters | |||
| .addFilterSet(project.getGlobalFilterSet()); | |||
| .addFilterSet(getProject().getGlobalFilterSet()); | |||
| } | |||
| for (Enumeration filterEnum = | |||
| getFilterSets().elements(); | |||
| @@ -173,7 +173,7 @@ public class Move extends Copy { | |||
| getFilterChains(), | |||
| forceOverwrite, | |||
| getPreserveLastModified(), | |||
| getEncoding(), project); | |||
| getEncoding(), getProject()); | |||
| f = new File(fromFile); | |||
| if (!f.delete()) { | |||
| @@ -217,7 +217,7 @@ public class Move extends Copy { | |||
| Enumeration e = filesets.elements(); | |||
| while (e.hasMoreElements()) { | |||
| FileSet fs = (FileSet) e.nextElement(); | |||
| File dir = fs.getDir(project); | |||
| File dir = fs.getDir(getProject()); | |||
| if (okToDelete(dir)) { | |||
| deleteDir(dir); | |||
| @@ -276,7 +276,7 @@ public class Property extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (this.classpath == null) { | |||
| this.classpath = new Path(project); | |||
| this.classpath = new Path(getProject()); | |||
| } | |||
| return this.classpath.createPath(); | |||
| } | |||
| @@ -408,7 +408,7 @@ public class Property extends Task { | |||
| ClassLoader cL = null; | |||
| if (classpath != null) { | |||
| cL = new AntClassLoader(project, classpath); | |||
| cL = new AntClassLoader(getProject(), classpath); | |||
| } else { | |||
| cL = this.getClass().getClassLoader(); | |||
| } | |||
| @@ -472,7 +472,7 @@ public class Property extends Task { | |||
| String name = (String) e.nextElement(); | |||
| String value = props.getProperty(name); | |||
| String v = project.replaceProperties(value); | |||
| String v = getProject().replaceProperties(value); | |||
| if (prefix != null) { | |||
| name = prefix + name; | |||
| @@ -489,13 +489,13 @@ public class Property extends Task { | |||
| */ | |||
| protected void addProperty(String n, String v) { | |||
| if (userProperty) { | |||
| if (project.getUserProperty(n) == null) { | |||
| project.setInheritedProperty(n, v); | |||
| if (getProject().getUserProperty(n) == null) { | |||
| getProject().setInheritedProperty(n, v); | |||
| } else { | |||
| log("Override ignored for " + n, Project.MSG_VERBOSE); | |||
| } | |||
| } else { | |||
| project.setNewProperty(n, v); | |||
| getProject().setNewProperty(n, v); | |||
| } | |||
| } | |||
| @@ -259,7 +259,7 @@ public class Rmic extends MatchingTask { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (compileClasspath == null) { | |||
| compileClasspath = new Path(project); | |||
| compileClasspath = new Path(getProject()); | |||
| } | |||
| return compileClasspath.createPath(); | |||
| } | |||
| @@ -414,7 +414,7 @@ public class Rmic extends MatchingTask { | |||
| */ | |||
| public Path createExtdirs() { | |||
| if (extdirs == null) { | |||
| extdirs = new Path(project); | |||
| extdirs = new Path(getProject()); | |||
| } | |||
| return extdirs.createPath(); | |||
| } | |||
| @@ -493,7 +493,7 @@ public class Rmic extends MatchingTask { | |||
| adapter.setRmic(this); | |||
| Path classpath = adapter.getClasspath(); | |||
| loader = new AntClassLoader(project, classpath); | |||
| loader = new AntClassLoader(getProject(), classpath); | |||
| try { | |||
| // scan base dirs to build up compile lists only if a | |||
| @@ -338,8 +338,8 @@ public class SQLExec extends JDBCTask { | |||
| // deal with the filesets | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| File srcDir = fs.getDir(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| File srcDir = fs.getDir(getProject()); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| @@ -435,7 +435,7 @@ public class SQLExec extends JDBCTask { | |||
| while ((line = in.readLine()) != null){ | |||
| line = line.trim(); | |||
| line = project.replaceProperties(line); | |||
| line = getProject().replaceProperties(line); | |||
| if (line.startsWith("//")) { | |||
| continue; | |||
| } | |||
| @@ -62,7 +62,6 @@ import java.util.zip.ZipFile; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.DirectoryScanner; | |||
| import org.apache.tools.ant.Project; | |||
| import org.apache.tools.ant.types.FileSet; | |||
| import org.apache.tools.ant.util.JavaEnvUtils; | |||
| @@ -235,10 +234,10 @@ public class SignJar extends Task { | |||
| // deal with the filesets | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] jarFiles = ds.getIncludedFiles(); | |||
| for (int j = 0; j < jarFiles.length; j++) { | |||
| doOneJar(new File(fs.getDir(project), jarFiles[j]), null); | |||
| doOneJar(new File(fs.getDir(getProject()), jarFiles[j]), null); | |||
| } | |||
| } | |||
| } | |||
| @@ -266,7 +265,7 @@ public class SignJar extends Task { | |||
| return; | |||
| } | |||
| final ExecTask cmd = (ExecTask) project.createTask("exec"); | |||
| final ExecTask cmd = (ExecTask) getProject().createTask("exec"); | |||
| cmd.setExecutable("jarsigner"); | |||
| if (null != keystore) { | |||
| @@ -265,14 +265,14 @@ public class Tar extends MatchingTask { | |||
| boolean upToDate = true; | |||
| for (Enumeration e = filesets.elements(); e.hasMoreElements();) { | |||
| TarFileSet fs = (TarFileSet) e.nextElement(); | |||
| String[] files = fs.getFiles(project); | |||
| String[] files = fs.getFiles(getProject()); | |||
| if (!archiveIsUpToDate(files)) { | |||
| upToDate = false; | |||
| } | |||
| for (int i = 0; i < files.length; ++i) { | |||
| if (tarFile.equals(new File(fs.getDir(project), | |||
| if (tarFile.equals(new File(fs.getDir(getProject()), | |||
| files[i]))) { | |||
| throw new BuildException("A tar file cannot include " | |||
| + "itself", location); | |||
| @@ -309,7 +309,7 @@ public class Tar extends MatchingTask { | |||
| for (Enumeration e = filesets.elements(); | |||
| e.hasMoreElements();) { | |||
| TarFileSet fs = (TarFileSet) e.nextElement(); | |||
| String[] files = fs.getFiles(project); | |||
| String[] files = fs.getFiles(getProject()); | |||
| if (files.length > 1 && fs.getFullpath().length() > 0) { | |||
| throw new BuildException("fullpath attribute may only " | |||
| + "be specified for " | |||
| @@ -317,7 +317,7 @@ public class Tar extends MatchingTask { | |||
| + "single file."); | |||
| } | |||
| for (int i = 0; i < files.length; i++) { | |||
| File f = new File(fs.getDir(project), files[i]); | |||
| File f = new File(fs.getDir(getProject()), files[i]); | |||
| String name = files[i].replace(File.separatorChar, '/'); | |||
| tarFile(f, tOut, name, fs); | |||
| } | |||
| @@ -79,6 +79,6 @@ public class Taskdef extends Definer { | |||
| * execution. | |||
| */ | |||
| protected void addDefinition(String name, Class c) throws BuildException { | |||
| project.addTaskDefinition(name, c); | |||
| getProject().addTaskDefinition(name, c); | |||
| } | |||
| } | |||
| @@ -54,10 +54,6 @@ | |||
| package org.apache.tools.ant.taskdefs; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileOutputStream; | |||
| import java.io.IOException; | |||
| import java.util.Properties; | |||
| import org.apache.tools.ant.Task; | |||
| import org.apache.tools.ant.BuildException; | |||
| import org.apache.tools.ant.util.FileUtils; | |||
| @@ -155,10 +151,10 @@ public class TempFile extends Task { | |||
| throw new BuildException("no property specified"); | |||
| } | |||
| if (destDir == null) { | |||
| destDir = project.resolveFile("."); | |||
| destDir = getProject().resolveFile("."); | |||
| } | |||
| FileUtils utils = FileUtils.newFileUtils(); | |||
| File tfile = utils.createTempFile(prefix, suffix, destDir); | |||
| project.setNewProperty(property, tfile.toString()); | |||
| getProject().setNewProperty(property, tfile.toString()); | |||
| } | |||
| } | |||
| @@ -210,8 +210,8 @@ public class Touch extends Task { | |||
| // deal with the filesets | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| File fromDir = fs.getDir(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| File fromDir = fs.getDir(getProject()); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| String[] srcDirs = ds.getIncludedDirectories(); | |||
| @@ -112,18 +112,18 @@ public class Tstamp extends Task { | |||
| Enumeration i = customFormats.elements(); | |||
| while (i.hasMoreElements()) { | |||
| CustomFormat cts = (CustomFormat) i.nextElement(); | |||
| cts.execute(project, d, location); | |||
| cts.execute(getProject(), d, location); | |||
| } | |||
| SimpleDateFormat dstamp = new SimpleDateFormat ("yyyyMMdd"); | |||
| project.setNewProperty(prefix + "DSTAMP", dstamp.format(d)); | |||
| getProject().setNewProperty(prefix + "DSTAMP", dstamp.format(d)); | |||
| SimpleDateFormat tstamp = new SimpleDateFormat ("HHmm"); | |||
| project.setNewProperty(prefix + "TSTAMP", tstamp.format(d)); | |||
| getProject().setNewProperty(prefix + "TSTAMP", tstamp.format(d)); | |||
| SimpleDateFormat today | |||
| = new SimpleDateFormat ("MMMM d yyyy", Locale.US); | |||
| project.setNewProperty(prefix + "TODAY", today.format(d)); | |||
| getProject().setNewProperty(prefix + "TODAY", today.format(d)); | |||
| } catch (Exception e) { | |||
| throw new BuildException(e); | |||
| @@ -84,6 +84,6 @@ public class Typedef extends Definer { | |||
| * implement abstract callback of parent class | |||
| */ | |||
| protected void addDefinition(String name, Class c) throws BuildException { | |||
| project.addDataTypeDefinition(name, c); | |||
| getProject().addDataTypeDefinition(name, c); | |||
| } | |||
| } | |||
| @@ -82,7 +82,7 @@ public abstract class Unpack extends Task { | |||
| public void setSrc(String src) { | |||
| log("DEPRECATED - The setSrc(String) method has been deprecated." | |||
| + " Use setSrc(File) instead."); | |||
| setSrc(project.resolveFile(src)); | |||
| setSrc(getProject().resolveFile(src)); | |||
| } | |||
| /** | |||
| @@ -95,7 +95,7 @@ public abstract class Unpack extends Task { | |||
| public void setDest(String dest) { | |||
| log("DEPRECATED - The setDest(String) method has been deprecated." | |||
| + " Use setDest(File) instead."); | |||
| setDest(project.resolveFile(dest)); | |||
| setDest(getProject().resolveFile(dest)); | |||
| } | |||
| /** | |||
| @@ -156,7 +156,7 @@ public class UpToDate extends Task implements Condition { | |||
| throw new BuildException("Cannot define more than one mapper", | |||
| location); | |||
| } | |||
| mapperElement = new Mapper(project); | |||
| mapperElement = new Mapper(getProject()); | |||
| return mapperElement; | |||
| } | |||
| @@ -196,8 +196,8 @@ public class UpToDate extends Task implements Condition { | |||
| boolean upToDate = true; | |||
| while (upToDate && enum.hasMoreElements()) { | |||
| FileSet fs = (FileSet) enum.nextElement(); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| upToDate = upToDate && scanDir(fs.getDir(project), | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| upToDate = upToDate && scanDir(fs.getDir(getProject()), | |||
| ds.getIncludedFiles()); | |||
| } | |||
| @@ -229,7 +229,7 @@ public class UpToDate extends Task implements Condition { | |||
| } | |||
| boolean upToDate = eval(); | |||
| if (upToDate) { | |||
| this.project.setNewProperty(_property, getValue()); | |||
| this.getProject().setNewProperty(_property, getValue()); | |||
| if (mapperElement == null) { | |||
| log("File \"" + _targetFile.getAbsolutePath() | |||
| + "\" is up-to-date.", Project.MSG_VERBOSE); | |||
| @@ -164,7 +164,7 @@ public class WaitFor extends ConditionBase { | |||
| } | |||
| if (timeoutProperty != null) { | |||
| project.setNewProperty(timeoutProperty, "true"); | |||
| getProject().setNewProperty(timeoutProperty, "true"); | |||
| } | |||
| } finally { | |||
| maxWaitMillis = savedMaxWaitMillis; | |||
| @@ -175,7 +175,7 @@ public class WaitFor extends ConditionBase { | |||
| /** | |||
| * The enumeration of units: | |||
| * millisecond, second, minute, hour, day, week | |||
| * @todo: we use timestamps in many places, why not factor this out | |||
| * @todo we use timestamps in many places, why not factor this out | |||
| */ | |||
| public static class Unit extends EnumeratedAttribute { | |||
| @@ -193,7 +193,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| try { | |||
| if (baseDir == null) { | |||
| baseDir = project.resolveFile("."); | |||
| baseDir = getProject().resolveFile("."); | |||
| } | |||
| liaison = getLiaison(); | |||
| @@ -205,7 +205,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| log("Using " + liaison.getClass().toString(), Project.MSG_VERBOSE); | |||
| File stylesheet = project.resolveFile(xslFile); | |||
| File stylesheet = getProject().resolveFile(xslFile); | |||
| if (!stylesheet.exists()) { | |||
| stylesheet = fileUtils.resolveFile(baseDir, xslFile); | |||
| /* | |||
| @@ -326,7 +326,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| classpath = new Path(project); | |||
| classpath = new Path(getProject()); | |||
| } | |||
| return classpath.createPath(); | |||
| } | |||
| @@ -398,7 +398,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| if (classpath == null) { | |||
| return Class.forName(classname); | |||
| } else { | |||
| AntClassLoader al = new AntClassLoader(project, classpath); | |||
| AntClassLoader al = new AntClassLoader(getProject(), classpath); | |||
| Class c = al.loadClass(classname); | |||
| AntClassLoader.initializeClass(c); | |||
| return c; | |||
| @@ -702,7 +702,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| */ | |||
| public void init() throws BuildException { | |||
| super.init(); | |||
| xmlCatalog.setProject(project); | |||
| xmlCatalog.setProject(getProject()); | |||
| } | |||
| /** | |||
| @@ -810,7 +810,7 @@ public class XSLTProcess extends MatchingTask implements XSLTLogger { | |||
| /** | |||
| * Create an instance of a factory attribute. | |||
| * @return the newly created factory attribute | |||
| * the newly created factory attribute | |||
| */ | |||
| public void addAttribute(Attribute attr) { | |||
| attributes.addElement(attr); | |||
| @@ -63,13 +63,11 @@ import org.xml.sax.SAXException; | |||
| import javax.xml.parsers.DocumentBuilder; | |||
| import javax.xml.parsers.DocumentBuilderFactory; | |||
| import javax.xml.parsers.FactoryConfigurationError; | |||
| import javax.xml.parsers.ParserConfigurationException; | |||
| import java.io.BufferedInputStream; | |||
| import java.io.File; | |||
| import java.io.FileInputStream; | |||
| import java.io.IOException; | |||
| import java.util.Vector; | |||
| /** | |||
| * Loads property values from a valid XML file, | |||
| @@ -91,7 +89,6 @@ import java.util.Vector; | |||
| * </pre> | |||
| * @author <a href="mailto:nicolaken@apache.org">Nicola Ken Barozzi</a> | |||
| * @author Erik Hatcher | |||
| * @created 14 January 2002 | |||
| * @ant.task name="xmlproperty" category="xml" | |||
| */ | |||
| @@ -201,7 +198,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
| String attributeValue = attributeNode.getNodeValue(); | |||
| log(attributeName + ":" + attributeValue, Project.MSG_DEBUG); | |||
| project.setNewProperty(attributeName, attributeValue); | |||
| getProject().setNewProperty(attributeName, attributeValue); | |||
| } | |||
| } | |||
| @@ -209,7 +206,7 @@ public class XmlProperty extends org.apache.tools.ant.Task { | |||
| String nodeText = node.getNodeValue(); | |||
| if (nodeText.trim().length() != 0) { | |||
| log(prefix + ":" + nodeText, Project.MSG_DEBUG); | |||
| project.setNewProperty(prefix, nodeText); | |||
| getProject().setNewProperty(prefix, nodeText); | |||
| } | |||
| } | |||
| @@ -298,7 +298,7 @@ public class Zip extends MatchingTask { | |||
| log("Processing groupfileset ", Project.MSG_VERBOSE); | |||
| FileSet fs = (FileSet) groupfilesets.elementAt(i); | |||
| FileScanner scanner = fs.getDirectoryScanner(project); | |||
| FileScanner scanner = fs.getDirectoryScanner(getProject()); | |||
| String[] files = scanner.getIncludedFiles(); | |||
| File basedir = scanner.getBasedir(); | |||
| for (int j = 0; j < files.length; j++) { | |||
| @@ -319,7 +319,7 @@ public class Zip extends MatchingTask { | |||
| } | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| dss.addElement (fs.getDirectoryScanner(project)); | |||
| dss.addElement (fs.getDirectoryScanner(getProject())); | |||
| } | |||
| int dssSize = dss.size(); | |||
| FileScanner[] scanners = new FileScanner[dssSize]; | |||
| @@ -845,7 +845,7 @@ public class Zip extends MatchingTask { | |||
| // Add each fileset in the Vector. | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String prefix = ""; | |||
| String fullpath = ""; | |||
| @@ -262,7 +262,7 @@ public class ChangeLogTask extends Task { | |||
| while (e.hasMoreElements()) { | |||
| final FileSet fileSet = (FileSet) e.nextElement(); | |||
| final DirectoryScanner scanner = | |||
| fileSet.getDirectoryScanner(project); | |||
| fileSet.getDirectoryScanner(getProject()); | |||
| final String[] files = scanner.getIncludedFiles(); | |||
| for (int i = 0; i < files.length; i++) { | |||
| @@ -353,7 +353,7 @@ public class EmailTask | |||
| StringTokenizer t = new StringTokenizer(filenames, ", "); | |||
| while (t.hasMoreTokens()) { | |||
| files.addElement(project.resolveFile(t.nextToken())); | |||
| files.addElement(getProject().resolveFile(t.nextToken())); | |||
| } | |||
| } | |||
| @@ -475,7 +475,7 @@ public class EmailTask | |||
| while (e.hasMoreElements()) { | |||
| FileSet fs = (FileSet) e.nextElement(); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] includedFiles = ds.getIncludedFiles(); | |||
| File baseDir = ds.getBasedir(); | |||
| @@ -89,9 +89,6 @@ public class ANTLR extends Task { | |||
| /** an optional super grammar file */ | |||
| private String superGrammar; | |||
| /** optional flag to enable parseView debugging */ | |||
| private boolean debug; | |||
| /** optional flag to enable html output */ | |||
| private boolean html; | |||
| @@ -110,9 +107,6 @@ public class ANTLR extends Task { | |||
| /** optional flag to add trace methods to the tree walker only */ | |||
| private boolean traceTreeWalker; | |||
| /** should fork ? */ | |||
| private final boolean fork = true; | |||
| /** working directory */ | |||
| private File workingdir = null; | |||
| @@ -148,7 +142,7 @@ public class ANTLR extends Task { | |||
| * Sets a flag to enable ParseView debugging | |||
| */ | |||
| public void setDebug(boolean enable) { | |||
| debug = enable; | |||
| log( "debug attribute is never used", Project.MSG_WARN); | |||
| } | |||
| /** | |||
| @@ -216,7 +210,7 @@ public class ANTLR extends Task { | |||
| * because a directory might be given for Antlr debug. | |||
| */ | |||
| public Path createClasspath() { | |||
| return commandline.createClasspath(project).createPath(); | |||
| return commandline.createClasspath(getProject()).createPath(); | |||
| } | |||
| /** | |||
| @@ -329,7 +323,6 @@ public class ANTLR extends Task { | |||
| // if no output directory is specified, used the target's directory | |||
| if (outputDirectory == null) { | |||
| String fileName = target.toString(); | |||
| setOutputdirectory(new File(target.getParent())); | |||
| } | |||
| if (!outputDirectory.isDirectory()) { | |||
| @@ -363,7 +356,7 @@ public class ANTLR extends Task { | |||
| private int run(String[] command) throws BuildException { | |||
| Execute exe = new Execute(new LogStreamHandler(this, Project.MSG_INFO, | |||
| Project.MSG_WARN), null); | |||
| exe.setAntRun(project); | |||
| exe.setAntRun(getProject()); | |||
| if (workingdir != null) { | |||
| exe.setWorkingDirectory(workingdir); | |||
| } | |||
| @@ -159,7 +159,7 @@ public class Cab extends MatchingTask { | |||
| * it appears in the logs to be the same task as this one. | |||
| */ | |||
| protected ExecTask createExec() throws BuildException { | |||
| ExecTask exec = (ExecTask) project.createTask("exec"); | |||
| ExecTask exec = (ExecTask) getProject().createTask("exec"); | |||
| exec.setOwningTarget(this.getOwningTarget()); | |||
| exec.setTaskName(this.getTaskName()); | |||
| exec.setDescription(this.getDescription()); | |||
| @@ -253,7 +253,7 @@ public class Cab extends MatchingTask { | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| if (fs != null) { | |||
| appendFiles(files, fs.getDirectoryScanner(project)); | |||
| appendFiles(files, fs.getDirectoryScanner(getProject())); | |||
| } | |||
| } | |||
| } | |||
| @@ -243,7 +243,7 @@ public class EchoProperties extends Task { | |||
| use Ant's properties */ | |||
| if(inFile == null) { | |||
| // add ant properties | |||
| CollectionUtils.putAll(allProps, project.getProperties()); | |||
| CollectionUtils.putAll(allProps, getProject().getProperties()); | |||
| } else { | |||
| if (inFile.exists() && inFile.isDirectory()) { | |||
| String message = "srcfile is a directory!"; | |||
| @@ -536,7 +536,7 @@ public class IContract extends MatchingTask { | |||
| // Prepare the directories for iContract. iContract will make them if they | |||
| // don't exist, but for some reason I don't know, it will complain about the REP files | |||
| // afterwards | |||
| Mkdir mkdir = (Mkdir) project.createTask("mkdir"); | |||
| Mkdir mkdir = (Mkdir) getProject().createTask("mkdir"); | |||
| mkdir.setDir(instrumentDir); | |||
| mkdir.execute(); | |||
| @@ -549,7 +549,7 @@ public class IContract extends MatchingTask { | |||
| Path baseClasspath = createClasspath(); | |||
| // Might need to add the core classes if we're not using Sun's Javac (like Jikes) | |||
| String compiler = project.getProperty("build.compiler"); | |||
| String compiler = getProject().getProperty("build.compiler"); | |||
| ClasspathHelper classpathHelper = new ClasspathHelper(compiler); | |||
| classpathHelper.modify(baseClasspath); | |||
| @@ -586,7 +586,7 @@ public class IContract extends MatchingTask { | |||
| iContractClasspath.append(new Path(getProject(), buildDir.getAbsolutePath())); | |||
| // Create a forked java process | |||
| Java iContract = (Java) project.createTask("java"); | |||
| Java iContract = (Java) getProject().createTask("java"); | |||
| iContract.setTaskName(getTaskName()); | |||
| iContract.setFork(true); | |||
| @@ -104,8 +104,6 @@ import java.util.Enumeration; | |||
| public class Javah extends Task { | |||
| private static final String FAIL_MSG = "Compile failed, messages should have been provided."; | |||
| private Vector classes = new Vector(2); | |||
| private String cls; | |||
| private File destDir; | |||
| @@ -175,7 +173,7 @@ public class Javah extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| classpath = new Path(project); | |||
| classpath = new Path(getProject()); | |||
| } | |||
| return classpath.createPath(); | |||
| } | |||
| @@ -204,7 +202,7 @@ public class Javah extends Task { | |||
| */ | |||
| public Path createBootclasspath() { | |||
| if (bootclasspath == null) { | |||
| bootclasspath = new Path(project); | |||
| bootclasspath = new Path(getProject()); | |||
| } | |||
| return bootclasspath.createPath(); | |||
| } | |||
| @@ -305,7 +303,7 @@ public class Javah extends Task { | |||
| classpath = Path.systemClasspath; | |||
| } | |||
| String compiler = project.getProperty("build.compiler"); | |||
| String compiler = getProject().getProperty("build.compiler"); | |||
| if (compiler == null) { | |||
| if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) && | |||
| !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) { | |||
| @@ -142,19 +142,18 @@ public class Native2Ascii extends MatchingTask { | |||
| throw new BuildException("Cannot define more than one mapper", | |||
| location); | |||
| } | |||
| mapper = new Mapper(project); | |||
| mapper = new Mapper(getProject()); | |||
| return mapper; | |||
| } | |||
| public void execute() throws BuildException { | |||
| Commandline baseCmd = null; // the common portion of our cmd line | |||
| DirectoryScanner scanner = null; // Scanner to find our inputs | |||
| String[] files; // list of files to process | |||
| // default srcDir to basedir | |||
| if (srcDir == null){ | |||
| srcDir = project.resolveFile("."); | |||
| srcDir = getProject().resolveFile("."); | |||
| } | |||
| // Require destDir | |||
| @@ -140,7 +140,6 @@ public class NetRexxC extends MatchingTask { | |||
| private boolean diag; | |||
| private boolean explicit; | |||
| private boolean format; | |||
| private boolean java; | |||
| private boolean keep; | |||
| private boolean logo = true; | |||
| private boolean replace; | |||
| @@ -174,8 +173,6 @@ public class NetRexxC extends MatchingTask { | |||
| // other implementation variables | |||
| private Vector compileList = new Vector(); | |||
| private Hashtable filecopyList = new Hashtable(); | |||
| private String oldClasspath = System.getProperty("java.class.path"); | |||
| /** | |||
| * Set whether literals are treated as binary, rather than NetRexx types | |||
| @@ -294,7 +291,7 @@ public class NetRexxC extends MatchingTask { | |||
| * false. | |||
| */ | |||
| public void setJava(boolean java) { | |||
| this.java = java; | |||
| log( "The attribute java is currently unused.", Project.MSG_WARN ); | |||
| } | |||
| @@ -535,103 +532,103 @@ public class NetRexxC extends MatchingTask { | |||
| public void init() { | |||
| String p; | |||
| if ((p = project.getProperty("ant.netrexxc.binary")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.binary")) != null) { | |||
| this.binary = Project.toBoolean(p); | |||
| } | |||
| // classpath makes no sense | |||
| if ((p = project.getProperty("ant.netrexxc.comments")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.comments")) != null) { | |||
| this.comments = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.compact")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.compact")) != null) { | |||
| this.compact = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.compile")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.compile")) != null) { | |||
| this.compile = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.console")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.console")) != null) { | |||
| this.console = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.crossref")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.crossref")) != null) { | |||
| this.crossref = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.decimal")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.decimal")) != null) { | |||
| this.decimal = Project.toBoolean(p); | |||
| // destDir | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.diag")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.diag")) != null) { | |||
| this.diag = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.explicit")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.explicit")) != null) { | |||
| this.explicit = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.format")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.format")) != null) { | |||
| this.format = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.java")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.java")) != null) { | |||
| this.java = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.keep")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.keep")) != null) { | |||
| this.keep = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.logo")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.logo")) != null) { | |||
| this.logo = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.replace")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.replace")) != null) { | |||
| this.replace = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.savelog")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.savelog")) != null) { | |||
| this.savelog = Project.toBoolean(p); | |||
| // srcDir | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.sourcedir")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.sourcedir")) != null) { | |||
| this.sourcedir = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.strictargs")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.strictargs")) != null) { | |||
| this.strictargs = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.strictassign")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.strictassign")) != null) { | |||
| this.strictassign = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.strictcase")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.strictcase")) != null) { | |||
| this.strictcase = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.strictimport")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.strictimport")) != null) { | |||
| this.strictimport = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.strictprops")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.strictprops")) != null) { | |||
| this.strictprops = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.strictsignal")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.strictsignal")) != null) { | |||
| this.strictsignal = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.symbols")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.symbols")) != null) { | |||
| this.symbols = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.time")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.time")) != null) { | |||
| this.time = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.trace")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.trace")) != null) { | |||
| setTrace(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.utf8")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.utf8")) != null) { | |||
| this.utf8 = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.verbose")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.verbose")) != null) { | |||
| setVerbose(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.suppressMethodArgumentNotUsed")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.suppressMethodArgumentNotUsed")) != null) { | |||
| this.suppressMethodArgumentNotUsed = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.suppressPrivatePropertyNotUsed")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.suppressPrivatePropertyNotUsed")) != null) { | |||
| this.suppressPrivatePropertyNotUsed = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.suppressVariableNotUsed")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.suppressVariableNotUsed")) != null) { | |||
| this.suppressVariableNotUsed = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.suppressExceptionNotSignalled")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.suppressExceptionNotSignalled")) != null) { | |||
| this.suppressExceptionNotSignalled = Project.toBoolean(p); | |||
| } | |||
| if ((p = project.getProperty("ant.netrexxc.suppressDeprecation")) != null) { | |||
| if ((p = getProject().getProperty("ant.netrexxc.suppressDeprecation")) != null) { | |||
| this.suppressDeprecation = Project.toBoolean(p); | |||
| } | |||
| } | |||
| @@ -712,7 +709,7 @@ public class NetRexxC extends MatchingTask { | |||
| String toFile = (String) filecopyList.get(fromFile); | |||
| try { | |||
| project.copyFile(fromFile, toFile); | |||
| getProject().copyFile(fromFile, toFile); | |||
| } catch (IOException ioe) { | |||
| String msg = "Failed to copy " + fromFile + " to " + toFile | |||
| + " due to " + ioe.getMessage(); | |||
| @@ -730,7 +727,6 @@ public class NetRexxC extends MatchingTask { | |||
| String classpath = getCompileClasspath(); | |||
| StringBuffer compileOptions = new StringBuffer(); | |||
| StringBuffer fileList = new StringBuffer(); | |||
| // create an array of strings for input to the compiler: one array | |||
| // comes from the compile options, the other from the compileList | |||
| @@ -904,7 +900,7 @@ public class NetRexxC extends MatchingTask { | |||
| System.getProperty("path.separator"), false); | |||
| while (tok.hasMoreTokens()) { | |||
| File f = project.resolveFile(tok.nextToken()); | |||
| File f = getProject().resolveFile(tok.nextToken()); | |||
| if (f.exists()) { | |||
| target.append(File.pathSeparator); | |||
| @@ -151,7 +151,7 @@ public class RenameExtensions extends MatchingTask { | |||
| log("using the same patterns on <fileset> as you\'ve used here", | |||
| Project.MSG_INFO); | |||
| Move move = (Move) project.createTask("move"); | |||
| Move move = (Move) getProject().createTask("move"); | |||
| move.setOwningTarget(target); | |||
| move.setTaskName(getTaskName()); | |||
| move.setLocation(getLocation()); | |||
| @@ -285,10 +285,10 @@ public class ReplaceRegExp extends Task { | |||
| String input, | |||
| int options) { | |||
| String res = input; | |||
| Regexp regexp = r.getRegexp(project); | |||
| Regexp regexp = r.getRegexp(getProject()); | |||
| if (regexp.matches(input, options)) { | |||
| res = regexp.substitute(input, s.getExpression(project), options); | |||
| res = regexp.substitute(input, s.getExpression(getProject()), options); | |||
| } | |||
| return res; | |||
| @@ -314,8 +314,8 @@ public class ReplaceRegExp extends Task { | |||
| boolean changes = false; | |||
| log("Replacing pattern '" + regex.getPattern(project) + | |||
| "' with '" + subs.getExpression(project) + | |||
| log("Replacing pattern '" + regex.getPattern(getProject()) + | |||
| "' with '" + subs.getExpression(getProject()) + | |||
| "' in '" + f.getPath() + "'" + | |||
| (byline ? " by line" : "") + | |||
| (flags.length() > 0 ? " with flags: '" + flags + "'" : "") + | |||
| @@ -169,9 +169,9 @@ public class Rpm extends Task { | |||
| Execute exe = new Execute(streamhandler, null); | |||
| exe.setAntRun(project); | |||
| exe.setAntRun(getProject()); | |||
| if (topDir == null) { | |||
| topDir = project.getBaseDir(); | |||
| topDir = getProject().getBaseDir(); | |||
| } | |||
| exe.setWorkingDirectory(topDir); | |||
| @@ -111,10 +111,10 @@ public class Script extends Task { | |||
| */ | |||
| public void execute() throws BuildException { | |||
| try { | |||
| addBeans(project.getProperties()); | |||
| addBeans(project.getUserProperties()); | |||
| addBeans(project.getTargets()); | |||
| addBeans(project.getReferences()); | |||
| addBeans(getProject().getProperties()); | |||
| addBeans(getProject().getUserProperties()); | |||
| addBeans(getProject().getTargets()); | |||
| addBeans(getProject().getReferences()); | |||
| beans.put("project", getProject()); | |||
| @@ -56,9 +56,6 @@ package org.apache.tools.ant.taskdefs.optional; | |||
| import java.io.File; | |||
| import java.io.FileReader; | |||
| import java.io.IOException; | |||
| import java.io.FileInputStream; | |||
| import java.io.FileNotFoundException; | |||
| import java.io.InputStream; | |||
| import java.net.MalformedURLException; | |||
| import java.net.URL; | |||
| import java.util.Vector; | |||
| @@ -163,7 +160,7 @@ public class XMLValidateTask extends Task { | |||
| * or SAX2 <code>org.xml.sax.Parser</code>. | |||
| * <p> if className is an implementation of <code>org.xml.sax.Parser</code>, {@link #setLenient(boolean)}, | |||
| * will be ignored. | |||
| * <p> if not set, the default {@link #DEFAULT_XML_READER_CLASSNAME} will be used. | |||
| * <p> if not set, the default will be used. | |||
| * @see org.xml.sax.XMLReader | |||
| * @see org.xml.sax.Parser | |||
| */ | |||
| @@ -190,7 +187,7 @@ public class XMLValidateTask extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (this.classpath == null) { | |||
| this.classpath = new Path(project); | |||
| this.classpath = new Path(getProject()); | |||
| } | |||
| return this.classpath.createPath(); | |||
| } | |||
| @@ -226,7 +223,7 @@ public class XMLValidateTask extends Task { | |||
| public void init() throws BuildException { | |||
| super.init(); | |||
| xmlCatalog.setProject(project); | |||
| xmlCatalog.setProject(getProject()); | |||
| } | |||
| /** | |||
| @@ -270,11 +267,11 @@ public class XMLValidateTask extends Task { | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] files = ds.getIncludedFiles(); | |||
| for (int j = 0; j < files.length ; j++) { | |||
| File srcFile = new File(fs.getDir(project), files[j]); | |||
| File srcFile = new File(fs.getDir(getProject()), files[j]); | |||
| doValidate(srcFile); | |||
| fileProcessed++; | |||
| } | |||
| @@ -301,7 +298,7 @@ public class XMLValidateTask extends Task { | |||
| try { | |||
| // load the parser class | |||
| if (classpath != null) { | |||
| AntClassLoader loader = new AntClassLoader(project, classpath); | |||
| AntClassLoader loader = new AntClassLoader(getProject(), classpath); | |||
| readerClass = loader.loadClass(readerClassName); | |||
| AntClassLoader.initializeClass(readerClass); | |||
| } else { | |||
| @@ -103,7 +103,7 @@ public abstract class Continuus extends Task { | |||
| * @param dir the directory containing the ccm executable | |||
| */ | |||
| public final void setCcmDir(String dir) { | |||
| ccmDir = project.translatePath(dir); | |||
| ccmDir = getProject().translatePath(dir); | |||
| } | |||
| /** | |||
| @@ -87,7 +87,7 @@ public abstract class ClearCase extends Task { | |||
| * @param dir the directory containing the cleartool executable | |||
| */ | |||
| public final void setClearToolDir(String dir) { | |||
| m_ClearToolDir = project.translatePath(dir); | |||
| m_ClearToolDir = getProject().translatePath(dir); | |||
| } | |||
| /** | |||
| @@ -179,7 +179,7 @@ public class Depend extends MatchingTask { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (dependClasspath == null) { | |||
| dependClasspath = new Path(project); | |||
| dependClasspath = new Path(getProject()); | |||
| } | |||
| return dependClasspath.createPath(); | |||
| } | |||
| @@ -588,7 +588,7 @@ public class Depend extends MatchingTask { | |||
| private void determineOutOfDateClasses() { | |||
| outOfDateClasses = new Hashtable(); | |||
| for (int i = 0; i < srcPathList.length; i++) { | |||
| File srcDir = (File) project.resolveFile(srcPathList[i]); | |||
| File srcDir = (File) getProject().resolveFile(srcPathList[i]); | |||
| if (srcDir.exists()) { | |||
| DirectoryScanner ds = this.getDirectoryScanner(srcDir); | |||
| String[] files = ds.getIncludedFiles(); | |||
| @@ -315,12 +315,6 @@ public class CSharp | |||
| */ | |||
| private File srcDir; | |||
| /** | |||
| * destination directory (null means use the source directory) NB: this is | |||
| * currently not used | |||
| */ | |||
| private File destDir; | |||
| /** | |||
| * type of target. Should be one of exe|library|module|winexe|(null) | |||
| * default is exe; the actual value (if not null) is fed to the command | |||
| @@ -389,7 +383,7 @@ public class CSharp | |||
| public void setReferenceFiles(Path path) { | |||
| //demand create pathlist | |||
| if (referenceFiles == null) { | |||
| referenceFiles = new Path(this.project); | |||
| referenceFiles = new Path(this.getProject()); | |||
| } | |||
| referenceFiles.append(path); | |||
| } | |||
| @@ -734,7 +728,7 @@ public class CSharp | |||
| *@param dirName The new DestDir value | |||
| */ | |||
| public void setDestDir(File dirName) { | |||
| this.destDir = dirName; | |||
| log( "DestDir currently unused", Project.MSG_WARN ); | |||
| } | |||
| @@ -1021,7 +1015,6 @@ public class CSharp | |||
| targetType = null; | |||
| win32icon = null; | |||
| srcDir = null; | |||
| destDir = null; | |||
| mainClass = null; | |||
| unsafe = false; | |||
| warnLevel = 3; | |||
| @@ -1069,7 +1062,7 @@ public class CSharp | |||
| public void execute() | |||
| throws BuildException { | |||
| if (srcDir == null) { | |||
| srcDir = project.resolveFile("."); | |||
| srcDir = getProject().resolveFile("."); | |||
| } | |||
| log("CSC working from source directory " + srcDir, Project.MSG_VERBOSE); | |||
| validate(); | |||
| @@ -1113,7 +1106,6 @@ public class CSharp | |||
| DirectoryScanner scanner = super.getDirectoryScanner(srcDir); | |||
| String[] dependencies = scanner.getIncludedFiles(); | |||
| log("compiling " + dependencies.length + " file" + ((dependencies.length == 1) ? "" : "s")); | |||
| String baseDir = scanner.getBasedir().toString(); | |||
| File base = scanner.getBasedir(); | |||
| //add to the command | |||
| for (int i = 0; i < dependencies.length; i++) { | |||
| @@ -492,7 +492,7 @@ public class Ilasm | |||
| public void execute() | |||
| throws BuildException { | |||
| if (srcDir == null) { | |||
| srcDir = project.resolveFile("."); | |||
| srcDir = getProject().resolveFile("."); | |||
| } | |||
| //get dependencies list. | |||
| @@ -146,7 +146,7 @@ public class BorlandGenerateClient extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (this.classpath == null) { | |||
| this.classpath = new Path(project); | |||
| this.classpath = new Path(getProject()); | |||
| } | |||
| return this.classpath.createPath(); | |||
| } | |||
| @@ -125,14 +125,14 @@ public class DDCreator extends MatchingTask { | |||
| } | |||
| String systemClassPath = System.getProperty("java.class.path"); | |||
| String execClassPath = project.translatePath(systemClassPath + ":" + classpath); | |||
| Java ddCreatorTask = (Java) project.createTask("java"); | |||
| String execClassPath = getProject().translatePath(systemClassPath + ":" + classpath); | |||
| Java ddCreatorTask = (Java) getProject().createTask("java"); | |||
| ddCreatorTask.setTaskName(getTaskName()); | |||
| ddCreatorTask.setFork(true); | |||
| ddCreatorTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.DDCreatorHelper"); | |||
| Commandline.Argument arguments = ddCreatorTask.createArg(); | |||
| arguments.setLine(args); | |||
| ddCreatorTask.setClasspath(new Path(project, execClassPath)); | |||
| ddCreatorTask.setClasspath(new Path(getProject(), execClassPath)); | |||
| if (ddCreatorTask.executeJava() != 0) { | |||
| throw new BuildException("Execution of ddcreator helper failed"); | |||
| } | |||
| @@ -165,6 +165,6 @@ public class DDCreator extends MatchingTask { | |||
| * @param s the classpath to use for the ddcreator tool. | |||
| */ | |||
| public void setClasspath(String s) { | |||
| this.classpath = project.translatePath(s); | |||
| this.classpath = getProject().translatePath(s); | |||
| } | |||
| } | |||
| @@ -336,7 +336,7 @@ public class EjbJar extends MatchingTask { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (config.classpath == null) { | |||
| config.classpath = new Path(project); | |||
| config.classpath = new Path(getProject()); | |||
| } | |||
| return config.classpath.createPath(); | |||
| } | |||
| @@ -131,14 +131,14 @@ public class Ejbc extends MatchingTask { | |||
| } | |||
| String systemClassPath = System.getProperty("java.class.path"); | |||
| String execClassPath = project.translatePath(systemClassPath + ":" + classpath + | |||
| String execClassPath = getProject().translatePath(systemClassPath + ":" + classpath + | |||
| ":" + generatedFilesDirectory); | |||
| // get all the files in the descriptor directory | |||
| DirectoryScanner ds = super.getDirectoryScanner(descriptorDirectory); | |||
| String[] files = ds.getIncludedFiles(); | |||
| Java helperTask = (Java) project.createTask("java"); | |||
| Java helperTask = (Java) getProject().createTask("java"); | |||
| helperTask.setTaskName(getTaskName()); | |||
| helperTask.setFork(true); | |||
| helperTask.setClassname("org.apache.tools.ant.taskdefs.optional.ejb.EjbcHelper"); | |||
| @@ -155,7 +155,7 @@ public class Ejbc extends MatchingTask { | |||
| Commandline.Argument arguments = helperTask.createArg(); | |||
| arguments.setLine(args); | |||
| helperTask.setClasspath(new Path(project, execClassPath)); | |||
| helperTask.setClasspath(new Path(getProject(), execClassPath)); | |||
| if (helperTask.executeJava() != 0) { | |||
| throw new BuildException("Execution of ejbc helper failed"); | |||
| } | |||
| @@ -210,7 +210,7 @@ public class Ejbc extends MatchingTask { | |||
| * Set the classpath to be used for this compilation. | |||
| */ | |||
| public void setClasspath(String s) { | |||
| this.classpath = project.translatePath(s); | |||
| this.classpath = getProject().translatePath(s); | |||
| } | |||
| /** | |||
| @@ -184,7 +184,7 @@ public class IPlanetEjbcTask extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| classpath = new Path(project); | |||
| classpath = new Path(getProject()); | |||
| } | |||
| return classpath.createPath(); | |||
| } | |||
| @@ -149,7 +149,7 @@ public class WLRun extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| classpath = new Path(project); | |||
| classpath = new Path(getProject()); | |||
| } | |||
| return classpath.createPath(); | |||
| } | |||
| @@ -159,7 +159,7 @@ public class WLRun extends Task { | |||
| */ | |||
| public Path createWLClasspath() { | |||
| if (weblogicClasspath == null) { | |||
| weblogicClasspath = new Path(project); | |||
| weblogicClasspath = new Path(getProject()); | |||
| } | |||
| return weblogicClasspath.createPath(); | |||
| } | |||
| @@ -200,7 +200,7 @@ public class WLRun extends Task { | |||
| // If an explicit securityPolicy file was specified, it maybe an | |||
| // absolute path. Use the project to resolve it. | |||
| if (this.securityPolicy != null && !securityPolicyFile.exists()) { | |||
| securityPolicyFile = project.resolveFile(securityPolicy); | |||
| securityPolicyFile = getProject().resolveFile(securityPolicy); | |||
| } | |||
| // If we still can't find it, complain | |||
| if (!securityPolicyFile.exists()) { | |||
| @@ -229,7 +229,7 @@ public class WLRun extends Task { | |||
| throw new BuildException("You must supply a management password to start the server"); | |||
| } | |||
| Java weblogicServer = (Java) project.createTask("java"); | |||
| Java weblogicServer = (Java) getProject().createTask("java"); | |||
| weblogicServer.setTaskName(getTaskName()); | |||
| weblogicServer.setFork(true); | |||
| weblogicServer.setDir(weblogicSystemHome); | |||
| @@ -275,7 +275,7 @@ public class WLRun extends Task { | |||
| propertiesFile = new File(weblogicSystemHome, weblogicPropertiesFile); | |||
| if (!propertiesFile.exists()) { | |||
| // OK, properties file may be absolute | |||
| propertiesFile = project.resolveFile(weblogicPropertiesFile); | |||
| propertiesFile = getProject().resolveFile(weblogicPropertiesFile); | |||
| if (!propertiesFile.exists()) { | |||
| throw new BuildException("Properties file " + weblogicPropertiesFile + | |||
| " not found in weblogic home " + weblogicSystemHome + | |||
| @@ -283,7 +283,7 @@ public class WLRun extends Task { | |||
| } | |||
| } | |||
| Java weblogicServer = (Java) project.createTask("java"); | |||
| Java weblogicServer = (Java) getProject().createTask("java"); | |||
| weblogicServer.setTaskName(getTaskName()); | |||
| weblogicServer.setFork(true); | |||
| weblogicServer.setClassname(weblogicMainClass); | |||
| @@ -117,7 +117,7 @@ public class WLStop extends Task { | |||
| throw new BuildException("The url of the weblogic server must be provided."); | |||
| } | |||
| Java weblogicAdmin = (Java) project.createTask("java"); | |||
| Java weblogicAdmin = (Java) getProject().createTask("java"); | |||
| weblogicAdmin.setFork(true); | |||
| weblogicAdmin.setClassname("weblogic.Admin"); | |||
| String args; | |||
| @@ -152,7 +152,7 @@ public class WLStop extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| classpath = new Path(project); | |||
| classpath = new Path(getProject()); | |||
| } | |||
| return classpath.createPath(); | |||
| } | |||
| @@ -131,10 +131,6 @@ public class Translate extends MatchingTask { | |||
| * Holds key value pairs loaded from resource bundle file | |||
| */ | |||
| private Hashtable resourceMap = new Hashtable(); | |||
| /** | |||
| * Generated locale based on user attributes | |||
| */ | |||
| private Locale locale; | |||
| /** | |||
| * Used to resolve file names. | |||
| */ | |||
| @@ -286,8 +282,6 @@ public class Translate extends MatchingTask { | |||
| bundleCountry = Locale.getDefault().getCountry(); | |||
| } | |||
| locale = new Locale(bundleLanguage, bundleCountry); | |||
| if (bundleVariant == null) { | |||
| Locale l = new Locale(bundleLanguage, bundleCountry); | |||
| bundleVariant = l.getVariant(); | |||
| @@ -488,7 +482,7 @@ public class Translate extends MatchingTask { | |||
| private void translate() throws BuildException { | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| for (int j = 0; j < srcFiles.length; j++) { | |||
| try { | |||
| @@ -194,7 +194,7 @@ public class VAJImport extends VAJTask { | |||
| * Workspace. | |||
| */ | |||
| protected void importFileset(FileSet fileset) { | |||
| DirectoryScanner ds = fileset.getDirectoryScanner(this.project); | |||
| DirectoryScanner ds = fileset.getDirectoryScanner(this.getProject()); | |||
| if (ds.getIncludedFiles().length == 0) { | |||
| return; | |||
| } | |||
| @@ -237,12 +237,12 @@ public class JJTree extends Task { | |||
| targetName.substring(0, targetName.indexOf(".jjt")) + ".jj"); | |||
| if (javaFile.exists() | |||
| && target.lastModified() < javaFile.lastModified()) { | |||
| project.log("Target is already built - skipping (" + target + ")"); | |||
| getProject().log("Target is already built - skipping (" + target + ")"); | |||
| return; | |||
| } | |||
| cmdl.createArgument().setValue(target.getAbsolutePath()); | |||
| final Path classpath = cmdl.createClasspath(project); | |||
| final Path classpath = cmdl.createClasspath(getProject()); | |||
| final File javaccJar = JavaCC.getArchiveFile(javaccHome); | |||
| classpath.createPathElement().setPath(javaccJar.getAbsolutePath()); | |||
| classpath.addJavaRuntime(); | |||
| @@ -309,7 +309,7 @@ public class JavaCC extends Task { | |||
| } | |||
| cmdl.createArgument().setValue(target.getAbsolutePath()); | |||
| final Path classpath = cmdl.createClasspath(project); | |||
| final Path classpath = cmdl.createClasspath(getProject()); | |||
| final File javaccJar = JavaCC.getArchiveFile(javaccHome); | |||
| classpath.createPathElement().setPath(javaccJar.getAbsolutePath()); | |||
| classpath.addJavaRuntime(); | |||
| @@ -170,7 +170,7 @@ public class JDependTask extends Task { | |||
| */ | |||
| public Path createSourcespath() { | |||
| if (_sourcesPath == null) { | |||
| _sourcesPath = new Path(project); | |||
| _sourcesPath = new Path(getProject()); | |||
| } | |||
| return _sourcesPath.createPath(); | |||
| } | |||
| @@ -214,7 +214,7 @@ public class JDependTask extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (_compileClasspath == null) { | |||
| _compileClasspath = new Path(project); | |||
| _compileClasspath = new Path(getProject()); | |||
| } | |||
| return _compileClasspath.createPath(); | |||
| } | |||
| @@ -284,7 +284,6 @@ public class JDependTask extends Task { | |||
| // execute the test and get the return code | |||
| int exitValue = JDependTask.ERRORS; | |||
| boolean wasKilled = false; | |||
| if (!getFork()) { | |||
| exitValue = executeInVM(commandline); | |||
| } else { | |||
| @@ -417,7 +416,7 @@ public class JDependTask extends Task { | |||
| execute.setCommandline(commandline.getCommandline()); | |||
| if (getDir() != null) { | |||
| execute.setWorkingDirectory(getDir()); | |||
| execute.setAntRun(project); | |||
| execute.setAntRun(getProject()); | |||
| } | |||
| if (getOutputFile() != null) { | |||
| @@ -133,13 +133,6 @@ public class JspC extends MatchingTask { | |||
| */ | |||
| protected boolean failOnError = true; | |||
| /** | |||
| * -uribase <dir> The uri directory compilations should be relative to | |||
| * (Default is "/") | |||
| */ | |||
| private File uribase; | |||
| /** | |||
| * -uriroot <dir> The root directory that uri files should be resolved | |||
| * against, | |||
| @@ -258,7 +251,7 @@ public class JspC extends MatchingTask { | |||
| * @param uribase The new Uribase value | |||
| */ | |||
| public void setUribase(File uribase) { | |||
| this.uribase = uribase; | |||
| log( "Uribase is currently an unused parameter", Project.MSG_WARN); | |||
| } | |||
| public File getUribase() { | |||
| @@ -297,7 +290,7 @@ public class JspC extends MatchingTask { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classpath == null) { | |||
| classpath = new Path(project); | |||
| classpath = new Path(getProject()); | |||
| } | |||
| return classpath.createPath(); | |||
| } | |||
| @@ -336,7 +329,7 @@ public class JspC extends MatchingTask { | |||
| */ | |||
| public Path createCompilerclasspath() { | |||
| if (compilerClasspath == null) { | |||
| compilerClasspath = new Path(project); | |||
| compilerClasspath = new Path(getProject()); | |||
| } | |||
| return compilerClasspath.createPath(); | |||
| } | |||
| @@ -445,7 +438,7 @@ public class JspC extends MatchingTask { | |||
| resetFileLists(); | |||
| int filecount = 0; | |||
| for (int i = 0; i < list.length; i++) { | |||
| File srcDir = (File) project.resolveFile(list[i]); | |||
| File srcDir = (File) getProject().resolveFile(list[i]); | |||
| if (!srcDir.exists()) { | |||
| throw new BuildException("srcdir \"" + srcDir.getPath() + | |||
| "\" does not exist!", location); | |||
| @@ -599,7 +592,6 @@ public class JspC extends MatchingTask { | |||
| } | |||
| String javaFileName = mangler.mapJspToJavaName(srcFile); | |||
| // String srcFileDir=srcFile.getParent(); | |||
| String packageNameIn = srcFile.getAbsolutePath(); | |||
| return new File(dest, javaFileName); | |||
| } | |||
| @@ -143,16 +143,14 @@ public class WLJspc extends MatchingTask { | |||
| } | |||
| String systemClassPath = System.getProperty("java.class.path"); | |||
| pathToPackage | |||
| pathToPackage | |||
| = this.destinationPackage.replace('.', File.separatorChar); | |||
| // get all the files in the sourceDirectory | |||
| DirectoryScanner ds = super.getDirectoryScanner(sourceDirectory); | |||
| //use the systemclasspath as well, to include the ant jar | |||
| if (compileClasspath == null) { | |||
| compileClasspath = new Path(project); | |||
| compileClasspath = new Path(getProject()); | |||
| } | |||
| compileClasspath.append(Path.systemClasspath); | |||
| @@ -162,7 +160,7 @@ public class WLJspc extends MatchingTask { | |||
| // Therefore, takes loads of time | |||
| // Can pass directories at a time (*.jsp) but easily runs out of memory on hefty dirs | |||
| // (even on a Sun) | |||
| Java helperTask = (Java) project.createTask("java"); | |||
| Java helperTask = (Java) getProject().createTask("java"); | |||
| helperTask.setFork(true); | |||
| helperTask.setClassname("weblogic.jspc"); | |||
| helperTask.setTaskName(getTaskName()); | |||
| @@ -245,7 +243,7 @@ public class WLJspc extends MatchingTask { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (compileClasspath == null) { | |||
| compileClasspath = new Path(project); | |||
| compileClasspath = new Path(getProject()); | |||
| } | |||
| return compileClasspath; | |||
| } | |||
| @@ -297,8 +295,7 @@ public class WLJspc extends MatchingTask { | |||
| // Can be written better... this is too hacky! | |||
| jspFile = new File(files[i]); | |||
| parents = jspFile.getParent(); | |||
| int loc = 0; | |||
| if ((parents != null) && (!("").equals(parents))) { | |||
| parents = this.replaceString(parents, File.separator, "_/"); | |||
| pack = pathToPackage + File.separator + "_" + parents; | |||
| @@ -406,7 +406,7 @@ public class JUnitTask extends Task { | |||
| * @since Ant 1.2 | |||
| */ | |||
| public Path createClasspath() { | |||
| return commandline.createClasspath(project).createPath(); | |||
| return commandline.createClasspath(getProject()).createPath(); | |||
| } | |||
| /** | |||
| @@ -451,7 +451,7 @@ public class JUnitTask extends Task { | |||
| * @since Ant 1.2 | |||
| */ | |||
| public BatchTest createBatchTest() { | |||
| BatchTest test = new BatchTest(project); | |||
| BatchTest test = new BatchTest(getProject()); | |||
| batchTests.addElement(test); | |||
| return test; | |||
| } | |||
| @@ -523,7 +523,7 @@ public class JUnitTask extends Task { | |||
| Enumeration list = getIndividualTests(); | |||
| while (list.hasMoreElements()) { | |||
| JUnitTest test = (JUnitTest) list.nextElement(); | |||
| if (test.shouldRun(project)) { | |||
| if (test.shouldRun(getProject())) { | |||
| execute(test); | |||
| } | |||
| } | |||
| @@ -537,7 +537,7 @@ public class JUnitTask extends Task { | |||
| // set the default values if not specified | |||
| //@todo should be moved to the test class instead. | |||
| if (test.getTodir() == null) { | |||
| test.setTodir(project.resolveFile(".")); | |||
| test.setTodir(getProject().resolveFile(".")); | |||
| } | |||
| if (test.getOutfile() == null) { | |||
| @@ -571,10 +571,10 @@ public class JUnitTask extends Task { | |||
| log("TEST " + test.getName() + " FAILED" | |||
| + (wasKilled ? " (timeout)" : ""), Project.MSG_ERR); | |||
| if (errorOccurredHere && test.getErrorProperty() != null) { | |||
| project.setNewProperty(test.getErrorProperty(), "true"); | |||
| getProject().setNewProperty(test.getErrorProperty(), "true"); | |||
| } | |||
| if (failureOccurredHere && test.getFailureProperty() != null) { | |||
| project.setNewProperty(test.getFailureProperty(), "true"); | |||
| getProject().setNewProperty(test.getFailureProperty(), "true"); | |||
| } | |||
| } | |||
| } | |||
| @@ -635,10 +635,10 @@ public class JUnitTask extends Task { | |||
| // forked test | |||
| File propsFile = | |||
| FileUtils.newFileUtils().createTempFile("junit", ".properties", | |||
| project.getBaseDir()); | |||
| getProject().getBaseDir()); | |||
| cmd.createArgument().setValue("propsfile=" | |||
| + propsFile.getAbsolutePath()); | |||
| Hashtable p = project.getProperties(); | |||
| Hashtable p = getProject().getProperties(); | |||
| Properties props = new Properties(); | |||
| for (Enumeration enum = p.keys(); enum.hasMoreElements();) { | |||
| Object key = enum.nextElement(); | |||
| @@ -659,7 +659,7 @@ public class JUnitTask extends Task { | |||
| Project.MSG_WARN), | |||
| watchdog); | |||
| execute.setCommandline(cmd.getCommandline()); | |||
| execute.setAntRun(project); | |||
| execute.setAntRun(getProject()); | |||
| if (dir != null) { | |||
| execute.setWorkingDirectory(dir); | |||
| } | |||
| @@ -734,7 +734,7 @@ public class JUnitTask extends Task { | |||
| */ | |||
| private int executeInVM(JUnitTest arg) throws BuildException { | |||
| JUnitTest test = (JUnitTest) arg.clone(); | |||
| test.setProperties(project.getProperties()); | |||
| test.setProperties(getProject().getProperties()); | |||
| if (dir != null) { | |||
| log("dir attribute ignored if running in the same VM", | |||
| Project.MSG_WARN); | |||
| @@ -765,7 +765,7 @@ public class JUnitTask extends Task { | |||
| classpath.append(antRuntimeClasses); | |||
| } | |||
| cl = new AntClassLoader(null, project, classpath, false); | |||
| cl = new AntClassLoader(null, getProject(), classpath, false); | |||
| log("Using CLASSPATH " + cl.getClasspath(), | |||
| Project.MSG_VERBOSE); | |||
| @@ -882,7 +882,7 @@ public class JUnitTask extends Task { | |||
| String filename = test.getOutfile() + fe.getExtension(); | |||
| File destFile = new File(test.getTodir(), filename); | |||
| String absFilename = destFile.getAbsolutePath(); | |||
| return project.resolveFile(absFilename); | |||
| return getProject().resolveFile(absFilename); | |||
| } | |||
| return null; | |||
| } | |||
| @@ -187,7 +187,7 @@ public class XMLResultAggregator extends Task implements XMLConstants { | |||
| toFile = DEFAULT_FILENAME; | |||
| } | |||
| if (toDir == null){ | |||
| toDir = project.resolveFile(DEFAULT_DIR); | |||
| toDir = getProject().resolveFile(DEFAULT_DIR); | |||
| } | |||
| return new File(toDir, toFile); | |||
| } | |||
| @@ -202,14 +202,14 @@ public class XMLResultAggregator extends Task implements XMLConstants { | |||
| final int size = filesets.size(); | |||
| for (int i = 0; i < size; i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| ds.scan(); | |||
| String[] f = ds.getIncludedFiles(); | |||
| for (int j = 0; j < f.length; j++) { | |||
| String pathname = f[j]; | |||
| if (pathname.endsWith(".xml")) { | |||
| File file = new File(ds.getBasedir(), pathname); | |||
| file = project.resolveFile(file.getPath()); | |||
| file = getProject().resolveFile(file.getPath()); | |||
| v.addElement(file); | |||
| } | |||
| } | |||
| @@ -144,7 +144,7 @@ public abstract class AbstractMetamataTask extends Task { | |||
| */ | |||
| public Path createClasspath() { | |||
| if (classPath == null) { | |||
| classPath = new Path(project); | |||
| classPath = new Path(getProject()); | |||
| } | |||
| return classPath; | |||
| } | |||
| @@ -155,7 +155,7 @@ public abstract class AbstractMetamataTask extends Task { | |||
| */ | |||
| public Path createSourcepath() { | |||
| if (sourcePath == null) { | |||
| sourcePath = new Path(project); | |||
| sourcePath = new Path(getProject()); | |||
| } | |||
| return sourcePath; | |||
| } | |||
| @@ -212,7 +212,7 @@ public abstract class AbstractMetamataTask extends Task { | |||
| // set the classpath as the jar file | |||
| File jar = getMetamataJar(metamataHome); | |||
| final Path classPath = cmdl.createClasspath(project); | |||
| final Path classPath = cmdl.createClasspath(getProject()); | |||
| classPath.createPathElement().setLocation(jar); | |||
| // set the metamata.home property | |||
| @@ -332,7 +332,7 @@ public abstract class AbstractMetamataTask extends Task { | |||
| Hashtable files = new Hashtable(); | |||
| for (int i = 0; i < fileSets.size(); i++) { | |||
| FileSet fs = (FileSet) fileSets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| ds.scan(); | |||
| String[] f = ds.getIncludedFiles(); | |||
| log(i + ") Adding " + f.length + " files from directory " + ds.getBasedir(), Project.MSG_VERBOSE); | |||
| @@ -161,7 +161,7 @@ Format Options | |||
| */ | |||
| public Path createPath() { | |||
| if (path == null) { | |||
| path = new Path(project); | |||
| path = new Path(getProject()); | |||
| } | |||
| return path; | |||
| @@ -144,7 +144,7 @@ public class MParse extends AbstractMetamataTask { | |||
| // set the classpath as the jar files | |||
| File[] jars = getMetamataLibs(); | |||
| final Path classPath = cmdl.createClasspath(project); | |||
| final Path classPath = cmdl.createClasspath(getProject()); | |||
| for (int i = 0; i < jars.length; i++){ | |||
| classPath.createPathElement().setLocation(jars[i]); | |||
| } | |||
| @@ -175,7 +175,7 @@ public class MParse extends AbstractMetamataTask { | |||
| pathname = pathname.substring(0, pos) + ".java"; | |||
| File javaFile = new File(pathname); | |||
| if (javaFile.exists() && target.lastModified() < javaFile.lastModified()) { | |||
| project.log("Target is already build - skipping (" + target + ")"); | |||
| getProject().log("Target is already build - skipping (" + target + ")"); | |||
| return; | |||
| } | |||
| @@ -203,7 +203,7 @@ public class MParse extends AbstractMetamataTask { | |||
| name = "__jj" + name.substring(0, pos) + ".sunjj"; | |||
| final File sunjj = new File(target.getParent(), name); | |||
| if (sunjj.exists()) { | |||
| project.log("Removing stale file: " + sunjj.getName()); | |||
| getProject().log("Removing stale file: " + sunjj.getName()); | |||
| sunjj.delete(); | |||
| } | |||
| } | |||
| @@ -236,7 +236,7 @@ public class MParse extends AbstractMetamataTask { | |||
| if (metamataHome == null || !metamataHome.exists()){ | |||
| throw new BuildException("'metamatahome' must point to Metamata home directory."); | |||
| } | |||
| metamataHome = project.resolveFile(metamataHome.getPath()); | |||
| metamataHome = getProject().resolveFile(metamataHome.getPath()); | |||
| // check that the needed jar exists. | |||
| File[] jars = getMetamataLibs(); | |||
| @@ -252,7 +252,7 @@ public class MParse extends AbstractMetamataTask { | |||
| || !target.getName().endsWith(".jj")) { | |||
| throw new BuildException("Invalid target: " + target); | |||
| } | |||
| target = project.resolveFile(target.getPath()); | |||
| target = getProject().resolveFile(target.getPath()); | |||
| } | |||
| /** | |||
| @@ -471,10 +471,10 @@ public class FTP | |||
| FileScanner ds; | |||
| if (action == SEND_FILES) { | |||
| ds = fs.getDirectoryScanner(project); | |||
| ds = fs.getDirectoryScanner(getProject()); | |||
| } else { | |||
| ds = new FTPDirectoryScanner(ftp); | |||
| fs.setupDirectoryScanner(ds, project); | |||
| fs.setupDirectoryScanner(ds, getProject()); | |||
| ds.scan(); | |||
| } | |||
| @@ -704,7 +704,7 @@ public class FTP | |||
| try { | |||
| // XXX - why not simply new File(dir, filename)? | |||
| File file = project.resolveFile(new File(dir, filename).getPath()); | |||
| File file = getProject().resolveFile(new File(dir, filename).getPath()); | |||
| if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) { | |||
| return; | |||
| @@ -790,7 +790,7 @@ public class FTP | |||
| OutputStream outstream = null; | |||
| try { | |||
| File file = project.resolveFile(new File(dir, filename).getPath()); | |||
| File file = getProject().resolveFile(new File(dir, filename).getPath()); | |||
| if (newerOnly && isUpToDate(ftp, file, resolveFile(filename))) { | |||
| return; | |||
| @@ -134,7 +134,7 @@ public class P4Add extends P4Base { | |||
| for (int i = 0; i < filesets.size(); i++) { | |||
| FileSet fs = (FileSet) filesets.elementAt(i); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(project); | |||
| DirectoryScanner ds = fs.getDirectoryScanner(getProject()); | |||
| //File fromDir = fs.getDir(project); | |||
| String[] srcFiles = ds.getIncludedFiles(); | |||
| @@ -165,13 +165,13 @@ public abstract class P4Base extends org.apache.tools.ant.Task { | |||
| //Get default P4 settings from environment - Mark would have done something cool with | |||
| //introspection here.....:-) | |||
| String tmpprop; | |||
| if ((tmpprop = project.getProperty("p4.port")) != null) { | |||
| if ((tmpprop = getProject().getProperty("p4.port")) != null) { | |||
| setPort(tmpprop); | |||
| } | |||
| if ((tmpprop = project.getProperty("p4.client")) != null) { | |||
| if ((tmpprop = getProject().getProperty("p4.client")) != null) { | |||
| setClient(tmpprop); | |||
| } | |||
| if ((tmpprop = project.getProperty("p4.user")) != null) { | |||
| if ((tmpprop = getProject().getProperty("p4.user")) != null) { | |||
| setUser(tmpprop); | |||
| } | |||
| } | |||
| @@ -182,7 +182,6 @@ public abstract class P4Base extends org.apache.tools.ant.Task { | |||
| /** Execute P4 command assembled by subclasses. | |||
| @param command The command to run | |||
| @param p4input Input to be fed to command on stdin | |||
| @param handler A P4Handler to process any input and output | |||
| */ | |||
| protected void execP4Command(String command, P4Handler handler) throws BuildException { | |||
| @@ -203,13 +202,6 @@ public abstract class P4Base extends org.apache.tools.ant.Task { | |||
| } | |||
| commandline.createArgument().setLine(command); | |||
| String[] cmdline = commandline.getCommandline(); | |||
| String cmdl = ""; | |||
| for (int i = 0; i < cmdline.length; i++) { | |||
| cmdl += cmdline[i] + " "; | |||
| } | |||
| log(commandline.describeCommand(), Project.MSG_VERBOSE); | |||
| if (handler == null) { | |||
| @@ -218,7 +210,7 @@ public abstract class P4Base extends org.apache.tools.ant.Task { | |||
| Execute exe = new Execute(handler, null); | |||
| exe.setAntRun(project); | |||
| exe.setAntRun(getProject()); | |||
| exe.setCommandline(commandline.getCommandline()); | |||
| @@ -87,7 +87,7 @@ public class P4Change extends P4Base { | |||
| if (emptyChangeList == null) { | |||
| emptyChangeList = getEmptyChangeList(); | |||
| } | |||
| final Project myProj = project; | |||
| final Project myProj = getProject(); | |||
| P4Handler handler = new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| @@ -139,7 +139,7 @@ public class P4Counter extends P4Base { | |||
| } | |||
| if (shouldSetProperty) { | |||
| final Project myProj = project; | |||
| final Project myProj = getProject(); | |||
| P4Handler handler = new P4HandlerAdapter() { | |||
| public void process(String line) { | |||
| @@ -184,7 +184,7 @@ public class CovMerge extends Task { | |||
| for (int j = 0; j < f.length; j++) { | |||
| String pathname = f[j]; | |||
| File file = new File(ds.getBasedir(), pathname); | |||
| file = project.resolveFile(file.getPath()); | |||
| file = getProject().resolveFile(file.getPath()); | |||
| v.addElement(file); | |||
| } | |||
| } | |||
| @@ -210,7 +210,7 @@ public class CovMerge extends Task { | |||
| pw.println(snapshots[i].getAbsolutePath()); | |||
| } | |||
| // last file is the output snapshot | |||
| pw.println(project.resolveFile(tofile.getPath())); | |||
| pw.println(getProject().resolveFile(tofile.getPath())); | |||
| pw.flush(); | |||
| } catch (IOException e) { | |||
| throw new BuildException("I/O error while writing to " + file, e); | |||
| @@ -228,7 +228,7 @@ public class CovReport extends Task { | |||
| */ | |||
| public Path createSourcepath() { | |||
| if (sourcePath == null) { | |||
| sourcePath = new Path(project); | |||
| sourcePath = new Path(getProject()); | |||
| } | |||
| return sourcePath.createPath(); | |||
| } | |||
| @@ -253,7 +253,7 @@ public class CovReport extends Task { | |||
| */ | |||
| public Path createCoveragepath() { | |||
| if (coveragePath == null) { | |||
| coveragePath = new Path(project); | |||
| coveragePath = new Path(getProject()); | |||
| } | |||
| return coveragePath.createPath(); | |||
| } | |||
| @@ -342,12 +342,12 @@ public class CovReport extends Task { | |||
| if (filters != null) { | |||
| v.addElement("-filters=" + filters); | |||
| } | |||
| v.addElement("-output=" + project.resolveFile(tofile.getPath())); | |||
| v.addElement("-snapshot=" + project.resolveFile(snapshot.getPath())); | |||
| v.addElement("-output=" + getProject().resolveFile(tofile.getPath())); | |||
| v.addElement("-snapshot=" + getProject().resolveFile(snapshot.getPath())); | |||
| // as a default -sourcepath use . in JProbe, so use project . | |||
| if (sourcePath == null) { | |||
| sourcePath = new Path(project); | |||
| sourcePath.createPath().setLocation(project.resolveFile(".")); | |||
| sourcePath = new Path(getProject()); | |||
| sourcePath.createPath().setLocation(getProject().resolveFile(".")); | |||
| } | |||
| v.addElement("-sourcepath=" + sourcePath); | |||
| @@ -297,7 +297,7 @@ public class Coverage extends Task { | |||
| * classpath to run the files. | |||
| */ | |||
| public Path createClasspath() { | |||
| return cmdlJava.createClasspath(project).createPath(); | |||
| return cmdlJava.createClasspath(getProject()).createPath(); | |||
| } | |||
| /** | |||
| @@ -370,14 +370,14 @@ public class Coverage extends Task { | |||
| if (snapshotDir == null) { | |||
| snapshotDir = new File("."); | |||
| } | |||
| snapshotDir = project.resolveFile(snapshotDir.getPath()); | |||
| snapshotDir = getProject().resolveFile(snapshotDir.getPath()); | |||
| if (!snapshotDir.isDirectory() || !snapshotDir.exists()) { | |||
| throw new BuildException("Snapshot directory does not exists :" + snapshotDir); | |||
| } | |||
| if (workingDir == null) { | |||
| workingDir = new File("."); | |||
| } | |||
| workingDir = project.resolveFile(workingDir.getPath()); | |||
| workingDir = getProject().resolveFile(workingDir.getPath()); | |||
| // check for info, do your best to select the java executable. | |||
| // JProbe 3.0 fails if there is no javaexe option. So | |||
| @@ -409,7 +409,7 @@ public class Coverage extends Task { | |||
| params.addElement("-jp_vm=" + vm); | |||
| } | |||
| if (javaExe != null) { | |||
| params.addElement("-jp_java_exe=" + project.resolveFile(javaExe.getPath())); | |||
| params.addElement("-jp_java_exe=" + getProject().resolveFile(javaExe.getPath())); | |||
| } | |||
| params.addElement("-jp_working_dir=" + workingDir.getPath()); | |||
| params.addElement("-jp_snapshot_dir=" + snapshotDir.getPath()); | |||
| @@ -455,10 +455,10 @@ public abstract class SOS extends Task { | |||
| */ | |||
| public String getLocalPath() { | |||
| if (localPath == null) { | |||
| return project.getBaseDir().getAbsolutePath(); | |||
| return getProject().getBaseDir().getAbsolutePath(); | |||
| } else { | |||
| // make sure localDir exists, create it if it doesn't | |||
| File dir = project.resolveFile(localPath); | |||
| File dir = getProject().resolveFile(localPath); | |||
| if (!dir.exists()) { | |||
| boolean done = dir.mkdirs(); | |||
| if (!done) { | |||
| @@ -466,7 +466,7 @@ public abstract class SOS extends Task { | |||
| "successful for an unknown reason"; | |||
| throw new BuildException(msg, location); | |||
| } | |||
| project.log("Created dir: " + dir.getAbsolutePath()); | |||
| getProject().log("Created dir: " + dir.getAbsolutePath()); | |||
| } | |||
| return dir.getAbsolutePath(); | |||
| } | |||
| @@ -486,8 +486,8 @@ public abstract class SOS extends Task { | |||
| Project.MSG_INFO, | |||
| Project.MSG_WARN)); | |||
| exe.setAntRun(project); | |||
| exe.setWorkingDirectory(project.getBaseDir()); | |||
| exe.setAntRun(getProject()); | |||
| exe.setWorkingDirectory(getProject().getBaseDir()); | |||
| exe.setCommandline(cmd.getCommandline()); | |||
| return exe.execute(); | |||
| } catch (java.io.IOException e) { | |||
| @@ -122,7 +122,7 @@ public abstract class MSVSS extends Task { | |||
| } | |||
| /** | |||
| * @return the appropriate login command if the 'login' attribute was specified, otherwise an empty string | |||
| * the appropriate login command if the 'login' attribute was specified, otherwise an empty string | |||
| */ | |||
| public void getLoginCommand(Commandline cmd) { | |||
| if (m_vssLogin == null) { | |||
| @@ -187,8 +187,8 @@ public abstract class MSVSS extends Task { | |||
| exe.setEnvironment(newEnv); | |||
| } | |||
| exe.setAntRun(project); | |||
| exe.setWorkingDirectory(project.getBaseDir()); | |||
| exe.setAntRun(getProject()); | |||
| exe.setWorkingDirectory(getProject().getBaseDir()); | |||
| exe.setCommandline(cmd.getCommandline()); | |||
| return exe.execute(); | |||
| } catch (java.io.IOException e) { | |||
| @@ -138,7 +138,7 @@ public class MSVSSCHECKIN extends MSVSS { | |||
| return; | |||
| } else { | |||
| // make sure m_LocalDir exists, create it if it doesn't | |||
| File dir = project.resolveFile(m_LocalPath); | |||
| File dir = getProject().resolveFile(m_LocalPath); | |||
| if (!dir.exists()) { | |||
| boolean done = dir.mkdirs(); | |||
| if (!done) { | |||
| @@ -147,7 +147,7 @@ public class MSVSSCHECKIN extends MSVSS { | |||
| + "succesful for an unknown reason"; | |||
| throw new BuildException(msg, location); | |||
| } | |||
| project.log("Created dir: " + dir.getAbsolutePath()); | |||
| getProject().log("Created dir: " + dir.getAbsolutePath()); | |||
| } | |||
| cmd.createArgument().setValue(FLAG_OVERRIDE_WORKING_DIR | |||
| @@ -164,7 +164,7 @@ public class MSVSSCHECKIN extends MSVSS { | |||
| } | |||
| /** | |||
| * @return the 'recursive' command if the attribute was 'true', otherwise an empty string | |||
| * the 'recursive' command if the attribute was 'true', otherwise an empty string | |||
| */ | |||
| public void getRecursiveCommand(Commandline cmd) { | |||
| if (!m_Recursive) { | |||
| @@ -182,7 +182,7 @@ public class MSVSSCHECKIN extends MSVSS { | |||
| } | |||
| /** | |||
| * @return the 'make writable' command if the attribute was 'true', otherwise an empty string | |||
| * the 'make writable' command if the attribute was 'true', otherwise an empty string | |||
| */ | |||
| public void getWritableCommand(Commandline cmd) { | |||
| if (!m_Writable) { | |||
| @@ -138,7 +138,7 @@ public class MSVSSCHECKOUT extends MSVSS { | |||
| return; | |||
| } else { | |||
| // make sure m_LocalDir exists, create it if it doesn't | |||
| File dir = project.resolveFile(m_LocalPath); | |||
| File dir = getProject().resolveFile(m_LocalPath); | |||
| if (!dir.exists()) { | |||
| boolean done = dir.mkdirs(); | |||
| if (!done) { | |||
| @@ -146,7 +146,7 @@ public class MSVSSCHECKOUT extends MSVSS { | |||
| "succesful for an unknown reason"; | |||
| throw new BuildException(msg, location); | |||
| } | |||
| project.log("Created dir: " + dir.getAbsolutePath()); | |||
| getProject().log("Created dir: " + dir.getAbsolutePath()); | |||
| } | |||
| cmd.createArgument().setValue(FLAG_OVERRIDE_WORKING_DIR + m_LocalPath); | |||
| @@ -162,7 +162,7 @@ public class MSVSSCHECKOUT extends MSVSS { | |||
| } | |||
| /** | |||
| * @return the 'recursive' command if the attribute was 'true', otherwise an empty string | |||
| * the 'recursive' command if the attribute was 'true', otherwise an empty string | |||
| */ | |||
| public void getRecursiveCommand(Commandline cmd) { | |||
| if (!m_Recursive) { | |||