1 <!-- This Ant build file illustrates how to process ProGuard (including its 2 main application, its GUI, its Ant task, and its WTK plugin), and the 3 ReTrace tool, all in one go. 4 Usage: ant -f proguard.xml --> 5 6 <project name="ProGuard" default="obfuscate" basedir="../.."> 7 8 <target name="obfuscate"> 9 <taskdef resource="proguard/ant/task.properties" 10 classpath="lib/proguard.jar" /> 11 12 <proguard printmapping="proguard.map" 13 overloadaggressively="on" 14 repackageclasses="" 15 renamesourcefileattribute="SourceFile"> 16 17 <!-- Specify the input jars, output jars, and library jars. --> 18 19 <injar file="lib/proguard.jar" /> 20 <injar file="lib/proguardgui.jar" filter="!META-INF/**" /> 21 <injar file="lib/retrace.jar" filter="!META-INF/**" /> 22 23 <outjar file="examples/ant/proguard_out.jar" /> 24 25 <libraryjar file="${java.home}/lib/rt.jar" /> 26 <libraryjar file="/usr/local/java/ant/lib/ant.jar" /> 27 <libraryjar file="/usr/local/java/wtk2.5.2/wtklib/kenv.zip" /> 28 29 <!-- Adapt the resource file names, based on the corresponding obfuscated 30 class names. --> 31 32 <adaptresourcefilenames filter="**.properties,**.gif,**.jpg" /> 33 <adaptresourcefilecontents filter="proguard/ant/task.properties" /> 34 35 <!-- Optionally preserve line numbers in the obfuscated stack traces. 36 <keepattribute name="LineNumberTable"> 37 <keepattribute name="SourceFile"> 38 --> 39 40 <!-- The main seeds: ProGuard and its companion tool ReTrace. --> 41 42 <keep access="public" name="proguard.ProGuard"> 43 <method access ="public static" 44 type ="void" 45 name ="main" 46 parameters="java.lang.String[]" /> 47 </keep> 48 <keep access="public" name="proguard.gui.ProGuardGUI"> 49 <method access ="public static" 50 type ="void" 51 name ="main" 52 parameters="java.lang.String[]" /> 53 </keep> 54 <keep access="public" name="proguard.retrace.ReTrace"> 55 <method access ="public static" 56 type ="void" 57 name ="main" 58 parameters="java.lang.String[]" /> 59 </keep> 60 61 <!-- If we have ant.jar, we can properly process the Ant task. --> 62 63 <keeppackagename name="proguard.ant" /> 64 <keep name="proguard.ant.*" allowobfuscation="true" /> 65 <keepclassmembers access="public" name="proguard.ant.*"> 66 <constructor parameters="org.apache.tools.ant.Project" /> 67 <method access="public" type="void" name="set*" parameters="***" /> 68 <method access="public" type="void" name="add*" parameters="***" /> 69 </keepclassmembers> 70 71 <!-- If we have kenv.zip, we can process the J2ME WTK plugin. --> 72 73 <keep access="public" name="proguard.wtk.ProGuardObfuscator" /> 74 75 </proguard> 76 </target> 77 78 </project> 79