Example #1
0
  public boolean execute(Project project, long contentLength, InputStream content)
      throws Throwable {
    Ant ant = (Ant) project.createTask("ant");
    File baseDir = project.getBaseDir();
    if (dir != null) baseDir = new File(dir);
    ant.setDir(baseDir);
    ant.setInheritAll(inheritall);
    ant.setInheritRefs(interitrefs);

    if (target != null) ant.setTarget(target);

    if (antFile != null) ant.setAntfile(antFile);

    Enumeration e = properties.elements();
    PropertyContainer pc = null;
    Property p = null;
    while (e.hasMoreElements()) {
      pc = (PropertyContainer) e.nextElement();
      p = ant.createProperty();
      p.setName(pc.getName());
      p.setValue(pc.getValue());
    }

    e = references.elements();
    ReferenceContainer rc = null;
    Ant.Reference ref = null;
    while (e.hasMoreElements()) {
      rc = (ReferenceContainer) e.nextElement();
      ref = new Ant.Reference();
      ref.setRefId(rc.getRefId());
      ref.setToRefid(rc.getToRefId());
      ant.addReference(ref);
    }

    ant.execute();

    return false;
  }