1b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# 2b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# This ProGuard configuration file illustrates how to use annotations for 3b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# specifying which classes and class members should be kept. 4b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# Usage: 5b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# java -jar proguard.jar @examples.pro 6b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# 7b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 8b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# Specify the input, output, and library jars. 9b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# This is assuming the code has been compiled in the examples directory. 10b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 11b9cc48a43ed984587c939d02fba5316bf5c0df6eYing Wang-injars examples(*.class) 12b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato-outjars out 13b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 14b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato-libraryjars <java.home>/lib/rt.jar 15b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 16b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# Some important configuration is based on the annotations in the code. 17b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# We have to specify what the annotations mean to ProGuard. 18b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 19b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato-include lib/annotations.pro 20b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 21b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# 22b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# We can then still add any other options that might be useful. 23b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# 24b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 25b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# Print out a list of what we're preserving. 26b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 27b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato-printseeds 28b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 29b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# Preserve all annotations themselves. 30b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 31b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato-keepattributes *Annotation* 32b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 33b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# Preserve all native method names and the names of their classes. 34b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 352270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom-keepclasseswithmembernames,includedescriptorclasses class * { 36b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato native <methods>; 37b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato} 38b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 39b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# Preserve the special static methods that are required in all enumeration 40b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# classes. 41b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 422270795fbe0b277bfd49f40950ecaa78583175ccBrian Carlstrom-keepclassmembers,allowoptimization enum * { 43b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato public static **[] values(); 44b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato public static ** valueOf(java.lang.String); 45b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato} 46b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 47b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# Explicitly preserve all serialization members. The Serializable interface 48b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# is only a marker interface, so it wouldn't save them. 49b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# You can comment this out if your application doesn't use serialization. 50b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# If your code contains serializable classes that have to be backward 51b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato# compatible, please refer to the manual. 52b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato 53b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato-keepclassmembers class * implements java.io.Serializable { 54b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato static final long serialVersionUID; 55b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato static final java.io.ObjectStreamField[] serialPersistentFields; 56b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato private void writeObject(java.io.ObjectOutputStream); 57b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato private void readObject(java.io.ObjectInputStream); 58b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato java.lang.Object writeReplace(); 59b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato java.lang.Object readResolve(); 60b72c5c2e5482cf10117b2b25f642f7616b2326c3Joe Onorato} 61