From e0bb1da258ccfb36709a531b2ed80c2bc72412f9 Mon Sep 17 00:00:00 2001 From: Jorge Martin Espinosa Date: Mon, 6 Mar 2023 19:40:05 +0100 Subject: [PATCH] Add consumer proguard rules for SQLCipher (#138) * Add consumer proguard rules for SQLCipher * Add changelog * Explain why these rules are necessary Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> * Try to switch to a supported version of Compose Rules to avoid dependency issues --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> --- build.gradle.kts | 2 +- changelog.d/138.bugfix | 3 +++ libraries/encrypted-db/build.gradle.kts | 7 ++++++ .../encrypted-db/consumer-proguard-rules.pro | 25 +++++++++++++++++++ tools/detekt/detekt.yml | 2 +- 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 changelog.d/138.bugfix create mode 100644 libraries/encrypted-db/consumer-proguard-rules.pro diff --git a/build.gradle.kts b/build.gradle.kts index 06c6b90f71..36107ea00c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -54,7 +54,7 @@ allprojects { config = files("$rootDir/tools/detekt/detekt.yml") } dependencies { - detektPlugins("com.twitter.compose.rules:detekt:0.0.26") + detektPlugins("io.nlopez.compose.rules:detekt:0.1.2") } // KtLint diff --git a/changelog.d/138.bugfix b/changelog.d/138.bugfix new file mode 100644 index 0000000000..f33fbe310d --- /dev/null +++ b/changelog.d/138.bugfix @@ -0,0 +1,3 @@ +Add consumer proguard rules for SQLCipher. + +Thanks @anoadragon453 for reporting and the tentative fix! diff --git a/libraries/encrypted-db/build.gradle.kts b/libraries/encrypted-db/build.gradle.kts index 71ccfe65f7..e904072898 100644 --- a/libraries/encrypted-db/build.gradle.kts +++ b/libraries/encrypted-db/build.gradle.kts @@ -20,6 +20,13 @@ plugins { android { namespace = "io.element.android.libraries.encrypteddb" + + buildTypes { + release { + isMinifyEnabled = true + consumerProguardFiles("consumer-proguard-rules.pro") + } + } } dependencies { diff --git a/libraries/encrypted-db/consumer-proguard-rules.pro b/libraries/encrypted-db/consumer-proguard-rules.pro new file mode 100644 index 0000000000..5d01f21e9b --- /dev/null +++ b/libraries/encrypted-db/consumer-proguard-rules.pro @@ -0,0 +1,25 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile + +# Prevent ProGuard from renaming internal SQLCipher classes, which breaks the library. +# From https://github.com/sqlcipher/android-database-sqlcipher#proguard +-keep class net.sqlcipher.** { *; } diff --git a/tools/detekt/detekt.yml b/tools/detekt/detekt.yml index 6d9e255434..e77443fcab 100644 --- a/tools/detekt/detekt.yml +++ b/tools/detekt/detekt.yml @@ -103,7 +103,7 @@ comments: UndocumentedPublicProperty: active: false -TwitterCompose: +Compose: CompositionLocalAllowlist: active: true # You can optionally define a list of CompositionLocals that are allowed here