/**
   * Creates the <ant> task configured to run a specific target.
   *
   * @param directory : if not null the directory where the build should run
   * @return the ant task, configured with the explicit properties and references necessary to run
   *     the sub-build.
   */
  private Ant createAntTask(File directory) {
    Ant ant = (Ant) getProject().createTask("ant");
    ant.setOwningTarget(getOwningTarget());
    ant.setTaskName(getTaskName());
    ant.init();
    if (target != null && target.length() > 0) {
      ant.setTarget(target);
    }

    if (output != null) {
      ant.setOutput(output);
    }

    if (directory != null) {
      ant.setDir(directory);
    }

    ant.setInheritAll(inheritAll);
    for (Enumeration i = properties.elements(); i.hasMoreElements(); ) {
      copyProperty(ant.createProperty(), (Property) i.nextElement());
    }

    for (Enumeration i = propertySets.elements(); i.hasMoreElements(); ) {
      ant.addPropertyset((PropertySet) i.nextElement());
    }

    ant.setInheritRefs(inheritRefs);
    for (Enumeration i = references.elements(); i.hasMoreElements(); ) {
      ant.addReference((Ant.Reference) i.nextElement());
    }

    return ant;
  }
Exemple #2
0
 /**
  * init this task by creating new instance of the ant task and configuring it's by calling its own
  * init method.
  */
 public void init() {
   callee = (Ant) getProject().createTask("ant");
   callee.setOwningTarget(getOwningTarget());
   callee.setTaskName(getTaskName());
   callee.setLocation(getLocation());
   callee.init();
 }
Exemple #3
0
 public void init() {
   callee = (Ant) project.createTask("ant");
   callee.setOwningTarget(target);
   callee.setTaskName(getTaskName());
   callee.setLocation(location);
   callee.init();
   initialized = true;
 }