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