Пример #1
0
  /**
   * 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;
  }
Пример #2
0
 /**
  * Reference element identifying a data type to carry over to the invoked target.
  *
  * @since Ant 1.5
  */
 public void addReference(Ant.Reference r) {
   if (callee == null) {
     init();
   }
   callee.addReference(r);
 }