Skip to content

Instantly share code, notes, and snippets.

@mufumbo
Created September 1, 2013 17:44
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mufumbo/6406055 to your computer and use it in GitHub Desktop.
Save mufumbo/6406055 to your computer and use it in GitHub Desktop.
proguard configuration that we use to shrink a spring-mvc project that is deployed on appengine. our goal was to reduce startup time and improve the issues with cold startup. we used spring-mvc, velocity and JDO
##---------------Begin: proguard configuration common for all Android apps ----------
-optimizationpasses 1
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontskipnonpubliclibraryclassmembers
-dontpreverify
-verbose
#-dump class_files.txt
#-printseeds seeds.txt
#-printusage unused.txt
#-printmapping mapping.txt
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-allowaccessmodification
#-keepattributes *Annotation*
# Preserve the special static methods that are required in all enumeration classes.
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
#-keep public class * extends android.app.Activity
##---------------Begin: proguard configuration for allthecooks ----------
-ignorewarnings
-keepdirectories
#-dontshrink
#-dontoptimize
-keepattributes *Annotation*
-keep class com.yumyumlabs.** { *; }
-keepclassmembers class com.yumyumlabs.** { java.lang.Long id; }
-keepnames class com.yumyumlabs.** implements java.io.Serializable
-keep class com.mufumbo.server.**
-keep class org.machino.**
-keep class org.slf4j.Logger { *; }
-keep class * implements org.slf4j.Logger { *; }
-keep class org.slf4j.spi.LocationAwareLogger { *; }
-keep class org.slf4j.spi.LoggerFactoryBinder { *; }
-keep class * implements org.slf4j.spi.LocationAwareLogger { *; }
-keep class * implements org.slf4j.spi.LoggerFactoryBinder { *; }
-keep class org.slf4j.impl.Log4jLoggerAdapter { *; }
-keep class org.apache.log4j.Logger { *; }
-keep class org.apache.log4j.ConsoleAppender { *; }
-keep class org.apache.log4j.PatternLayout
-keep class org.apache.commons.logging.LogFactory { *; }
-keep class com.google.api.client.util.**
-keep class com.google.apphosting.utils.jetty.AppEngineWebAppContext { *; }
-keep class com.google.appengine.tools.development.DevAppEngineWebAppContext { *; }
-keep class org.mortbay.jetty.handler.ContextHandler { *; }
-keep class com.google.api.client.auth.**
-keep class com.google.api.client.auth.oauth2.TokenResponseException { *; }
-keep class com.google.api.client.http.** { *; }
-keep class com.google.api.client.json.** { *; }
-keep class com.google.api.client.util.** { *; }
-keep class com.google.api.server.spi.SystemServiceServlet
-keep class com.google.appengine.tools.mapreduce.MapReduceServlet
-keep class * extends com.google.api.server.spi.SystemServiceServlet
-keep class * extends javax.servlet.http.HttpServlet
-keep class * implements javax.servlet.ServletContext { *; }
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
!static !transient <fields>;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
-keep class com.google.common.base.** { *; }
-keep class com.google.common.collect.Lists { *; }
-keep class com.google.common.collect.Sets { *; }
-keep class com.google.common.collect.Multimap { *; }
-keep class com.google.common.collect.Multimaps { *; }
-keep class com.google.common.collect.Iterables { *; }
-keep class com.google.appengine.datanucleus.** { *; }
-keep class org.dom4j.** { *; }
-keep class javax.jdo.datastore.DataStoreCache
-keep class javax.jdo.spi.JDOImplHelper { *; }
-keep class javax.jdo.annotations.** { *; }
-keep class java.util.BitSet { *; }
-keep class javax.jdo.**
-keep class org.datanucleus.api.jdo.** { *; }
-keep class org.datanucleus.api.jdo.JDOAdapter
-keep class org.datanucleus.api.jdo.metadata.JDOMetaDataManager { *; }
-keep class org.datanucleus.api.jdo.JDOPersistenceManagerFactory { *; }
-keep class org.datanucleus.util.NucleusLogger
-keep class org.datanucleus.util.Log4JLogger { *; }
-keep class org.datanucleus.cache.** { *; }
-keep class org.datanucleus.query.** { *; }
-keep class org.datanucleus.store.types.sco.simple.** { *; }
-keep class org.datanucleus.store.types.sco.backed.** { *; }
-keep class org.datanucleus.store.mapped.mapping.**
-keep class org.datanucleus.store.mapped.identifier.DN2IdentifierFactory { *; }
-keep class org.datanucleus.store.query.cache.SoftQueryDatastoreCompilationCache { *; }
-keep class org.datanucleus.store.query.cache.SoftQueryResultsCache { *; }
-keep class org.springframework.jndi.JndiPropertySource
-keep class org.springframework.jndi.JndiLocatorDelegate { *; }
-keep class org.springframework.context.** { *; }
-keep class org.springframework.format.support.** { *; }
-keep class org.springframework.ui.context.support.** { *; }
-keep class org.springframework.validation.** { *; }
-keep class org.springframework.http.** { *; }
-keep class org.springframework.ui.velocity.** { *; }
-keep class org.springframework.web.bind.** { *; }
-keep class org.springframework.web.context.** { *; }
-keep class org.springframework.web.context.ContextLoaderListener { *; }
-keep class org.springframework.web.context.support.XmlWebApplicationContext { *; }
-keep class org.springframework.web.context.support.GenericWebApplicationContext { *; }
-keep class org.springframework.web.context.support.StaticWebApplicationContext { *; }
-keep class org.springframework.web.context.support.AbstractRefreshableWebApplicationContext { *; }
-keep class org.springframework.web.context.WebApplicationContext { *; }
-keep class org.springframework.web.filter.** { *; }
-keep class org.springframework.web.servlet.i18n.**
-keep class org.springframework.web.method.** { *; }
-keep class org.springframework.web.servlet.DispatcherServlet { *; }
-keep class org.springframework.web.servlet.config.**
-keep class org.springframework.web.servlet.support.*
-keep class org.springframework.web.servlet.theme.**
-keep class org.springframework.web.servlet.view.*
-keep class org.springframework.web.servlet.view.x**
-keep class org.springframework.web.servlet.view.velocity.** { *; }
-keep class org.springframework.web.util.** { *; }
-keep class org.springframework.web.view.*
-keep class * implements org.springframework.web.context.ConfigurableWebApplicationContext { *; }
-keep class * implements org.springframework.context.ApplicationListener { *; }
-keep class * extends org.springframework.web.context.support.XmlWebApplicationContext { *; }
-keep class * extends org.springframework.web.servlet.DispatcherServlet { *; }
-keep class org.springframework.beans.factory.** { *; }
-keep class org.apache.velocity.runtime.directive.** { *; }
-keep class org.apache.velocity.runtime.ParserPoolImpl
-keep class org.reflections.spring.**
-keep class * implements javax.servlet.FilterChain { *; }
-keepclassmembers class * {
@org.springframework.beans.factory.annotation.Autowired *;
@org.springframework.beans.factory.annotation.Qualifier *;
@org.springframework.beans.factory.annotation.Value *;
@org.springframework.beans.factory.annotation.Required *;
@org.springframework.context.annotation.Bean *;
@javax.annotation.PostConstruct *;
@javax.annotation.PreDestroy *;
@org.aspectj.lang.annotation.AfterReturning *;
@org.aspectj.lang.annotation.Pointcut *;
@org.aspectj.lang.annotation.AfterThrowing *;
@org.aspectj.lang.annotation.Around *;
}
-keep @org.springframework.stereotype.Service class *
-keep @org.springframework.stereotype.Controller class *
-keep @org.springframework.stereotype.Component class *
-keep @org.springframework.stereotype.Repository class *
-keep @org.springframework.cache.annotation.EnableCaching class *
-keep @org.springframework.context.annotation.Configuration class *
-keep class org.apache.commons.collections.ExtendedProperties { *; }
-keep class org.apache.commons.collections.map.LRUMap { *; }
-keep class org.apache.commons.lang.StringUtils { *; }
-keep class org.apache.commons.lang.text.StrBuilder { *; }
-keep class org.apache.commons.logging.Log { *; }
-keep class org.apache.commons.lang.StringEscapeUtils { *; }
-keep class org.apache.velocity.runtime.RuntimeInstance { *; }
-keep class org.apache.velocity.tools.generic.NumberTool { *; }
-keep class org.apache.velocity.tools.generic.DateTool { *; }
-keep class org.apache.velocity.tools.generic.FieldTool { *; }
-keep class org.apache.velocity.tools.generic.MathTool { *; }
-keep class org.apache.velocity.tools.generic.EscapeTool { *; }
-keep class org.apache.velocity.runtime.log.CommonsLogLogChute
-keep class org.apache.velocity.runtime.resource.ResourceManagerImpl
-keep class org.apache.velocity.runtime.resource.ResourceCacheImpl
-keep class org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
-keep class org.apache.velocity.tools.view.WebappResourceLoader
-keep class org.apache.velocity.app.VelocityEngine { *; }
-keep class org.apache.velocity.runtime.directive.Stop { *; }
-keep class org.apache.velocity.runtime.directive.Define { *; }
-keep class com.googlecode.htmlcompressor.** { *; }
-keep class org.apache.lucene.index.IndexWriterConfig
-keep class org.apache.lucene.index.IndexReader { *; }
-keep class org.apache.lucene.analysis.tokenattributes.**
-dontwarn com.yumyumlabs.web.controllers.auth.AuthController
-keep class org.apache.lucene.util.RamUsageEstimator
-dontwarn com.google.apphosting.api.ReflectionUtils
-dontwarn sun.misc.Unsafe
-keep class com.google.gson.internal.UnsafeAllocator
-keep class com.google.gson.internal.UnsafeAllocator { java.lang.Object theUnsafe; }
-dontwarn org.tartarus.snowball.**
-dontnote
-keepattributes Signature,RuntimeVisibleAnnotations,AnnotationDefault
##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
-keepattributes Signature
# For using GSON @Expose annotation
#-keepattributes *Annotation*
# Gson specific classes
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.stream.** { *; }
-keep class com.google.gson.internal.**
# Application classes that will be serialized/deserialized over Gson
# -keep class com.google.gson.examples.android.model.** { *; }
##---------------End: proguard configuration for Gson ----------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment