1 19 20 package soot.dava; 21 22 import java.io.*; 23 import java.util.ArrayList ; 24 import java.util.Iterator ; 25 26 27 28 31 public class DavaBuildFile { 32 public static void generate(PrintWriter out, ArrayList decompiledClasses){ 33 out.print("<project default=\"compile\" name=\"Build file for decompiled code\">\n"); 34 out.print(" <description>\n"); 35 out.print(" This is the build file produced by Dava for the decompiled code.\n"); 36 out.print(" New features like (formatting using jalopy etc) will be added to this build file\n"); 37 out.print("</description>\n"); 38 out.print("<!-- properties for project directories -->\n"); 39 out.print("<property name=\"srcDir\" location=\"src\"/>\n"); 40 out.print("<property name=\"classesDir\" location=\"classes\"/>\n"); 41 out.print(""); 42 out.print(""); 43 out.print(""); 44 out.print(""); 45 out.print(""); 46 out.print(""); 47 out.print(""); 48 56 out.print(" <!-- ========== Compile Target ================= -->\n"); 57 out.print(" <target name=\"compile\" description=\"Compile .java files\">\n"); 58 out.print(" <javac srcdir=\"${srcDir}\" destdir=\"${classesDir}\">\n"); 59 out.print(" <classpath>\n"); 60 out.print(" <pathelement location=\"${junitJar}\"/>\n"); 61 out.print(" </classpath>\n"); 62 out.print(" </javac>\n"); 63 out.print(" </target>\n"); 64 65 66 67 68 out.print(" <!-- ==========AST METRICS FOR DECOMPILED CODE================= -->\n"); 69 out.print("<target name=\"ast-metrics\" description=\"Compute the ast metrics\">\n"); 70 76 77 out.print(" <exec executable=\"java\" dir=\"src\">\n"); 78 out.print(" <arg value=\"-Xmx400m\" />\n"); 79 out.print(" <arg value=\"soot.Main\" />\n"); 80 out.print(" <arg value=\"-ast-metrics\" />\n"); 81 out.print(" <arg value=\"--src-prec\" />\n"); 82 out.print(" <arg value=\"java\" />\n"); 83 84 85 Iterator it = decompiledClasses.iterator(); 86 while(it.hasNext()){ 87 String temp = (String )it.next(); 88 if(temp.endsWith(".java")){ 89 temp = temp.substring(0,temp.length()-5); 90 } 91 out.print(" <arg value=\"" + temp + "\" />\n"); 93 94 } 95 96 out.print(""); 97 out.print(" </exec>\n"); 98 out.print(" </target>\n"); 99 out.print(""); 100 out.print(""); 101 out.print(""); 102 out.print(""); 103 out.print(""); 104 out.print(""); 105 out.print(""); 106 out.print("</project>"); 107 108 109 } 110 } 111 | Popular Tags |