1 # 2 # This ProGuard configuration file illustrates how to process Scala 3 # applications, including the Scala runtime. 4 # Usage: 5 # java -jar proguard.jar @scala.pro 6 # 7 8 # Specify the input jars, output jars, and library jars. 9 10 -injars in.jar 11 -injars /usr/local/java/scala-2.9.1/lib/scala-library.jar 12 #-injars /usr/local/java/scala-2.9.1/lib/scala-compiler.jar(!META-INF/MANIFEST.MF) 13 #-injars /usr/local/java/scala-2.9.1/lib/jline.jar(!META-INF/MANIFEST.MF) 14 -outjars out.jar 15 16 -libraryjars <java.home>/lib/rt.jar 17 #-libraryjars /usr/local/java/ant/lib/ant.jar 18 #... 19 20 # Ignore some compiler artefacts. 21 22 -dontwarn scala.** 23 24 # Save the obfuscation mapping to a file, so you can de-obfuscate any stack 25 # traces later on. Keep a fixed source file attribute and all line number 26 # tables to get line numbers in the stack traces. 27 # You can comment this out if you're not interested in stack traces. 28 29 -printmapping out.map 30 -renamesourcefileattribute SourceFile 31 -keepattributes SourceFile,LineNumberTable 32 33 # Preserve all annotations. 34 35 -keepattributes *Annotation* 36 37 # You can print out the seeds that are matching the keep options below. 38 39 #-printseeds out.seeds 40 41 # Preserve all public applications. 42 43 -keepclasseswithmembers public class * { 44 public static void main(java.lang.String[]); 45 } 46 47 # Preserve some classes and class members that are accessed by means of 48 # introspection. 49 50 -keep class * implements org.xml.sax.EntityResolver 51 52 -keepclassmembers class * { 53 ** MODULE$; 54 } 55 56 -keepclassmembernames class scala.concurrent.forkjoin.ForkJoinPool { 57 long eventCount; 58 int workerCounts; 59 int runControl; 60 scala.concurrent.forkjoin.ForkJoinPool$WaitQueueNode syncStack; 61 scala.concurrent.forkjoin.ForkJoinPool$WaitQueueNode spareStack; 62 } 63 64 -keepclassmembernames class scala.concurrent.forkjoin.ForkJoinWorkerThread { 65 int base; 66 int sp; 67 int runState; 68 } 69 70 -keepclassmembernames class scala.concurrent.forkjoin.ForkJoinTask { 71 int status; 72 } 73 74 -keepclassmembernames class scala.concurrent.forkjoin.LinkedTransferQueue { 75 scala.concurrent.forkjoin.LinkedTransferQueue$PaddedAtomicReference head; 76 scala.concurrent.forkjoin.LinkedTransferQueue$PaddedAtomicReference tail; 77 scala.concurrent.forkjoin.LinkedTransferQueue$PaddedAtomicReference cleanMe; 78 } 79 80 # Preserve some classes and class members that are accessed by means of 81 # introspection in the Scala compiler library, if it is processed as well. 82 83 #-keep class * implements jline.Completor 84 #-keep class * implements jline.Terminal 85 86 #-keep class scala.tools.nsc.Global 87 88 #-keepclasseswithmembers class * { 89 # <init>(scala.tools.nsc.Global); 90 #} 91 92 #-keepclassmembers class * { 93 # *** scala_repl_value(); 94 # *** scala_repl_result(); 95 #} 96 97 # Preserve all native method names and the names of their classes. 98 99 -keepclasseswithmembernames class * { 100 native <methods>; 101 } 102 103 # Preserve the special static methods that are required in all enumeration 104 # classes. 105 106 -keepclassmembers class * extends java.lang.Enum { 107 public static **[] values(); 108 public static ** valueOf(java.lang.String); 109 } 110 111 # Explicitly preserve all serialization members. The Serializable interface 112 # is only a marker interface, so it wouldn't save them. 113 # You can comment this out if your application doesn't use serialization. 114 # If your code contains serializable classes that have to be backward 115 # compatible, please refer to the manual. 116 117 -keepclassmembers class * implements java.io.Serializable { 118 static final long serialVersionUID; 119 static final java.io.ObjectStreamField[] serialPersistentFields; 120 private void writeObject(java.io.ObjectOutputStream); 121 private void readObject(java.io.ObjectInputStream); 122 java.lang.Object writeReplace(); 123 java.lang.Object readResolve(); 124 } 125 126 # Your application may contain more items that need to be preserved; 127 # typically classes that are dynamically created using Class.forName: 128 129 # -keep public class mypackage.MyClass 130 # -keep public interface mypackage.MyInterface 131 # -keep public class * implements mypackage.MyInterface 132 133