2018-08-15 20:46:37 +02:00
|
|
|
# GENERAL OPTIONS
|
|
|
|
|
|
|
|
# turn on all optimizations except those that are known to cause problems on Android
|
|
|
|
-optimizations !code/simplification/cast,!field/*,!class/merging/*
|
|
|
|
-optimizationpasses 6
|
|
|
|
-allowaccessmodification
|
|
|
|
|
|
|
|
-dontusemixedcaseclassnames
|
|
|
|
-keepattributes *Annotation*
|
|
|
|
|
|
|
|
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
|
|
|
|
-keepclasseswithmembernames class * {
|
|
|
|
native <methods>;
|
|
|
|
}
|
|
|
|
# keep setters in Views so that animations can still work.
|
|
|
|
# see http://proguard.sourceforge.net/manual/examples.html#beans
|
|
|
|
-keepclassmembers public class * extends android.view.View {
|
2020-06-04 20:17:07 +02:00
|
|
|
void set*(***);
|
|
|
|
*** get*();
|
2018-08-15 20:46:37 +02:00
|
|
|
}
|
|
|
|
# We want to keep methods in Activity that could be used in the XML attribute onClick
|
|
|
|
-keepclassmembers class * extends android.app.Activity {
|
2020-06-04 20:17:07 +02:00
|
|
|
public void *(android.view.View);
|
2018-08-15 20:46:37 +02:00
|
|
|
}
|
|
|
|
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
|
|
|
|
-keepclassmembers enum * {
|
|
|
|
public static **[] values();
|
|
|
|
public static ** valueOf(java.lang.String);
|
|
|
|
}
|
|
|
|
-keepclassmembers class * implements android.os.Parcelable {
|
2020-06-04 20:17:07 +02:00
|
|
|
public static final ** CREATOR;
|
2018-08-15 20:46:37 +02:00
|
|
|
}
|
|
|
|
|
2022-01-20 21:10:32 +01:00
|
|
|
-keepclassmembers class **.R$* {
|
|
|
|
public static <fields>;
|
|
|
|
}
|
|
|
|
|
2023-09-05 13:28:56 +02:00
|
|
|
# Pachli specific options
|
2017-04-08 00:08:51 +02:00
|
|
|
|
2020-06-04 20:17:07 +02:00
|
|
|
# keep members of our model classes, they are used in json de/serialization
|
2024-01-19 09:39:44 +01:00
|
|
|
-keepclassmembers class app.pachli.core.network.model.** { *; }
|
2017-04-08 00:08:51 +02:00
|
|
|
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
-keep public enum app.pachli.core.network.model.*$** {
|
2017-04-08 00:08:51 +02:00
|
|
|
**[] $VALUES;
|
|
|
|
public *;
|
|
|
|
}
|
|
|
|
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
-keepclassmembers class app.pachli.core.database.model.ConversationAccountEntity { *; }
|
|
|
|
-keepclassmembers class app.pachli.core.database.model.DraftAttachment { *; }
|
2022-02-14 19:20:15 +01:00
|
|
|
|
refactor: Start creating core modules (#286)
The existing code base is a single monolithic module. This is relatively
simple to configure, but many of the tasks to compile the module and
produce the final app have to run in series.
This is unnecessarily slow.
This change starts to split the code in to multiple modules, which are:
- :core:account - AccountManager, to break a dependency cycle
- :core:common - low level types or utilities used in many other modules
- :core:database - database types, DAOs, and DI infrastructure
- :core:network - network types, API definitions, and DI infrastructure
- :core:preferences - shared preferences definitions and DI
infrastructure
- :core:testing - fakes and rules used across different modules
Benchmarking with gradle-profiler shows a ~ 17% reduction in incremental
build times after an ABI change. That will improve further as more code
is moved to modules.
The rough mechanics of the changes are:
- Create the modules, and move existing files in to them. This causes a
lot of churn in import arguments.
- Convert build.gradle files to build.gradle.kts
- Separate out the data required to display a tab (`TabViewData`) from
the data required to configure a tab (`TabData`) to avoid circular
dependencies.
- Abstract the repeated build logic shared between the modules in to
a set of plugins under `build-logic/`, to simplify configuration of
the application and library builds.
- Be explicit that some nullable types are non-null at time of use.
Nullable properties in types imported from modules generally can't be
smart cast to non-null. There's a detailed discussion of why this
restriction exists at
https://discuss.kotlinlang.org/t/what-is-the-reason-behind-smart-cast-being-impossible-to-perform-when-referenced-class-is-in-another-module/2201.
The changes highlight design problems with the current code, including:
- The main application code is too tightly coupled to the network types
- Too many values are declared unnecessarily nullable
- Dependency cycles between code that make modularisation difficult
Future changes will add more modules.
See #291.
2023-12-04 16:58:36 +01:00
|
|
|
-keep enum app.pachli.core.database.model.DraftAttachment$Type {
|
2021-01-25 16:23:43 +01:00
|
|
|
public *;
|
|
|
|
}
|
|
|
|
|
2024-02-04 15:17:46 +01:00
|
|
|
# Keep class names. Obfuscating them serves no purpose in an open source
|
|
|
|
# project and adds an additional step to de-obfuscate them when managing user
|
|
|
|
# error reports
|
|
|
|
-keepnames class *
|
|
|
|
|
2022-01-20 21:10:32 +01:00
|
|
|
# Retain generic signatures of classes used in MastodonApi so Retrofit works
|
|
|
|
-keep,allowobfuscation,allowshrinking class io.reactivex.rxjava3.core.Single
|
|
|
|
-keep,allowobfuscation,allowshrinking class retrofit2.Response
|
|
|
|
-keep,allowobfuscation,allowshrinking class kotlin.collections.List
|
|
|
|
-keep,allowobfuscation,allowshrinking class kotlin.collections.Map
|
|
|
|
-keep,allowobfuscation,allowshrinking class retrofit2.Call
|
|
|
|
|
2022-02-09 20:46:13 +01:00
|
|
|
# https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md#retrofit
|
|
|
|
-keepattributes Signature
|
|
|
|
-keep class kotlin.coroutines.Continuation
|
|
|
|
|
2017-04-08 00:08:51 +02:00
|
|
|
# preserve line numbers for crash reporting
|
|
|
|
-keepattributes SourceFile,LineNumberTable
|
2018-08-15 20:46:37 +02:00
|
|
|
-renamesourcefileattribute SourceFile
|
2017-04-08 00:08:51 +02:00
|
|
|
|
2022-05-19 07:19:16 +02:00
|
|
|
# Bouncy Castle -- Keep EC
|
|
|
|
-keep class org.bouncycastle.jcajce.provider.asymmetric.EC$* { *; }
|
|
|
|
-keep class org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$EC
|
|
|
|
|
2017-04-08 00:08:51 +02:00
|
|
|
# remove all logging from production apk
|
2017-08-11 19:19:35 +02:00
|
|
|
-assumenosideeffects class android.util.Log {
|
|
|
|
public static *** getStackTraceString(...);
|
|
|
|
public static *** d(...);
|
|
|
|
public static *** w(...);
|
|
|
|
public static *** v(...);
|
|
|
|
public static *** i(...);
|
|
|
|
}
|
2020-09-02 12:27:51 +02:00
|
|
|
-assumenosideeffects class java.lang.String {
|
|
|
|
public static java.lang.String format(...);
|
|
|
|
}
|
2018-03-01 19:01:44 +01:00
|
|
|
|
|
|
|
# remove some kotlin overhead
|
|
|
|
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
|
2021-06-11 20:50:42 +02:00
|
|
|
static void checkNotNull(java.lang.Object);
|
|
|
|
static void checkNotNull(java.lang.Object, java.lang.String);
|
2018-03-01 19:01:44 +01:00
|
|
|
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
|
2021-06-11 20:50:42 +02:00
|
|
|
static void checkParameterIsNotNull(java.lang.Object, java.lang.String);
|
|
|
|
static void checkNotNullParameter(java.lang.Object, java.lang.String);
|
2018-12-17 23:15:31 +01:00
|
|
|
static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String);
|
2021-06-11 20:50:42 +02:00
|
|
|
static void checkNotNullExpressionValue(java.lang.Object, java.lang.String);
|
|
|
|
static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String);
|
|
|
|
static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String);
|
2018-12-17 23:15:31 +01:00
|
|
|
static void throwUninitializedPropertyAccessException(java.lang.String);
|
2018-03-01 19:01:44 +01:00
|
|
|
}
|
2023-01-13 19:51:42 +01:00
|
|
|
|
|
|
|
# Preference fragments can be referenced by name, ensure they remain
|
|
|
|
# https://github.com/tuskyapp/Tusky/issues/3161
|
|
|
|
-keep class * extends androidx.preference.PreferenceFragmentCompat
|