Skip to content

Commit

Permalink
Proguard/moshi fixes done while releasing 1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbWatershed committed Sep 29, 2019
1 parent dc68e49 commit 42d89fe
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 85 deletions.
14 changes: 0 additions & 14 deletions .proguard/proguard-gson.pro

This file was deleted.

59 changes: 59 additions & 0 deletions .proguard/proguard-moshi.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

-keepclasseswithmembers class * {
@com.squareup.moshi.* <methods>;
}

-keep @com.squareup.moshi.JsonQualifier interface *

# Enum field names are used by the integrated EnumJsonAdapter.
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
<fields>;
}

# The name of @JsonClass types is used to look up the generated adapter.
-keepnames @com.squareup.moshi.JsonClass class *

# Retain generated target class's synthetic defaults constructor and keep DefaultConstructorMarker's
# name. We will look this up reflectively to invoke the type's constructor.
#
# We can't _just_ keep the defaults constructor because Proguard/R8's spec doesn't allow wildcard
# matching preceding parameters.
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-keepclassmembers @com.squareup.moshi.JsonClass @kotlin.Metadata class * {
synthetic <init>(...);
}

# Retain generated JsonAdapters if annotated type is retained.
-if @com.squareup.moshi.JsonClass class *
-keep class <1>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*
-keep class <1>_<2>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*
-keep class <1>_<2>_<3>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*
-keep class <1>_<2>_<3>_<4>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*$*
-keep class <1>_<2>_<3>_<4>_<5>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*$*$*
-keep class <1>_<2>_<3>_<4>_<5>_<6>JsonAdapter {
<init>(...);
<fields>;
}
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ android {
}
buildTypes {
debug {
useProguard false // R8 is used instead
minifyEnabled true
applicationIdSuffix ".debug"
versionNameSuffix "-DEBUG"
Expand All @@ -40,6 +41,7 @@ android {
proguardFile 'proguard-rules-debug.pro'
}
release {
useProguard false // R8 is used instead
debuggable false
minifyEnabled true

Expand Down
67 changes: 2 additions & 65 deletions app/proguard-rules-release.pro
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform

#OKHTT3 END
#OKHTTP3 END


#RETROFIT BEGIN
Expand Down Expand Up @@ -82,73 +82,10 @@
#RETROFIT END


##---------------Begin: proguard configuration for Moshi ----------
# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

-keepclasseswithmembers class * {
@com.squareup.moshi.* <methods>;
}

-keep @com.squareup.moshi.JsonQualifier interface *

# Enum field names are used by the integrated EnumJsonAdapter.
# Annotate enums with @JsonClass(generateAdapter = false) to use them with Moshi.
-keepclassmembers @com.squareup.moshi.JsonClass class * extends java.lang.Enum {
<fields>;
}

# The name of @JsonClass types is used to look up the generated adapter.
-keepnames @com.squareup.moshi.JsonClass class *

# Retain generated target class's synthetic defaults constructor and keep DefaultConstructorMarker's
# name. We will look this up reflectively to invoke the type's constructor.
#
# We can't _just_ keep the defaults constructor because Proguard/R8's spec doesn't allow wildcard
# matching preceding parameters.
-keepnames class kotlin.jvm.internal.DefaultConstructorMarker
-keepclassmembers @com.squareup.moshi.JsonClass @kotlin.Metadata class * {
synthetic <init>(...);
}

# Retain generated JsonAdapters if annotated type is retained.
-if @com.squareup.moshi.JsonClass class *
-keep class <1>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*
-keep class <1>_<2>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*
-keep class <1>_<2>_<3>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*
-keep class <1>_<2>_<3>_<4>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*$*
-keep class <1>_<2>_<3>_<4>_<5>JsonAdapter {
<init>(...);
<fields>;
}
-if @com.squareup.moshi.JsonClass class **$*$*$*$*$*
-keep class <1>_<2>_<3>_<4>_<5>_<6>JsonAdapter {
<init>(...);
<fields>;
}

##---------------End: proguard configuration for Moshi ----------


#keep rules

-keep class me.devsaki.hentoid.parsers.content.** { *; }
-keep class me.devsaki.hentoid.json.** { *; }
-keep class com.bumptech.glide.integration.okhttp3.OkHttpGlideModule

-keep public class * extends android.app.Activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class PururinParser extends BaseParser {

private static final String IMAGE_PATH = "//cdn.pururin.io/assets/images/data/";

private class PururinInfo {
public static class PururinInfo {
String image_extension;
String id;
}
Expand Down
6 changes: 1 addition & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@ android.databinding.incremental=true
android.enableSeparateAnnotationProcessing=true

# Modularise your project and enable parallel build
org.gradle.parallel=true

# https://stackoverflow.com/questions/56142150/fatal-exception-java-lang-nullpointerexception-in-release-build
# if there is an issue on release build uncomment line bellow
# android.enableR8=false
org.gradle.parallel=true

0 comments on commit 42d89fe

Please sign in to comment.