From 6fcb177f98cdfc0e6d0ea45f5b3890d643eb4f0f Mon Sep 17 00:00:00 2001 From: Akash Yadav Date: Mon, 1 Jul 2024 17:19:15 +0530 Subject: [PATCH] fix: add missing proguard rules --- core/app/.gitignore | 1 - core/app/proguard-rules.pro | 150 ++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 1 deletion(-) create mode 100755 core/app/proguard-rules.pro diff --git a/core/app/.gitignore b/core/app/.gitignore index c44886b120..4fe473bf87 100755 --- a/core/app/.gitignore +++ b/core/app/.gitignore @@ -97,4 +97,3 @@ lint/tmp/ # Proguard files dictionary.txt -proguard-rules.pro diff --git a/core/app/proguard-rules.pro b/core/app/proguard-rules.pro new file mode 100755 index 0000000000..61a057052e --- /dev/null +++ b/core/app/proguard-rules.pro @@ -0,0 +1,150 @@ +-ignorewarnings + +-dontwarn ** +-dontnote ** +-dontobfuscate + +-keep class javax.** { *; } +-keep class jdkx.** { *; } + +# keep javac classes +-keep class openjdk.** { *; } + +# Android builder model interfaces +-keep class com.android.** { *; } + +# Tooling API classes +-keep class com.itsaky.androidide.tooling.** { *; } + +# Builder model implementations +-keep class com.itsaky.androidide.builder.model.** { *; } + +# Eclipse +-keep class org.eclipse.** { *; } + +# JAXP +-keep class jaxp.** { *; } +-keep class org.w3c.** { *; } +-keep class org.xml.** { *; } + +# Services +-keep @com.google.auto.service.AutoService class ** { +} +-keepclassmembers class ** { + @com.google.auto.service.AutoService ; +} + +# EventBus +-keepclassmembers class ** { + @org.greenrobot.eventbus.Subscribe ; +} +-keep enum org.greenrobot.eventbus.ThreadMode { *; } +-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent { + (java.lang.Throwable); +} + +# Accessed reflectively +-keep class io.github.rosemoe.sora.widget.component.EditorAutoCompletion { + io.github.rosemoe.sora.widget.component.EditorCompletionAdapter adapter; + int currentSelection; +} +-keep class com.itsaky.androidide.projects.util.StringSearch { + packageName(java.nio.file.Path); +} +-keep class * implements org.antlr.v4.runtime.Lexer { + (...); +} +-keep class * extends com.itsaky.androidide.lsp.java.providers.completion.IJavaCompletionProvider { + (...); +} +-keep class com.itsaky.androidide.editor.api.IEditor { *; } +-keep class * extends com.itsaky.androidide.inflater.IViewAdapter { *; } +-keep class * extends com.itsaky.androidide.inflater.drawable.IDrawableParser { + (...); + android.graphics.drawable.Drawable parse(); + android.graphics.drawable.Drawable parseDrawable(); +} +-keep class com.itsaky.androidide.utils.DialogUtils { public ; } + +# APK Metadata +-keep class com.itsaky.androidide.models.ApkMetadata { *; } +-keep class com.itsaky.androidide.models.ArtifactType { *; } +-keep class com.itsaky.androidide.models.MetadataElement { *; } + +# Parcelable +-keepclassmembers class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator CREATOR; +} + +# Used in preferences +-keep enum org.eclipse.lemminx.dom.builder.EmptyElements { *; } +-keep enum com.itsaky.androidide.xml.permissions.Permission { *; } + +# Lots of native methods in tree-sitter +# There are some fields as well that are accessed from native field +-keepclasseswithmembers class ** { + native ; +} + +-keep class com.itsaky.androidide.treesitter.** { *; } + +# Retrofit 2 +-dontwarn retrofit2.** +-keep class retrofit2.** { *; } + +-keepclasseswithmembers class * { + @retrofit2.http.* ; +} + +# OkHttp3 +-keep class okhttp3.** { *; } +-keep interface okhttp3.** { *; } +-dontwarn okhttp3.** + +# Stat uploader +-keep class com.itsaky.androidide.stats.** { *; } + +# Gson +-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 + +-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 + +## Themes +-keep enum com.itsaky.androidide.ui.themes.IDETheme { + *; +} + +## Contributor models - deserialized with GSON +-keep class * implements com.itsaky.androidide.contributors.Contributor { + *; +} + +# Suppress wissing class warnings +## These are used in annotation processing process in the Java Compiler +-dontwarn sun.reflect.annotation.AnnotationParser +-dontwarn sun.reflect.annotation.AnnotationType +-dontwarn sun.reflect.annotation.EnumConstantNotPresentExceptionProxy +-dontwarn sun.reflect.annotation.ExceptionProxy + +## Used in Logback. We do not need this though. +-dontwarn jakarta.servlet.ServletContainerInitializer + +## These are used in JGit +## TODO(itsaky): Verify if it is safe to ignore these warnings +-dontwarn java.lang.ProcessHandle +-dontwarn java.lang.management.ManagementFactory +-dontwarn org.ietf.jgss.GSSContext +-dontwarn org.ietf.jgss.GSSCredential +-dontwarn org.ietf.jgss.GSSException +-dontwarn org.ietf.jgss.GSSManager +-dontwarn org.ietf.jgss.GSSName +-dontwarn org.ietf.jgss.Oid \ No newline at end of file