From 968f131f87b65a41e24195b06ef058170944d230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E4=B9=8B=E5=B2=87?= Date: Thu, 2 May 2024 19:11:37 +0800 Subject: [PATCH] perf: android proguard rules Signed-off-by: Kraity (cherry picked from commit 1fccc2b16bc1ef9f059326bd6f52f76016979457) --- .../resources/META-INF/proguard/fastjson2.pro | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 core/src/main/resources/META-INF/proguard/fastjson2.pro diff --git a/core/src/main/resources/META-INF/proguard/fastjson2.pro b/core/src/main/resources/META-INF/proguard/fastjson2.pro new file mode 100644 index 0000000000..0a9603e8b2 --- /dev/null +++ b/core/src/main/resources/META-INF/proguard/fastjson2.pro @@ -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 ; + @com.alibaba.fastjson2.annotation.JSONField ; +} + +# 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 ; +} +-keep, allowobfuscation, allowoptimization class <1> +-if class * { + @com.alibaba.fastjson2.annotation.JSONField ; +} +-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