Home | History | Annotate | Download | only in ant
      1 <!-- This Ant build file illustrates how to process applets.
      2      Usage: ant -f applets.xml -->
      3 
      4 <project name="Applets" default="obfuscate" basedir="../..">
      5 
      6 <target name="obfuscate">
      7   <taskdef resource="proguard/ant/task.properties"
      8            classpath="lib/proguard.jar" />
      9 
     10   <proguard printseeds="on">
     11 
     12     <!-- Specify the input jars, output jars, and library jars. -->
     13 
     14     <injar  file="in.jar" />
     15     <outjar file="out.jar" />
     16 
     17     <libraryjar file="${java.home}/lib/rt.jar" />
     18 
     19     <!-- Preserve all public applets. -->
     20 
     21     <keep access="public" extends="java.applet.Applet" />
     22 
     23     <!-- Preserve all annotations. -->
     24 
     25     <keepattribute name="*Annotation*" />
     26 
     27     <!-- Preserve all native method names and the names of their classes. -->
     28 
     29     <keepclasseswithmembernames>
     30       <method access="native" />
     31     </keepclasseswithmembernames>
     32     
     33     <!-- Preserve the methods that are required in all enumeration classes. -->
     34     
     35     <keepclassmembers extends="java.lang.Enum">
     36       <method access="public static"
     37               type="**[]"
     38               name="values"
     39               parameters="" />
     40       <method access="public static"
     41               type="**"
     42               name="valueOf"
     43               parameters="java.lang.String" />
     44     </keepclassmembers>
     45 
     46     <!-- Explicitly preserve all serialization members. The Serializable
     47          interface is only a marker interface, so it wouldn't save them.
     48          You can comment this out if your library doesn't use serialization.
     49          If your code contains serializable classes that have to be backward
     50          compatible, please refer to the manual. -->
     51 
     52     <keepclassmembers implements="java.io.Serializable">
     53       <field  access    ="static final"
     54               type      ="long"
     55               name      ="serialVersionUID" />
     56       <field  access    ="static final"
     57               type      ="java.io.ObjectStreamField[]"
     58               name      ="serialPersistentFields" />
     59       <method access    ="private"
     60               type      ="void"
     61               name      ="writeObject"
     62               parameters="java.io.ObjectOutputStream" />
     63       <method access    ="private"
     64               type      ="void"
     65               name      ="readObject"
     66               parameters="java.io.ObjectInputStream" />
     67       <method type      ="java.lang.Object"
     68               name      ="writeReplace"
     69               parameters="" />
     70       <method type      ="java.lang.Object"
     71               name      ="readResolve"
     72               parameters="" />
     73     </keepclassmembers>
     74 
     75     <!-- Your application may contain more items that need to be preserved;
     76          typically classes that are dynamically created using Class.forName -->
     77 
     78    </proguard>
     79 </target>
     80 
     81 </project>
     82