mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-24 02:25:28 +00:00
Added more proguard restrictions and rules for kotlin and moshi
This commit is contained in:
parent
a7eec2f0a0
commit
c06081b75d
@ -28,7 +28,7 @@ android {
|
|||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', 'proguard-moshi.pro', 'proguard-kotlin.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
app/proguard-kotlin.pro
Normal file
15
app/proguard-kotlin.pro
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
-dontusemixedcaseclassnames
|
||||||
|
-keep class kotlin.** { *; }
|
||||||
|
-keep class kotlin.Metadata { *; }
|
||||||
|
-dontwarn kotlin.**
|
||||||
|
-keepclassmembers class kotlin.Metadata {
|
||||||
|
public <methods>;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Removes runtime null checks - doesn't really matter if it crashes on kotlin or java NPE
|
||||||
|
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
||||||
|
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Useless option for dex
|
||||||
|
-dontpreverify
|
49
app/proguard-moshi.pro
Normal file
49
app/proguard-moshi.pro
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# 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 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>;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user