public File resolve(final Extension extension, final Project project) throws BuildException { validate(); final Ant ant = (Ant) project.createTask("ant"); ant.setInheritAll(false); ant.setAntfile(m_antfile.getName()); try { final File dir = m_antfile.getParentFile().getCanonicalFile(); ant.setDir(dir); } catch (final IOException ioe) { throw new BuildException(ioe.getMessage(), ioe); } if (null != m_target) { ant.setTarget(m_target); } ant.execute(); return m_destfile; }
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; }