mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-26 12:23:58 +01:00 
			
		
		
		
	 5d7f42d127
			
		
	
	
		5d7f42d127
		
			
		
	
	
	
	
		
			
			* chore: add R8 rules to prevent obfuscating file usage classes * chore: upgrade lifecycle-runtime dependency to resolve lint errors * remove invalid resource directory
		
			
				
	
	
		
			100 lines
		
	
	
	
		
			3.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			100 lines
		
	
	
	
		
			3.2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
| -dontobfuscate
 | |
| -ignorewarnings
 | |
| 
 | |
| -dontnote **
 | |
| -dontwarn net.bytebuddy.**
 | |
| -dontwarn org.mockito.**
 | |
| 
 | |
| # --- Apache ---
 | |
| -keep class org.apache.http.** { *; }
 | |
| -dontwarn org.apache.**
 | |
| # --- /Apache ---
 | |
| 
 | |
| # --- Butter Knife ---
 | |
| # Finder.castParam() is stripped when not needed and ProGuard notes it
 | |
| # unnecessarily. When castParam() is needed, it's not stripped. e.g.:
 | |
| #
 | |
| #  @OnItemSelected(value = R.id.history_entry_list)
 | |
| #  void foo(ListView bar) {
 | |
| #      L.d("baz");
 | |
| #  }
 | |
| 
 | |
| -dontnote butterknife.internal.**
 | |
| # --- /Butter Knife ---
 | |
| 
 | |
| # --- Retrofit2 ---
 | |
| # Platform calls Class.forName on types which do not exist on Android to determine platform.
 | |
| -dontnote retrofit2.Platform
 | |
| # Platform used when running on Java 8 VMs. Will not be used at runtime.
 | |
| -dontwarn retrofit2.Platform$Java8
 | |
| # Retain generic type information for use by reflection by converters and adapters.
 | |
| -keepattributes Signature
 | |
| # Retain declared checked exceptions for use by a Proxy instance.
 | |
| -keepattributes Exceptions
 | |
| 
 | |
| # Note: The model package right now seems to include some other classes that
 | |
| # are not used for serialization / deserialization over Gson. Hopefully
 | |
| # that's not a problem since it only prevents R8 from avoiding trimming
 | |
| # of few more classes.
 | |
| -keepclasseswithmembers class fr.free.nrw.commons.*.model.** { *; }
 | |
| -keepclasseswithmembers class fr.free.nrw.commons.actions.** { *; }
 | |
| -keepclasseswithmembers class fr.free.nrw.commons.auth.csrf.** { *; }
 | |
| -keepclasseswithmembers class fr.free.nrw.commons.auth.login.** { *; }
 | |
| -keepclasseswithmembers class fr.free.nrw.commons.wikidata.mwapi.** { *; }
 | |
| 
 | |
| # --- /Retrofit ---
 | |
| 
 | |
| # --- OkHttp + Okio ---
 | |
| -dontwarn okhttp3.**
 | |
| -dontwarn okio.**
 | |
| # --- /OkHttp + Okio ---
 | |
| 
 | |
| # --- Gson ---
 | |
| # https://github.com/google/gson/blob/master/examples/android-proguard-example/proguard.cfg
 | |
| 
 | |
| # 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
 | |
| -dontwarn sun.misc.**
 | |
| #-keep class com.google.gson.stream.** { *; }
 | |
| 
 | |
| # Application classes that will be serialized/deserialized over Gson
 | |
| -keep class com.google.gson.examples.android.model.** { *; }
 | |
| 
 | |
| # Prevent R8 from obfuscating project classes used by Gson for parsing
 | |
| -keep class fr.free.nrw.commons.fileusages.** { *; }
 | |
| 
 | |
| # Prevent proguard from stripping interface information from TypeAdapterFactory,
 | |
| # JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
 | |
| -keep class * implements com.google.gson.TypeAdapterFactory
 | |
| -keep class * implements com.google.gson.JsonSerializer
 | |
| -keep class * implements com.google.gson.JsonDeserializer
 | |
| # --- /Gson ---
 | |
| 
 | |
| 
 | |
| # --- /logback ---
 | |
| 
 | |
| -keep class ch.qos.** { *; }
 | |
| -keep class org.slf4j.** { *; }
 | |
| -keepattributes *Annotation*
 | |
| 
 | |
| -dontwarn ch.qos.logback.core.net.*
 | |
| 
 | |
| # --- /acra ---
 | |
| -keep class org.acra.** { *; }
 | |
| -keepattributes SourceFile,LineNumberTable
 | |
| -keepattributes *Annotation*
 | |
| 
 | |
| # --- /recycler view ---
 | |
| -keep class androidx.recyclerview.widget.RecyclerView  {
 | |
|     public androidx.recyclerview.widget.RecyclerView$ViewHolder findViewHolderForPosition(int);
 | |
| }
 | |
| # --- Parcelable ---
 | |
| -keepclassmembers class * implements android.os.Parcelable {
 | |
|     static ** CREATOR;
 | |
| }
 |