~ubuntu-branches/ubuntu/breezy/proguard/breezy

« back to all changes in this revision

Viewing changes to examples/ant/library.xml

  • Committer: Bazaar Package Importer
  • Author(s): Sam Clegg
  • Date: 2005-06-17 14:25:24 UTC
  • Revision ID: james.westby@ubuntu.com-20050617142524-thz2yfa3vemy3j9d
Tags: upstream-3.2
ImportĀ upstreamĀ versionĀ 3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 -->
 
4
 
 
5
<project name="Library" default="obfuscate" basedir="../..">
 
6
 
 
7
<target name="obfuscate">
 
8
  <taskdef resource="proguard/ant/task.properties"
 
9
           classpath="lib/proguard.jar" />
 
10
 
 
11
  <proguard printmapping="out.map"
 
12
            renamesourcefileattribute="SourceFile">
 
13
 
 
14
    <!-- Specify the input jars, output jars, and library jars. -->
 
15
 
 
16
    <injar  file="library.jar" />
 
17
    <outjar file="library_out.jar" />
 
18
 
 
19
    <libraryjar file="${java.home}/lib/rt.jar" />
 
20
 
 
21
    <!-- Keep some useful attributes. -->
 
22
 
 
23
    <keepattribute name="InnerClasses" />
 
24
    <keepattribute name="SourceFile" />
 
25
    <keepattribute name="LineNumberTable" />
 
26
    <keepattribute name="Deprecated" />
 
27
    <keepattribute name="*Annotation*" />
 
28
 
 
29
    <!-- Preserve all public classes, and their public and protected fields
 
30
        and methods. -->
 
31
 
 
32
    <keep access="public">
 
33
      <field  access="public protected" />
 
34
      <method access="public protected" />
 
35
    </keep>
 
36
 
 
37
    <!-- Preserve all .class method names. -->
 
38
 
 
39
    <keepclassmembernames access="public">
 
40
      <method type      ="java.lang.Class"
 
41
              name      ="class$"
 
42
              parameters="java.lang.String" />
 
43
      <method type      ="java.lang.Class"
 
44
              name      ="class$"
 
45
              parameters="java.lang.String,boolean" />
 
46
    </keepclassmembernames>
 
47
 
 
48
    <!-- Preserve all native method names and the names of their classes. -->
 
49
 
 
50
    <keepclasseswithmembernames>
 
51
      <method access="native" />
 
52
    </keepclasseswithmembernames>
 
53
    
 
54
    <!-- Preserve a method that is required in all enumeration classes. -->
 
55
    
 
56
    <keepclassmembers extends="java.lang.Enum">
 
57
      <method access="public"
 
58
              type="**[]"
 
59
              name="values"
 
60
              parameters="" />
 
61
    </keepclassmembers>
 
62
 
 
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. -->
 
68
 
 
69
    <keepclassmembers implements="java.io.Serializable">
 
70
      <field  access    ="final"
 
71
              type      ="long"
 
72
              name      ="serialVersionUID" />
 
73
      <method access    ="private"
 
74
              type      ="void"
 
75
              name      ="writeObject"
 
76
              parameters="java.io.ObjectOutputStream" />
 
77
      <method access    ="private"
 
78
              type      ="void"
 
79
              name      ="readObject"
 
80
              parameters="java.io.ObjectOutputStream" />
 
81
      <method type      ="java.lang.Object"
 
82
              name      ="writeReplace"
 
83
              parameters="" />
 
84
      <method type      ="java.lang.Object"
 
85
              name      ="readResolve"
 
86
              parameters="" />
 
87
    </keepclassmembers>
 
88
 
 
89
    <!-- Your application may contain more items that need to be preserved;
 
90
      typically classes that are dynamically created using Class.forName -->
 
91
 
 
92
  </proguard>
 
93
</target>
 
94
 
 
95
</project>