1
<!-- This Ant build file illustrates how to process a program library,
2
such that it remains usable as a library.
3
Usage: ant -f library.xml -->
5
<project name="Library" default="obfuscate" basedir="../..">
7
<target name="obfuscate">
8
<taskdef resource="proguard/ant/task.properties"
9
classpath="lib/proguard.jar" />
11
<proguard printmapping="out.map"
12
renamesourcefileattribute="SourceFile">
14
<!-- Specify the input jars, output jars, and library jars. -->
16
<injar file="library.jar" />
17
<outjar file="library_out.jar" />
19
<libraryjar file="${java.home}/lib/rt.jar" />
21
<!-- Keep some useful attributes. -->
23
<keepattribute name="InnerClasses" />
24
<keepattribute name="SourceFile" />
25
<keepattribute name="LineNumberTable" />
26
<keepattribute name="Deprecated" />
27
<keepattribute name="*Annotation*" />
29
<!-- Preserve all public classes, and their public and protected fields
32
<keep access="public">
33
<field access="public protected" />
34
<method access="public protected" />
37
<!-- Preserve all .class method names. -->
39
<keepclassmembernames access="public">
40
<method type ="java.lang.Class"
42
parameters="java.lang.String" />
43
<method type ="java.lang.Class"
45
parameters="java.lang.String,boolean" />
46
</keepclassmembernames>
48
<!-- Preserve all native method names and the names of their classes. -->
50
<keepclasseswithmembernames>
51
<method access="native" />
52
</keepclasseswithmembernames>
54
<!-- Preserve a method that is required in all enumeration classes. -->
56
<keepclassmembers extends="java.lang.Enum">
57
<method access="public"
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. -->
69
<keepclassmembers implements="java.io.Serializable">
70
<field access ="final"
72
name ="serialVersionUID" />
73
<method access ="private"
76
parameters="java.io.ObjectOutputStream" />
77
<method access ="private"
80
parameters="java.io.ObjectOutputStream" />
81
<method type ="java.lang.Object"
84
<method type ="java.lang.Object"
89
<!-- Your application may contain more items that need to be preserved;
90
typically classes that are dynamically created using Class.forName -->