Browse Source

Add a Location member to oata.Target, with the appropriate settor & gettor.

PR:  28599


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276407 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 21 years ago
parent
commit
33ac6bc3ce
4 changed files with 26 additions and 4 deletions
  1. +2
    -0
      WHATSNEW
  2. +20
    -0
      src/main/org/apache/tools/ant/Target.java
  3. +2
    -0
      src/main/org/apache/tools/ant/helper/AntXMLContext.java
  4. +2
    -4
      src/main/org/apache/tools/ant/helper/ProjectHelper2.java

+ 2
- 0
WHATSNEW View File

@@ -157,6 +157,8 @@ Other changes:

* New attribute "negate" on <propertyset> to invert selection criteria.

* Target now supports a Location member. Bugzilla Report 28599.

Changes from Ant 1.6.0 to Ant 1.6.1
=============================================



+ 20
- 0
src/main/org/apache/tools/ant/Target.java View File

@@ -42,6 +42,8 @@ public class Target implements TaskContainer {
private List dependencies = null;
/** Children of this target (tasks and data types). */
private List children = new ArrayList();
/** Since Ant 1.6.2 */
private Location location = Location.UNKNOWN_LOCATION;

/** Project this target belongs to. */
private Project project;
@@ -73,6 +75,24 @@ public class Target implements TaskContainer {
return project;
}

/**
* Sets the location of this target's definition.
*
* @param location <CODE>Location</CODE>
*/
public void setLocation(Location location) {
this.location = location;
}

/**
* Get the location of this target's definition.
*
* @return <CODE>Location</CODE>
*/
public Location getLocation() {
return location;
}

/**
* Sets the list of targets this target is dependent on.
* The targets themselves are not resolved at this time.


+ 2
- 0
src/main/org/apache/tools/ant/helper/AntXMLContext.java View File

@@ -29,6 +29,7 @@ import org.xml.sax.Attributes;

import org.apache.tools.ant.Project;
import org.apache.tools.ant.Target;
import org.apache.tools.ant.Location;
import org.apache.tools.ant.RuntimeConfigurable;


@@ -109,6 +110,7 @@ public class AntXMLContext {
public void setBuildFile(File buildFile) {
this.buildFile = buildFile;
this.buildFileParent = new File(buildFile.getParent());
implicitTarget.setLocation(new Location(buildFile.getAbsolutePath()));
}

/**


+ 2
- 4
src/main/org/apache/tools/ant/helper/ProjectHelper2.java View File

@@ -757,6 +757,7 @@ public class ProjectHelper2 extends ProjectHelper {
Project project = context.getProject();
Target target = new Target();
target.setProject(project);
target.setLocation(new Location(context.getLocator()));
context.addTarget(target);

for (int i = 0; i < attrs.getLength(); i++) {
@@ -805,10 +806,7 @@ public class ProjectHelper2 extends ProjectHelper {
if (!context.isIgnoringProjectTag()) {
// not in an import'ed file
throw new BuildException(
"Duplicate target '" + name + "'",
new Location(context.getLocator().getSystemId(),
context.getLocator().getLineNumber(),
context.getLocator().getColumnNumber()));
"Duplicate target '" + name + "'", target.getLocation());
}
// Alter the name.
if (context.getCurrentProjectName() != null) {


Loading…
Cancel
Save