Skip to content

Commit

Permalink
perf: android proguard rules
Browse files Browse the repository at this point in the history
Signed-off-by: Kraity <kraity@krait.cn>
(cherry picked from commit 1fccc2b)
  • Loading branch information
kraity authored and wenshao committed May 3, 2024
1 parent f3da568 commit f30ae5f
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 f30ae5f

Please sign in to comment.