• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 skipnonpubliclibraryclasses="off"
13            printmapping="proguard.map"
14            overloadaggressively="on"
15            repackageclasses="">
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/ant1.7.0/lib/ant.jar" />
27    <libraryjar file="/usr/local/java/wtk2.1/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    <!-- The main seeds: ProGuard and its companion tool ReTrace. -->
36
37    <keep access="public" name="proguard.ProGuard">
38      <method access    ="public static"
39              type      ="void"
40              name      ="main"
41              parameters="java.lang.String[]" />
42    </keep>
43    <keep access="public" name="proguard.gui.ProGuardGUI">
44      <method access    ="public static"
45              type      ="void"
46              name      ="main"
47              parameters="java.lang.String[]" />
48    </keep>
49    <keep access="public" name="proguard.retrace.ReTrace">
50      <method access    ="public static"
51              type      ="void"
52              name      ="main"
53              parameters="java.lang.String[]" />
54    </keep>
55
56    <!-- If we have ant.jar, we can properly process the Ant task. -->
57
58    <keeppackagename name="proguard.ant" />
59    <keep name="proguard.ant.*" allowobfuscation="true" />
60    <keepclassmembers access="public" name="proguard.ant.*">
61      <constructor parameters="org.apache.tools.ant.Project" />
62      <method access="public" type="void" name="set*" parameters="***" />
63      <method access="public" type="void" name="add*" parameters="***" />
64    </keepclassmembers>
65
66    <!-- If we have kenv.zip, we can process the J2ME WTK plugin. -->
67
68    <keep access="public" name="proguard.wtk.ProGuardObfuscator" />
69
70  </proguard>
71</target>
72
73</project>
74