Skip to content

Commit

Permalink
perf: android proguard rules (#2511)
Browse files Browse the repository at this point in the history
Signed-off-by: Kraity <kraity@krait.cn>
  • Loading branch information
kraity authored May 2, 2024
1 parent 49c5877 commit 1fccc2b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions core/src/main/resources/META-INF/proguard/fastjson2.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-keep, allowoptimization, allowobfuscation
@com.alibaba.fastjson2.annotation.JSONType class *
# Keep the fields and methods with @JSONField
-keepclassmembers, allowobfuscation class * {
@com.alibaba.fastjson2.annotation.JSONField <fields>;
@com.alibaba.fastjson2.annotation.JSONField <methods>;
}

# Ignore warning
-dontwarn java.beans.Transient
-dontwarn com.alibaba.fastjson.*

# Keep the fields and methods annotated with
# @JSONField for classes which are referenced
-if class * {
@com.alibaba.fastjson2.annotation.JSONField <fields>;
}
-keep, allowobfuscation, allowoptimization class <1>
-if class * {
@com.alibaba.fastjson2.annotation.JSONField <methods>;
}
-keep, allowobfuscation, allowoptimization class <1>

# Keep any (anonymous) classes extending TypeReference
-keep, allowobfuscation class com.alibaba.fastjson2.TypeReference
-keep, allowobfuscation class * extends com.alibaba.fastjson2.TypeReference

0 comments on commit 1fccc2b

Please sign in to comment.