コード例 #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
ファイル: CallTarget.java プロジェクト: saeg/experiments
  public void execute() {
    if (!initialized) {
      init();
    }

    if (subTarget == null) {
      throw new BuildException("Attribute target is required.", location);
    }

    callee.setDir(project.getBaseDir());
    callee.setAntfile(project.getProperty("ant.file"));
    callee.setTarget(subTarget);
    callee.setInheritAll(inheritAll);
    callee.execute();
  }
コード例 #3
0
ファイル: CallTarget.java プロジェクト: saeg/experiments
  /**
   * hand off the work to the ant task of ours, after setting it up
   *
   * @throws BuildException on validation failure or if the target didn't execute
   */
  public void execute() throws BuildException {
    if (callee == null) {
      init();
    }

    if (subTarget == null) {
      throw new BuildException("Attribute target is required.", getLocation());
    }

    callee.setAntfile(getProject().getProperty("ant.file"));
    callee.setTarget(subTarget);
    callee.setInheritAll(inheritAll);
    callee.setInheritRefs(inheritRefs);
    callee.execute();
  }