1<!-- This Ant build file illustrates how to process applications,
2     using a full-blown XML configuration.
3     Usage: ant -f applications3.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 printseeds="on"
12            printmapping="out.map"
13            renamesourcefileattribute="SourceFile">
14
15    <!-- Specify the input jars, output jars, and library jars. -->
16
17    <injar  file="in.jar" />
18    <outjar file="out.jar" />
19
20    <libraryjar file="${java.home}/lib/rt.jar" />
21    <!-- libraryjar file="junit.jar"           / -->
22    <!-- libraryjar file="servlet.jar"         / -->
23    <!-- libraryjar file="jai_core.jar"        / -->
24    <!-- ...                                   / -->
25
26    <!-- Preserve line numbers in the obfuscated stack traces. -->
27
28    <keepattribute name="LineNumberTable" />
29    <keepattribute name="SourceFile" />
30
31    <!-- Preserve all annotations. -->
32
33    <keepattribute name="*Annotation*" />
34
35    <!-- Preserve all public applications. -->
36
37    <keepclasseswithmembers access="public">
38      <method access    ="public static"
39              type      ="void"
40              name      ="main"
41              parameters="java.lang.String[]" />
42    </keepclasseswithmembers>
43
44    <!-- Preserve all native method names and the names of their classes. -->
45
46    <keepclasseswithmembernames includedescriptorclasses="true">
47      <method access="native" />
48    </keepclasseswithmembernames>
49
50    <!-- Preserve the methods that are required in all enumeration classes. -->
51
52    <keepclassmembers allowoptimization="true" type="enum">
53      <method access="public static"
54              type="**[]"
55              name="values"
56              parameters="" />
57      <method access="public static"
58              type="**"
59              name="valueOf"
60              parameters="java.lang.String" />
61    </keepclassmembers>
62
63    <!-- Explicitly preserve all serialization members. The Serializable
64         interface is only a marker interface, so it wouldn't save them.
65         You can comment this out if your library doesn't use serialization.
66         If your code contains serializable classes that have to be backward
67         compatible, please refer to the manual. -->
68
69    <keepclassmembers implements="java.io.Serializable">
70      <field  access    ="static final"
71              type      ="long"
72              name      ="serialVersionUID" />
73      <field  access    ="static final"
74              type      ="java.io.ObjectStreamField[]"
75              name      ="serialPersistentFields" />
76      <method access    ="private"
77              type      ="void"
78              name      ="writeObject"
79              parameters="java.io.ObjectOutputStream" />
80      <method access    ="private"
81              type      ="void"
82              name      ="readObject"
83              parameters="java.io.ObjectInputStream" />
84      <method type      ="java.lang.Object"
85              name      ="writeReplace"
86              parameters="" />
87      <method type      ="java.lang.Object"
88              name      ="readResolve"
89              parameters="" />
90    </keepclassmembers>
91
92    <!-- Your application may contain more items that need to be preserved;
93         typically classes that are dynamically created using Class.forName -->
94
95  </proguard>
96</target>
97
98</project>
99