From 1cfb1f8509b41ebd2029bf1c2d43e46b1768c837 Mon Sep 17 00:00:00 2001 From: Farhan Arshad Date: Wed, 31 Jul 2024 13:52:44 +0500 Subject: [PATCH] fix: signed build issue with R8 full mode fixes: LEARNER-10122 --- app/build.gradle | 2 +- app/proguard-rules.pro | 113 ++++++--------------- auth/build.gradle | 2 +- auth/proguard-rules.pro | 24 +++++ core/build.gradle | 2 +- core/proguard-rules.pro | 49 ++++++++- course/build.gradle | 2 +- course/proguard-rules.pro | 22 +++- dashboard/build.gradle | 2 +- dashboard/proguard-rules.pro | 11 +- discovery/build.gradle | 2 +- discovery/proguard-rules.pro | 17 +++- discussion/build.gradle | 2 +- discussion/proguard-rules.pro | 16 ++- profile/build.gradle | 2 +- profile/proguard-rules.pro | 16 ++- shared-proguard-rules.pro | 182 ++++++++++++++++++++++++++++++++++ whatsnew/build.gradle | 2 +- whatsnew/proguard-rules.pro | 7 +- 19 files changed, 379 insertions(+), 96 deletions(-) create mode 100644 shared-proguard-rules.pro diff --git a/app/build.gradle b/app/build.gradle index b54c9db1e..81816345b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -95,7 +95,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' if (firebaseEnabled) { firebaseCrashlytics { diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index dc403e8f7..5ebb20b0c 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -20,92 +20,45 @@ # hide the original source file name. #-renamesourcefileattribute SourceFile -#====================/////Retrofit Rules\\\\\=============== -# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and -# EnclosingMethod is required to use InnerClasses. --keepattributes Signature, InnerClasses, EnclosingMethod - -# Retrofit does reflection on method and parameter annotations. --keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations - -# Keep annotation default values (e.g., retrofit2.http.Field.encoded). --keepattributes AnnotationDefault - -# Retain service method parameters when optimizing. --keepclassmembers,allowshrinking,allowobfuscation interface * { - @retrofit2.http.* ; -} - -# Ignore JSR 305 annotations for embedding nullability information. --dontwarn javax.annotation.** - -# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. --dontwarn kotlin.Unit - -# Top-level functions that can only be used by Kotlin. --dontwarn retrofit2.KotlinExtensions --dontwarn retrofit2.KotlinExtensions$* - -# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy -# and replaces all potential values with null. Explicitly keeping the interfaces prevents this. --if interface * { @retrofit2.http.* ; } --keep,allowobfuscation interface <1> - -# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). --keep,allowobfuscation,allowshrinking interface retrofit2.Call --keep,allowobfuscation,allowshrinking class retrofit2.Response - -# With R8 full mode generic signatures are stripped for classes that are not -# kept. Suspend functions are wrapped in continuations where the type argument -# is used. --keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation - -#===============/////GSON RULES \\\\\\\============ -##---------------Begin: proguard configuration for Gson ---------- -# Gson uses generic type information stored in a class file when working with fields. Proguard -# removes such information by default, so configure it to keep all of it. --keepattributes Signature - -# For using GSON @Expose annotation --keepattributes *Annotation* - -# Gson specific classes --dontwarn sun.misc.** -#-keep class com.google.gson.stream.** { *; } - -# Application classes that will be serialized/deserialized over Gson --keep class org.openedx.*.data.model.** { ; } - -# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, -# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) --keep class * extends com.google.gson.TypeAdapter --keep class * implements com.google.gson.TypeAdapterFactory --keep class * implements com.google.gson.JsonSerializer --keep class * implements com.google.gson.JsonDeserializer - -# Prevent R8 from leaving Data object members always null --keepclassmembers,allowobfuscation class * { - @com.google.gson.annotations.SerializedName ; -} - -# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher. --keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken --keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken - -##---------------End: proguard configuration for Gson ---------- - --keepclassmembers class * extends java.lang.Enum { - ; - public static **[] values(); - public static ** valueOf(java.lang.String); -} +-keep class org.openedx.app.AppActivity -dontwarn org.bouncycastle.jsse.BCSSLParameters -dontwarn org.bouncycastle.jsse.BCSSLSocket -dontwarn org.bouncycastle.jsse.provider.BouncyCastleJsseProvider +-dontwarn org.bouncycastle.asn1.ASN1Encodable +-dontwarn org.bouncycastle.asn1.pkcs.PrivateKeyInfo +-dontwarn org.bouncycastle.asn1.x509.AlgorithmIdentifier +-dontwarn org.bouncycastle.asn1.x509.SubjectPublicKeyInfo +-dontwarn org.bouncycastle.cert.X509CertificateHolder +-dontwarn org.bouncycastle.cert.jcajce.JcaX509CertificateHolder +-dontwarn org.bouncycastle.crypto.BlockCipher +-dontwarn org.bouncycastle.crypto.CipherParameters +-dontwarn org.bouncycastle.crypto.InvalidCipherTextException +-dontwarn org.bouncycastle.crypto.engines.AESEngine +-dontwarn org.bouncycastle.crypto.modes.GCMBlockCipher +-dontwarn org.bouncycastle.crypto.params.AEADParameters +-dontwarn org.bouncycastle.crypto.params.KeyParameter +-dontwarn org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider +-dontwarn org.bouncycastle.jce.provider.BouncyCastleProvider +-dontwarn org.bouncycastle.openssl.PEMKeyPair +-dontwarn org.bouncycastle.openssl.PEMParser +-dontwarn org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter + -dontwarn org.conscrypt.Conscrypt$Version -dontwarn org.conscrypt.Conscrypt -dontwarn org.conscrypt.ConscryptHostnameVerifier + -dontwarn org.openjsse.javax.net.ssl.SSLParameters -dontwarn org.openjsse.javax.net.ssl.SSLSocket --dontwarn org.openjsse.net.ssl.OpenJSSE \ No newline at end of file +-dontwarn org.openjsse.net.ssl.OpenJSSE + +-dontwarn com.google.crypto.tink.subtle.Ed25519Sign$KeyPair +-dontwarn com.google.crypto.tink.subtle.Ed25519Sign +-dontwarn com.google.crypto.tink.subtle.Ed25519Verify +-dontwarn com.google.crypto.tink.subtle.X25519 +-dontwarn edu.umd.cs.findbugs.annotations.NonNull +-dontwarn edu.umd.cs.findbugs.annotations.Nullable +-dontwarn edu.umd.cs.findbugs.annotations.SuppressFBWarnings + +-dontwarn com.segment.analytics.kotlin.core.platform.plugins.logger.LogFilterKind +-dontwarn com.segment.analytics.kotlin.core.platform.plugins.logger.LogTargetKt diff --git a/auth/build.gradle b/auth/build.gradle index 7cf4d0a86..b763f8760 100644 --- a/auth/build.gradle +++ b/auth/build.gradle @@ -33,7 +33,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' } } compileOptions { diff --git a/auth/proguard-rules.pro b/auth/proguard-rules.pro index 82ef50a20..15752c263 100644 --- a/auth/proguard-rules.pro +++ b/auth/proguard-rules.pro @@ -24,3 +24,27 @@ -keep class androidx.credentials.playservices.** { *; } + +-keep interface org.openedx.auth.presentation.AuthRouter { public *; } +-keep interface org.openedx.auth.presentation.AuthAnalytics { public *; } +-keep class org.openedx.auth.presentation.AgreementProvider { public *; } +-keep class org.openedx.auth.presentation.sso.** { public *; } + +-keep interface org.openedx.auth.data.api.AuthApi { public *; } +-keep class org.openedx.auth.data.api.AuthApi$DefaultImpls { public *; } + +-keep class org.openedx.auth.data.repository.AuthRepository { public *; } +-keep class org.openedx.auth.domain.interactor.AuthInteractor { public *; } + +-keep class org.openedx.auth.presentation.logistration.LogistrationViewModel { public *; } +-keep class org.openedx.auth.presentation.restore.RestorePasswordViewModel { public *; } +-keep class org.openedx.auth.presentation.signin.SignInViewModel { public *; } +-keep class org.openedx.auth.presentation.signup.SignUpViewModel { public *; } + +-keep class org.openedx.auth.presentation.logistration.LogistrationFragment { public *; } +-keep class org.openedx.auth.presentation.signin.SignInFragment$Companion { public *; } +-keep class org.openedx.auth.presentation.signin.SignInFragment { public *; } + +-keep class org.openedx.auth.presentation.restore.RestorePasswordFragment { public *; } +-keep class org.openedx.auth.presentation.signup.SignUpFragment$Companion { public *; } +-keep class org.openedx.auth.presentation.signup.SignUpFragment { public *; } diff --git a/core/build.gradle b/core/build.gradle index 89f99e1cd..b0ffcd4b6 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -71,7 +71,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' } } compileOptions { diff --git a/core/proguard-rules.pro b/core/proguard-rules.pro index a6be9313d..37477ffe8 100644 --- a/core/proguard-rules.pro +++ b/core/proguard-rules.pro @@ -20,4 +20,51 @@ # hide the original source file name. #-renamesourcefileattribute SourceFile --dontwarn java.lang.invoke.StringConcatFactory \ No newline at end of file +-dontwarn java.lang.invoke.StringConcatFactory + +-keep class org.openedx.core.config.** { + ; + ; +} +-keep class org.openedx.core.system.ResourceManager { *; } +-keep class org.openedx.core.ImageProcessor { *; } +-keep interface org.openedx.core.presentation.global.app_upgrade.AppUpgradeRouter { *; } +-keep class org.openedx.core.module.download.FileDownloader { *; } +-keep class org.openedx.core.module.DownloadWorkerController { *; } +-keep class org.openedx.core.presentation.global.AppData { *; } +-keep class org.openedx.core.presentation.dialog.appreview.AppReviewManager { *; } +-keep class org.openedx.core.module.TranscriptManager +-keep class org.openedx.core.module.billing.BillingProcessor +-keep class org.openedx.core.presentation.global.WhatsNewGlobalManager +-keep interface org.openedx.core.presentation.dialog.appreview.AppReviewAnalytics +-keep interface org.openedx.core.presentation.CoreAnalytics +-keep interface org.openedx.core.presentation.IAPAnalytics +-keep class org.openedx.core.utils.FileUtil { public *; } +-keep interface org.openedx.core.presentation.dialog.appreview.AppReviewAnalytics + +-keep interface org.openedx.core.data.api.CookiesApi +-keep interface org.openedx.core.data.api.CourseApi +-keep class org.openedx.core.data.api.CourseApi$DefaultImpls { *; } +-keep interface org.openedx.core.data.api.iap.InAppPurchasesApi +-keep class org.openedx.core.Validator + +-keep class org.openedx.core.presentation.dialog.selectorbottomsheet.SelectDialogViewModel +-keep class org.openedx.core.presentation.iap.IAPViewModel +-keep class org.openedx.core.presentation.settings.video.VideoQualityViewModel +-keep class org.openedx.core.module.download.BaseDownloadViewModel + +-keep class org.openedx.core.data.repository.iap.IAPRepository +-keep class org.openedx.core.domain.interactor.IAPInteractor +-keep interface org.openedx.core.presentation.global.InsetHolder { public *;} +-keep interface org.openedx.core.presentation.global.WindowSizeHolder +-keep class org.openedx.core.utils.Logger { public *; } +-keep class org.openedx.core.utils.TimeUtils { *; } +-keep class org.openedx.core.SingleEventLiveData { *; } +-keep class org.openedx.core.extension.** { static public *;} + +-keep class org.openedx.core.ui.** { public *;} + +-keep class org.openedx.core.exception.iap.* { public *;} +-keep class org.openedx.core.presentation.IAPAnalytics** { public *;} + +-keep class org.openedx.core.UIMessage** { public *;} diff --git a/course/build.gradle b/course/build.gradle index f746f4d09..ec844ce76 100644 --- a/course/build.gradle +++ b/course/build.gradle @@ -20,7 +20,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' } } compileOptions { diff --git a/course/proguard-rules.pro b/course/proguard-rules.pro index 481bb4348..c7c153580 100644 --- a/course/proguard-rules.pro +++ b/course/proguard-rules.pro @@ -18,4 +18,24 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-keep interface org.openedx.course.presentation.CourseRouter +-keep interface org.openedx.course.presentation.CourseAnalytics + +-keep class org.openedx.course.presentation.unit.container.CourseUnitContainerViewModel +-keep class org.openedx.course.presentation.unit.html.HtmlUnitViewModel +-keep class org.openedx.course.presentation.unit.video.BaseVideoViewModel +-keep class org.openedx.course.presentation.unit.video.EncodedVideoUnitViewModel +-keep class org.openedx.course.presentation.unit.video.VideoUnitViewModel +-keep class org.openedx.course.presentation.unit.video.VideoViewModel +-keep class org.openedx.course.presentation.videos.CourseVideoViewModel +-keep class org.openedx.course.settings.download.DownloadQueueViewModel + +-keep class org.openedx.course.data.repository.CourseRepository +-keep class org.openedx.course.domain.interactor.CourseInteractor +-keep class org.openedx.course.presentation.container.CourseContainerViewModel +-keep class org.openedx.course.presentation.dates.CourseDatesViewModel +-keep class org.openedx.course.presentation.handouts.HandoutsViewModel +-keep class org.openedx.course.presentation.outline.CourseOutlineViewModel +-keep class org.openedx.course.presentation.section.CourseSectionViewModel diff --git a/dashboard/build.gradle b/dashboard/build.gradle index c0c3192d0..5f787a218 100644 --- a/dashboard/build.gradle +++ b/dashboard/build.gradle @@ -19,7 +19,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' } } diff --git a/dashboard/proguard-rules.pro b/dashboard/proguard-rules.pro index 481bb4348..b49fb2eef 100644 --- a/dashboard/proguard-rules.pro +++ b/dashboard/proguard-rules.pro @@ -18,4 +18,13 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-keep interface org.openedx.dashboard.presentation.DashboardRouter +-keep interface org.openedx.dashboard.presentation.DashboardAnalytics +-keep class org.openedx.dashboard.data.repository.DashboardRepository { *; } +-keep class org.openedx.dashboard.domain.interactor.DashboardInteractor { *; } +-keep class org.openedx.dashboard.presentation.DashboardListViewModel { *; } +-keep class org.openedx.courses.presentation.DashboardGalleryViewModel { *; } +-keep class org.openedx.courses.presentation.AllEnrolledCoursesViewModel +-keep class org.openedx.learn.presentation.LearnViewModel diff --git a/discovery/build.gradle b/discovery/build.gradle index 881d8c05a..98239ed39 100644 --- a/discovery/build.gradle +++ b/discovery/build.gradle @@ -21,7 +21,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' } } diff --git a/discovery/proguard-rules.pro b/discovery/proguard-rules.pro index 481bb4348..e431dcfa6 100644 --- a/discovery/proguard-rules.pro +++ b/discovery/proguard-rules.pro @@ -18,4 +18,19 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-keep interface org.openedx.discovery.presentation.DiscoveryRouter +-keep interface org.openedx.discovery.presentation.DiscoveryAnalytics +-keep interface org.openedx.discovery.data.api.DiscoveryApi +-keep class org.openedx.discovery.data.repository.DiscoveryRepository +-keep class org.openedx.discovery.domain.interactor.DiscoveryInteractor +-keep class org.openedx.discovery.presentation.NativeDiscoveryViewModel +-keep class org.openedx.discovery.presentation.WebViewDiscoveryViewModel + +-keep class org.openedx.discovery.presentation.detail.CourseDetailsViewModel +-keep class org.openedx.discovery.presentation.info.CourseInfoViewModel +-keep class org.openedx.discovery.presentation.program.ProgramViewModel +-keep class org.openedx.discovery.presentation.search.CourseSearchViewModel +-keep class org.openedx.discovery.data.converter.DiscoveryConverter + diff --git a/discussion/build.gradle b/discussion/build.gradle index 77d393d7a..65b5020f2 100644 --- a/discussion/build.gradle +++ b/discussion/build.gradle @@ -19,7 +19,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' } } compileOptions { diff --git a/discussion/proguard-rules.pro b/discussion/proguard-rules.pro index 481bb4348..9d77f63a5 100644 --- a/discussion/proguard-rules.pro +++ b/discussion/proguard-rules.pro @@ -18,4 +18,18 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-keep interface org.openedx.discussion.presentation.DiscussionRouter +-keep interface org.openedx.discussion.presentation.DiscussionAnalytics +-keep interface org.openedx.discussion.data.api.DiscussionApi + +-keep class org.openedx.discussion.data.repository.DiscussionRepository +-keep class org.openedx.discussion.domain.interactor.DiscussionInteractor + +-keep class org.openedx.discussion.presentation.comments.DiscussionCommentsViewModel +-keep class org.openedx.discussion.presentation.responses.DiscussionResponsesViewModel +-keep class org.openedx.discussion.presentation.search.DiscussionSearchThreadViewModel +-keep class org.openedx.discussion.presentation.threads.DiscussionAddThreadViewModel +-keep class org.openedx.discussion.presentation.threads.DiscussionThreadsViewModel +-keep class org.openedx.discussion.presentation.topics.DiscussionTopicsViewModel \ No newline at end of file diff --git a/profile/build.gradle b/profile/build.gradle index 1c3c6f301..7a3fb06c6 100644 --- a/profile/build.gradle +++ b/profile/build.gradle @@ -19,7 +19,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' } } diff --git a/profile/proguard-rules.pro b/profile/proguard-rules.pro index 481bb4348..b394aee9a 100644 --- a/profile/proguard-rules.pro +++ b/profile/proguard-rules.pro @@ -18,4 +18,18 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-keep interface org.openedx.profile.presentation.ProfileRouter { public *;} +-keep interface org.openedx.profile.presentation.ProfileAnalytics { public *;} +-keep interface org.openedx.profile.data.api.ProfileApi { public *;} +-keep class org.openedx.profile.data.repository.ProfileRepository { public *;} +-keep class org.openedx.profile.domain.interactor.ProfileInteractor { public *;} +-keep class org.openedx.profile.presentation.anothersaccount.AnothersProfileViewModel { public *;} +-keep class org.openedx.profile.presentation.profile.ProfileViewModel { public *;} +-keep class org.openedx.profile.presentation.edit.EditProfileViewModel { public *;} +-keep class org.openedx.profile.presentation.manageaccount.ManageAccountViewModel { public *;} +-keep class org.openedx.profile.presentation.settings.SettingsViewModel { public *;} +-keep class org.openedx.profile.presentation.video.VideoSettingsViewModel { public *;} +-keep class org.openedx.profile.presentation.calendar.CalendarViewModel { public *;} +-keep class org.openedx.profile.presentation.delete.DeleteProfileViewModel { public *;} \ No newline at end of file diff --git a/shared-proguard-rules.pro b/shared-proguard-rules.pro new file mode 100644 index 000000000..87843f9c6 --- /dev/null +++ b/shared-proguard-rules.pro @@ -0,0 +1,182 @@ +# Add project shared ProGuard rules here. + +#====================/////Retrofit Rules\\\\\=============== +# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and +# EnclosingMethod is required to use InnerClasses. +-keepattributes Signature, InnerClasses, EnclosingMethod + +# Retrofit does reflection on method and parameter annotations. +-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations + +# Keep annotation default values (e.g., retrofit2.http.Field.encoded). +-keepattributes AnnotationDefault + +# Retain service method parameters when optimizing. +-keepclassmembers,allowshrinking,allowobfuscation interface * { + @retrofit2.http.* ; +} + +# Ignore JSR 305 annotations for embedding nullability information. +-dontwarn javax.annotation.** + +# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath. +-dontwarn kotlin.Unit + +# Top-level functions that can only be used by Kotlin. +-dontwarn retrofit2.KotlinExtensions +-dontwarn retrofit2.KotlinExtensions$* + +# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy +# and replaces all potential values with null. Explicitly keeping the interfaces prevents this. +-if interface * { @retrofit2.http.* ; } +-keep,allowobfuscation interface <1> +-keep,allowobfuscation interface <1> + +# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items). +-keep,allowobfuscation,allowshrinking interface retrofit2.Call +-keep,allowobfuscation,allowshrinking class retrofit2.Response + +##---------------End: proguard configuration for Retrofit ---------- + +#===============/////GSON RULES \\\\\\\============ +##---------------Begin: proguard configuration for Gson ---------- +# Gson uses generic type information stored in a class file when working with fields. Proguard +# removes such information by default, so configure it to keep all of it. +-keepattributes Signature + +# For using GSON @Expose annotation +-keepattributes *Annotation* + +# Gson specific classes +-dontwarn sun.misc.** +#-keep class com.google.gson.stream.** { *; } + +# Application classes that will be serialized/deserialized over Gson +-keep class org.openedx.*.data.model.** { public *; } +-keeppackagenames org.openedx.*.data.** + +# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory, +# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter) +-keep class * extends com.google.gson.TypeAdapter +-keep class * implements com.google.gson.TypeAdapterFactory +-keep class * implements com.google.gson.JsonSerializer +-keep class * implements com.google.gson.JsonDeserializer + +# Prevent R8 from leaving Data object members always null +-keepclassmembers,allowobfuscation class * { + @com.google.gson.annotations.SerializedName ; +} + +# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher. +-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken +-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken + +##---------------End: proguard configuration for Gson ---------- + +# With R8 full mode generic signatures are stripped for classes that are not +# kept. Suspend functions are wrapped in continuations where the type argument +# is used. +-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation + +-keepclassmembers class * extends java.lang.Enum { + ; + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { *; } +-keep @androidx.room.Dao class * { *; } + +# Application data classes +-keep class org.openedx.*.domain.model.** { public *; } +-keeppackagenames org.openedx.*.domain.** + +-keep class org.openedx.*.data.storage.** { public *; } +-keeppackagenames org.openedx.*.data.** + +-dontwarn org.openedx.core.** +-keeppackagenames org.openedx.core.** +-keeppackagenames org.openedx.*.presentation.** +-keepclassmembers class * { public (...); } + +-keep class org.openedx.*.system.** { *; } + +-keep class org.openedx.core.BaseViewModel { *; } + +-dontwarn org.openedx.core.presentation.dialog.IAPDialogFragment$Companion +-dontwarn org.openedx.core.presentation.dialog.IAPDialogFragment +-dontwarn org.openedx.core.presentation.iap.IAPAction +-dontwarn org.openedx.core.presentation.iap.IAPRequestType +-dontwarn org.openedx.core.presentation.iap.IAPUIState$Error +-dontwarn org.openedx.core.presentation.iap.IAPUIState$PurchasesFulfillmentCompleted +-dontwarn org.openedx.core.AppDataConstants +-dontwarn org.openedx.core.BlockType +#------------------------- End ----------------------------- + +-dontwarn org.openedx.core.AppUpdateState$AppUpgradeParameters +-dontwarn org.openedx.core.AppUpdateState +-dontwarn org.openedx.core.presentation.global.app_upgrade.AppUpdateUIKt +-dontwarn org.openedx.core.presentation.iap.IAPUIState$Clear +-dontwarn org.openedx.core.presentation.iap.IAPUIState + +-dontwarn org.openedx.core.exception.NoCachedDataException +-dontwarn org.openedx.core.module.db.DownloadModel +-dontwarn org.openedx.core.module.db.DownloadedState +-dontwarn org.openedx.core.module.download.DownloadModelsSize +-dontwarn org.openedx.core.presentation.global.ErrorType +-dontwarn org.openedx.core.presentation.settings.calendarsync.CalendarSyncDialogType +-dontwarn org.openedx.core.presentation.settings.calendarsync.CalendarSyncUIState + +-dontwarn org.openedx.core.presentation.iap.IAPLoaderType +-dontwarn org.openedx.core.presentation.iap.IAPUIState$FakePurchasesFulfillmentCompleted +-dontwarn org.openedx.core.presentation.iap.IAPUIState$Loading +-dontwarn org.openedx.core.presentation.settings.video.VideoQualityType + + +-dontwarn org.openedx.core.FragmentViewType +-dontwarn org.openedx.core.adapter.NavigationFragmentAdapter + +-dontwarn org.openedx.core.module.db.DownloadModelEntity +-dontwarn org.openedx.core.presentation.course.CourseViewMode +-dontwarn org.openedx.core.presentation.global.FragmentViewBindingDelegate +-dontwarn org.openedx.core.presentation.global.FragmentViewBindingDelegateKt + +-dontwarn org.openedx.core.presentation.iap.IAPFlow +-dontwarn org.openedx.course.presentation.container.CourseContainerFragment$Companion +-dontwarn org.openedx.course.presentation.container.CourseContainerFragment + +-dontwarn org.openedx.course.presentation.handouts.HandoutsType +-dontwarn org.openedx.course.presentation.handouts.HandoutsWebViewFragment$Companion +-dontwarn org.openedx.course.presentation.handouts.HandoutsWebViewFragment +-dontwarn org.openedx.course.presentation.unit.container.CourseUnitContainerFragment$Companion +-dontwarn org.openedx.course.presentation.unit.container.CourseUnitContainerFragment + +-dontwarn org.openedx.dashboard.presentation.DashboardRouter$DefaultImpls +-dontwarn org.openedx.discovery.presentation.DiscoveryNavigator +-dontwarn org.openedx.discovery.presentation.NativeDiscoveryFragment$Companion +-dontwarn org.openedx.discovery.presentation.NativeDiscoveryFragment +-dontwarn org.openedx.discovery.presentation.WebViewDiscoveryFragment$Companion +-dontwarn org.openedx.discovery.presentation.WebViewDiscoveryFragment +-dontwarn org.openedx.discovery.presentation.info.CourseInfoFragment$Companion +-dontwarn org.openedx.discovery.presentation.info.CourseInfoFragment +-dontwarn org.openedx.discovery.presentation.program.ProgramFragment$Companion +-dontwarn org.openedx.discovery.presentation.program.ProgramFragment + +-dontwarn org.openedx.discussion.presentation.comments.DiscussionCommentsFragment$Companion +-dontwarn org.openedx.discussion.presentation.comments.DiscussionCommentsFragment +-dontwarn org.openedx.discussion.presentation.responses.DiscussionResponsesFragment$Companion +-dontwarn org.openedx.discussion.presentation.responses.DiscussionResponsesFragment + +-dontwarn org.openedx.discussion.presentation.threads.DiscussionThreadsFragment$Companion +-dontwarn org.openedx.discussion.presentation.threads.DiscussionThreadsFragment +-dontwarn org.openedx.learn.presentation.LearnFragment$Companion +-dontwarn org.openedx.learn.presentation.LearnFragment +-dontwarn org.openedx.learn.presentation.LearnTab + +-dontwarn org.openedx.profile.presentation.profile.ProfileFragment +-dontwarn org.openedx.whatsnew.presentation.whatsnew.WhatsNewFragment$Companion +-dontwarn org.openedx.whatsnew.presentation.whatsnew.WhatsNewFragment + +-dontwarn org.openedx.auth.presentation.restore.RestorePasswordFragment +-dontwarn org.openedx.auth.presentation.signup.SignUpFragment$Companion +-dontwarn org.openedx.auth.presentation.signup.SignUpFragment diff --git a/whatsnew/build.gradle b/whatsnew/build.gradle index 4a400063e..cf5102591 100644 --- a/whatsnew/build.gradle +++ b/whatsnew/build.gradle @@ -19,7 +19,7 @@ android { buildTypes { release { minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro', '../shared-proguard-rules.pro' } } diff --git a/whatsnew/proguard-rules.pro b/whatsnew/proguard-rules.pro index 481bb4348..42b9fecee 100644 --- a/whatsnew/proguard-rules.pro +++ b/whatsnew/proguard-rules.pro @@ -18,4 +18,9 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile + +-keep interface org.openedx.whatsnew.WhatsNewRouter +-keep interface org.openedx.whatsnew.presentation.WhatsNewAnalytics +-keep class org.openedx.whatsnew.WhatsNewManager { *; } +-keep class org.openedx.whatsnew.presentation.whatsnew.WhatsNewViewModel