Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[android, sdk] Fix shrinking rules (again) #7302

Merged
merged 1 commit into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions tuta-sdk/android/sdk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ android {
isJniDebuggable = true
}
release {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
// Do not apply minification to the library artifact itself, without the application code that references
// the specific classes we cannot know what we need to keep so we would have to effectively disable
// minification anyway.
isMinifyEnabled = false
}
create("releaseTest") {
initWith(getByName("release"))
Expand Down
25 changes: 19 additions & 6 deletions tuta-sdk/android/sdk/consumer-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@
# See https://developer.android.com/build/shrink-code#configuration-files
# See https://developer.android.com/studio/projects/android-library#Considerations

# Keep generated SDK types. A lot of them are accessed using JNA or are part of generated entities.
-keep class de.tutao.tutasdk.**
# The rule below would keep all the generated classes. This is currently not necessary as shrinker should find the
# referenced classes and their methods from what is actually used by the application code. If that doesn't work it's
# probably misconfiguration on the app's side.
# This might change in the future if we reference the types in a more dynamic way but currently the graph can be
# traversed statically.
#-keep class de.tutao.tutasdk.** {
# *;
#}

# Some AWT things are referenced by JNA for some reason. But we really, really don't use AWT.
-dontwarn java.awt.*
# JNA is needed for uniffi and some things are resolved dynamically when called from native.
-keep class com.sun.jna.**
-keep class * extends com.sun.jna.**
-keep class * implements com.sun.jna.**
# JNA is needed for uniffi and some private static methods on it are called from native.
-keep class com.sun.jna.** {
*;
}
-keep class * extends com.sun.jna.** {
*;
}
-keep class * implements com.sun.jna.** {
*;
}
11 changes: 0 additions & 11 deletions tuta-sdk/android/sdk/proguard-rules.pro

This file was deleted.