git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268805 13f79535-47bb-0310-9956-ffa450edef68master
@@ -205,6 +205,7 @@ public class Ant extends Task { | |||||
// Are we trying to call the target in which we are defined? | // Are we trying to call the target in which we are defined? | ||||
if (p1.getBaseDir().equals(project.getBaseDir()) && | if (p1.getBaseDir().equals(project.getBaseDir()) && | ||||
p1.getProperty("ant.file").equals(project.getProperty("ant.file")) && | p1.getProperty("ant.file").equals(project.getProperty("ant.file")) && | ||||
getOwningTarget() != null && | |||||
target.equals(this.getOwningTarget().getName())) { | target.equals(this.getOwningTarget().getName())) { | ||||
throw new BuildException("ant task calling its own parent target"); | throw new BuildException("ant task calling its own parent target"); | ||||
@@ -82,6 +82,7 @@ public class CallTarget extends Task { | |||||
private Ant callee; | private Ant callee; | ||||
private String subTarget; | private String subTarget; | ||||
private boolean initialized = false; | |||||
public void init() { | public void init() { | ||||
callee = (Ant) project.createTask("ant"); | callee = (Ant) project.createTask("ant"); | ||||
@@ -89,9 +90,14 @@ public class CallTarget extends Task { | |||||
callee.setTaskName(getTaskName()); | callee.setTaskName(getTaskName()); | ||||
callee.setLocation(location); | callee.setLocation(location); | ||||
callee.init(); | callee.init(); | ||||
initialized = true; | |||||
} | } | ||||
public void execute() { | public void execute() { | ||||
if (!initialized) { | |||||
init(); | |||||
} | |||||
if (subTarget == null) { | if (subTarget == null) { | ||||
throw new BuildException("Attribute target is required.", | throw new BuildException("Attribute target is required.", | ||||
location); | location); | ||||