1<!-- This Ant build file illustrates how to process applications, 2 by including ProGuard-style configuration options. 3 Usage: ant -f applications2.xml --> 4 5<project name="Applications" default="obfuscate" basedir="../.."> 6 7<target name="obfuscate"> 8 <taskdef resource="proguard/ant/task.properties" 9 classpath="lib/proguard.jar" /> 10 11 <proguard> 12 13 <!-- Specify the input jars, output jars, and library jars. --> 14 15 -injars in.jar 16 -outjars out.jar 17 18 -libraryjars ${java.home}/lib/rt.jar 19 <!-- -libraryjars junit.jar --> 20 <!-- -libraryjars servlet.jar --> 21 <!-- -libraryjars jai_core.jar --> 22 <!-- ... --> 23 24 <!-- Save the obfuscation mapping to a file, and preserve line numbers. --> 25 26 -printmapping out.map 27 -renamesourcefileattribute SourceFile 28 -keepattributes SourceFile,LineNumberTable 29 30 <!-- Preserve all annotations. --> 31 32 -keepattributes *Annotation* 33 34 <!-- Preserve all public applications. --> 35 36 -keepclasseswithmembers public class * { 37 public static void main(java.lang.String[]); 38 } 39 40 <!-- Preserve all native method names and the names of their classes. --> 41 42 -keepclasseswithmembernames class * { 43 native <methods>; 44 } 45 46 <!-- Preserve the methods that are required in all enumeration classes. --> 47 48 -keepclassmembers,allowoptimization enum * { 49 public static **[] values(); 50 public static ** valueOf(java.lang.String); 51 } 52 53 <!-- Explicitly preserve all serialization members. The Serializable 54 interface is only a marker interface, so it wouldn't save them. 55 You can comment this out if your library doesn't use serialization. 56 If your code contains serializable classes that have to be backward 57 compatible, please refer to the manual. --> 58 59 -keepclassmembers class * implements java.io.Serializable { 60 static final long serialVersionUID; 61 static final java.io.ObjectStreamField[] serialPersistentFields; 62 private void writeObject(java.io.ObjectOutputStream); 63 private void readObject(java.io.ObjectInputStream); 64 java.lang.Object writeReplace(); 65 java.lang.Object readResolve(); 66 } 67 68 <!-- Your application may contain more items that need to be preserved; 69 typically classes that are dynamically created using Class.forName --> 70 71 </proguard> 72</target> 73 74</project> 75