1 22 package org.enhydra.kelp.jbuilder.build; 23 24 import com.borland.primetime.build.BuildTask; 26 import com.borland.primetime.build.BuildProcess; 27 import com.borland.primetime.node.Project; 28 import com.borland.primetime.node.TextFileNode; 29 import com.borland.jbuilder.node.JBProject; 30 31 33 import java.util.Vector ; 35 import java.util.ResourceBundle ; 36 import java.io.File ; 37 import org.enhydra.kelp.ant.node.AntProject; 38 import java.io.*; 39 import com.borland.primetime.vfs.Url; 40 import org.enhydra.kelp.jbuilder.node.NodeUtil; 41 import com.borland.primetime.node.LightweightNode; 42 43 47 public class CleanBuildTask extends BuildTask { 48 49 public static final String SHARED_KEY = new String ("Clean_TASK"); 50 51 55 public CleanBuildTask() {} 56 57 60 public boolean build(BuildProcess buildProcess) { 61 String prjPath = buildProcess.getProject().getProjectPath().getFullName(); 62 try { 63 AntProject antProject = new AntProject(prjPath); 64 buildProcess.fireBuildStatus("Kelp cleaning ...", true); 65 String enhydraDir = antProject.getProperty(AntProject.ENHYDRA_DIR); 66 String execLine = enhydraDir + "/bin/ant"; 67 if (System.getProperty("os.name").toLowerCase().startsWith("windows")) { 68 execLine += ".bat"; 69 } 70 Process process = Runtime.getRuntime().exec(execLine + " clean", null, 71 new File (prjPath)); 72 InputStream inputStream = process.getInputStream(); 73 InputStream errorStream = process.getErrorStream(); 74 BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); 75 BufferedReader errorBufferedReader = new BufferedReader(new InputStreamReader(errorStream)); 76 File logFile = null; 77 FileWriter logFileWriter = null; 78 BufferedWriter logBuffer = null; 79 PrintWriter logPrint = null; 80 81 String s = null; 82 String er = null; 83 95 process.destroy(); Url url = new Url(new File (antProject.getProperty(AntProject.OUTPUT_DIR))); 97 try { 98 LightweightNode nodes[] = buildProcess.getProject() 99 .findNodes(url.getName()); 100 for (int i = 0; i < nodes.length; i++) { 101 nodes[i].setParent(null); 102 } 103 } 104 catch (Exception ex) { 105 ex.printStackTrace(); 106 } 107 } 108 catch (Exception ex) { 109 ex.printStackTrace(); 110 } 111 return true; 112 } 113 } 114 | Popular Tags |