Jeongik Cha | 4d8477e | 2024-10-30 13:27:51 +0900 | [diff] [blame] | 1 | ##---------------Begin: proguard configuration for Gson ---------- |
| 2 | # Gson uses generic type information stored in a class file when working with fields. Proguard |
| 3 | # removes such information by default, so configure it to keep all of it. |
| 4 | -keepattributes Signature |
| 5 | |
| 6 | # For using GSON @Expose annotation |
Christoffer Adamsen | efcac11 | 2025-01-17 04:42:46 -0800 | [diff] [blame] | 7 | -keepattributes RuntimeVisibleAnnotations, |
| 8 | RuntimeVisibleParameterAnnotations, |
| 9 | RuntimeVisibleTypeAnnotations, |
| 10 | AnnotationDefault |
Jeongik Cha | 4d8477e | 2024-10-30 13:27:51 +0900 | [diff] [blame] | 11 | |
| 12 | # Gson specific classes |
| 13 | -dontwarn sun.misc.** |
| 14 | #-keep class com.google.gson.stream.** { *; } |
| 15 | |
| 16 | # Application classes that will be serialized/deserialized over Gson |
Seungjae Yoo | 675f133 | 2024-11-20 19:29:05 +0900 | [diff] [blame] | 17 | -keep class com.android.virtualization.terminal.ConfigJson { <fields>; } |
| 18 | -keep class com.android.virtualization.terminal.ConfigJson$* { <fields>; } |
Jeongik Cha | 4d8477e | 2024-10-30 13:27:51 +0900 | [diff] [blame] | 19 | |
| 20 | # Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, |
| 21 | # JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) |
Christoffer Adamsen | 1353773 | 2025-01-06 17:22:22 +0100 | [diff] [blame] | 22 | # TODO(b/373579455): Evaluate if <init> needs to be kept. |
| 23 | -keep class * extends com.google.gson.TypeAdapter { |
| 24 | void <init>(); |
| 25 | } |
| 26 | # TODO(b/373579455): Evaluate if <init> needs to be kept. |
| 27 | -keep class * implements com.google.gson.TypeAdapterFactory { |
| 28 | void <init>(); |
| 29 | } |
| 30 | # TODO(b/373579455): Evaluate if <init> needs to be kept. |
| 31 | -keep class * implements com.google.gson.JsonSerializer { |
| 32 | void <init>(); |
| 33 | } |
| 34 | # TODO(b/373579455): Evaluate if <init> needs to be kept. |
| 35 | -keep class * implements com.google.gson.JsonDeserializer { |
| 36 | void <init>(); |
| 37 | } |
Jeongik Cha | 4d8477e | 2024-10-30 13:27:51 +0900 | [diff] [blame] | 38 | |
| 39 | # Prevent R8 from leaving Data object members always null |
| 40 | -keepclassmembers,allowobfuscation class * { |
| 41 | @com.google.gson.annotations.SerializedName <fields>; |
Jeongik Cha | 4a8ee3a | 2024-09-20 18:06:29 +0900 | [diff] [blame] | 42 | } |
Jeongik Cha | 4d8477e | 2024-10-30 13:27:51 +0900 | [diff] [blame] | 43 | |
| 44 | # Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher. |
Christoffer Adamsen | 1353773 | 2025-01-06 17:22:22 +0100 | [diff] [blame] | 45 | # TODO(b/373579455): Evaluate if <init> needs to be kept. |
| 46 | -keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken { |
| 47 | void <init>(); |
| 48 | } |
| 49 | # TODO(b/373579455): Evaluate if <init> needs to be kept. |
| 50 | -keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken { |
| 51 | void <init>(); |
| 52 | } |
Jeongik Cha | 4d8477e | 2024-10-30 13:27:51 +0900 | [diff] [blame] | 53 | |
Jiyong Park | 6a2a4dc | 2024-11-05 07:33:00 +0900 | [diff] [blame] | 54 | ##---------------End: proguard configuration for Gson ---------- |