PR: 28599 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276407 13f79535-47bb-0310-9956-ffa450edef68master
@@ -157,6 +157,8 @@ Other changes: | |||||
* New attribute "negate" on <propertyset> to invert selection criteria. | * 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 | Changes from Ant 1.6.0 to Ant 1.6.1 | ||||
============================================= | ============================================= | ||||
@@ -42,6 +42,8 @@ public class Target implements TaskContainer { | |||||
private List dependencies = null; | private List dependencies = null; | ||||
/** Children of this target (tasks and data types). */ | /** Children of this target (tasks and data types). */ | ||||
private List children = new ArrayList(); | private List children = new ArrayList(); | ||||
/** Since Ant 1.6.2 */ | |||||
private Location location = Location.UNKNOWN_LOCATION; | |||||
/** Project this target belongs to. */ | /** Project this target belongs to. */ | ||||
private Project project; | private Project project; | ||||
@@ -73,6 +75,24 @@ public class Target implements TaskContainer { | |||||
return project; | 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. | * Sets the list of targets this target is dependent on. | ||||
* The targets themselves are not resolved at this time. | * The targets themselves are not resolved at this time. | ||||
@@ -29,6 +29,7 @@ import org.xml.sax.Attributes; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.Target; | import org.apache.tools.ant.Target; | ||||
import org.apache.tools.ant.Location; | |||||
import org.apache.tools.ant.RuntimeConfigurable; | import org.apache.tools.ant.RuntimeConfigurable; | ||||
@@ -109,6 +110,7 @@ public class AntXMLContext { | |||||
public void setBuildFile(File buildFile) { | public void setBuildFile(File buildFile) { | ||||
this.buildFile = buildFile; | this.buildFile = buildFile; | ||||
this.buildFileParent = new File(buildFile.getParent()); | this.buildFileParent = new File(buildFile.getParent()); | ||||
implicitTarget.setLocation(new Location(buildFile.getAbsolutePath())); | |||||
} | } | ||||
/** | /** | ||||
@@ -757,6 +757,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
Project project = context.getProject(); | Project project = context.getProject(); | ||||
Target target = new Target(); | Target target = new Target(); | ||||
target.setProject(project); | target.setProject(project); | ||||
target.setLocation(new Location(context.getLocator())); | |||||
context.addTarget(target); | context.addTarget(target); | ||||
for (int i = 0; i < attrs.getLength(); i++) { | for (int i = 0; i < attrs.getLength(); i++) { | ||||
@@ -805,10 +806,7 @@ public class ProjectHelper2 extends ProjectHelper { | |||||
if (!context.isIgnoringProjectTag()) { | if (!context.isIgnoringProjectTag()) { | ||||
// not in an import'ed file | // not in an import'ed file | ||||
throw new BuildException( | 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. | // Alter the name. | ||||
if (context.getCurrentProjectName() != null) { | if (context.getCurrentProjectName() != null) { | ||||