proguard.xml revision b9cc48a43ed984587c939d02fba5316bf5c0df6e
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/gradle-1.3/lib/plugins/gradle-plugins-1.3.jar" />
28    <libraryjar file="/usr/local/java/gradle-1.3/lib/gradle-base-services-1.3.jar" />
29    <libraryjar file="/usr/local/java/gradle-1.3/lib/gradle-core-1.3.jar" />
30    <libraryjar file="/usr/local/java/gradle-1.3/lib/groovy-all-1.8.6.jar" />
31    <libraryjar file="/usr/local/java/wtk2.5.2/wtklib/kenv.zip" />
32
33    <!-- Adapt the resource file names, based on the corresponding obfuscated
34         class names. -->
35
36    <adaptresourcefilenames    filter="**.properties,**.gif,**.jpg"  />
37    <adaptresourcefilecontents filter="proguard/ant/task.properties" />
38
39    <!-- Optionally preserve line numbers in the obfuscated stack traces.
40    <keepattribute name="LineNumberTable">
41    <keepattribute name="SourceFile">
42    -->
43
44    <!-- The main seeds: ProGuard and its companion tool ReTrace. -->
45
46    <keep access="public" name="proguard.ProGuard">
47      <method access    ="public static"
48              type      ="void"
49              name      ="main"
50              parameters="java.lang.String[]" />
51    </keep>
52    <keep access="public" name="proguard.gui.ProGuardGUI">
53      <method access    ="public static"
54              type      ="void"
55              name      ="main"
56              parameters="java.lang.String[]" />
57    </keep>
58    <keep access="public" name="proguard.retrace.ReTrace">
59      <method access    ="public static"
60              type      ="void"
61              name      ="main"
62              parameters="java.lang.String[]" />
63    </keep>
64
65    <!-- If we have ant.jar, we can properly process the Ant task. -->
66
67    <keeppackagename name="proguard.ant" />
68    <keep name="proguard.ant.*" allowobfuscation="true" />
69    <keepclassmembers access="public" name="proguard.ant.*">
70      <constructor parameters="org.apache.tools.ant.Project" />
71      <method access="public" type="void" name="set*" parameters="***" />
72      <method access="public" type="void" name="add*" parameters="***" />
73    </keepclassmembers>
74
75    <!-- If we have the Gradle jars, we can properly process the Gradle task. -->
76
77    <keep access="public" name="proguard.gradle.*">
78      <method access="public" />
79    </keep>
80
81    <!-- If we have kenv.zip, we can process the J2ME WTK plugin. -->
82
83    <keep access="public" name="proguard.wtk.ProGuardObfuscator" />
84
85  </proguard>
86</target>
87
88</project>
89