Browse Source

Adapt <ant> to the fact that <property> does its work in execute() and

not in init() now.

Make Microsoft's tools happy by not using "delegate" as a variable
name.

Improve handling of <ant>'s antfile attribute. This should work for
absolute paths now.


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267997 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 25 years ago
parent
commit
6c89d5a7b8
2 changed files with 16 additions and 13 deletions
  1. +5
    -2
      src/main/org/apache/tools/ant/taskdefs/Ant.java
  2. +11
    -11
      src/main/org/apache/tools/ant/taskdefs/CallTarget.java

+ 5
- 2
src/main/org/apache/tools/ant/taskdefs/Ant.java View File

@@ -170,13 +170,16 @@ public class Ant extends Task {
Enumeration e = properties.elements();
while (e.hasMoreElements()) {
Property p=(Property) e.nextElement();
p.init();
p.execute();
}
if (antFile == null)
antFile = "build.xml";

antFile = (new File(dir, antFile)).getAbsolutePath();
File file = new File(antFile);
if (!file.isAbsolute()) {
antFile = (new File(dir, antFile)).getAbsolutePath();
}

p1.setUserProperty( "ant.file" , antFile );
ProjectHelper.configureProject(p1, new File(antFile));


+ 11
- 11
src/main/org/apache/tools/ant/taskdefs/CallTarget.java View File

@@ -80,15 +80,15 @@ import org.apache.tools.ant.*;
*/
public class CallTarget extends Task {

private Ant delegate;
private Ant callee;
private String subTarget;

public void init() {
delegate = (Ant) project.createTask("ant");
delegate.setOwningTarget(target);
delegate.setTaskName(getTaskName());
delegate.setLocation(location);
delegate.init();
callee = (Ant) project.createTask("ant");
callee.setOwningTarget(target);
callee.setTaskName(getTaskName());
callee.setLocation(location);
callee.init();
}

public void execute() {
@@ -97,14 +97,14 @@ public class CallTarget extends Task {
location);
}
delegate.setDir(project.getBaseDir());
delegate.setAntfile(project.getProperty("ant.file"));
delegate.setTarget(subTarget);
delegate.execute();
callee.setDir(project.getBaseDir());
callee.setAntfile(project.getProperty("ant.file"));
callee.setTarget(subTarget);
callee.execute();
}

public Property createParam() {
return delegate.createProperty();
return callee.createProperty();
}

public void setTarget(String target) {


Loading…
Cancel
Save