Source:
protected void cleanup(String[] config, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 2); fDevProperties = null; fAntBuildProperties = null; File scriptFile = null; try { scriptFile = createScriptFile("zip.xml"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document doc = factory.newDocumentBuilder().newDocument(); Element root = doc.createElement("project"); root.setAttribute("name", "temp"); root.setAttribute("default", "clean"); root.setAttribute("basedir", "."); doc.appendChild(root); Element target = doc.createElement("target"); target.setAttribute("name", "clean"); Element child = doc.createElement("delete"); child.setAttribute("dir", fBuildTempLocation); target.appendChild(child); root.appendChild(target); if (hasAntErrors()) { target = doc.createElement("target"); target.setAttribute("name", "zip.logs"); child = doc.createElement("zip"); child.setAttribute("zipfile", fInfo.destinationDirectory + logName(config)); child.setAttribute("basedir", fBuildTempLocation + "/pde.logs"); target.appendChild(child); root.appendChild(target); } XMLPrintHandler.writeFile(doc, scriptFile); String[] targets = hasAntErrors() ? new String[] {"zip.logs", "clean"} : new String[] {"clean"}; AntRunner runner = new AntRunner(); runner.setBuildFileLocation(scriptFile.getAbsolutePath()); runner.setExecutionTargets(targets); runner.run(subMonitor.newChild(1)); } catch (FactoryConfigurationError e) { } catch (ParserConfigurationException e) { } catch (CoreException e) { } catch (IOException e) { } finally { if (scriptFile != null && scriptFile.exists()) { scriptFile.delete(); } monitor.done(); } }

Target:
protected void cleanup(String[] config, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); fDevProperties = null; fAntBuildProperties = null; File scriptFile = null; try { scriptFile = createScriptFile("zip.xml"); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); Document doc = factory.newDocumentBuilder().newDocument(); Element root = doc.createElement("project"); root.setAttribute("name", "temp"); root.setAttribute("default", "clean"); root.setAttribute("basedir", "."); doc.appendChild(root); Element target = doc.createElement("target"); target.setAttribute("name", "clean"); Element child = doc.createElement("delete"); child.setAttribute("dir", fBuildTempLocation); target.appendChild(child); root.appendChild(target); if (hasAntErrors()) { target = doc.createElement("target"); target.setAttribute("name", "zip.logs"); child = doc.createElement("zip"); child.setAttribute("zipfile", fInfo.destinationDirectory + logName(config)); child.setAttribute("basedir", fBuildTempLocation + "/pde.logs"); target.appendChild(child); root.appendChild(target); } XMLPrintHandler.writeFile(doc, scriptFile); String[] targets = hasAntErrors() ? new String[] {"zip.logs", "clean"} : new String[] {"clean"}; AntRunner runner = new AntRunner(); runner.setBuildFileLocation(scriptFile.getAbsolutePath()); runner.setExecutionTargets(targets); runner.run(subMonitor.newChild(1)); } catch (FactoryConfigurationError e) { } catch (ParserConfigurationException e) { } catch (CoreException e) { } catch (IOException e) { } finally { if (scriptFile != null && scriptFile.exists()) { scriptFile.delete(); } } }