Skip to content

Commit

Permalink
Merge pull request #273 from TwidereProject/feature/r8
Browse files Browse the repository at this point in the history
enable r8 support
  • Loading branch information
Tlaster authored Aug 20, 2021
2 parents 60c6c23 + 8526ab0 commit ea6aa44
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:
with:
name: build-reports
path: ./app/build/reports

- name: Upload build mapping
uses: actions/upload-artifact@v2
with:
name: build-mapping
path: ./app/build/outputs/mapping

unit-test:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ android {
if (hasSigningProps) {
signingConfig = signingConfigs.getByName("twidere")
}
isMinifyEnabled = false
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand Down
81 changes: 80 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,83 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-keepattributes *Annotation*, InnerClasses
-dontnote kotlinx.serialization.AnnotationsKt # core serialization annotations

# kotlinx-serialization-json specific. Add this if you have java.lang.NoClassDefFoundError kotlinx.serialization.json.JsonObjectSerializer
-keepclassmembers class kotlinx.serialization.json.** {
*** Companion;
}
-keepclasseswithmembers class kotlinx.serialization.json.** {
kotlinx.serialization.KSerializer serializer(...);
}

-keep,includedescriptorclasses class com.twidere.services.**$$serializer { *; }
-keepclassmembers class com.twidere.services.** {
*** Companion;
}
-keepclasseswithmembers class com.twidere.services.** {
kotlinx.serialization.KSerializer serializer(...);
}

-keep,includedescriptorclasses class com.twidere.twiderex.**$$serializer { *; }
-keepclassmembers class com.twidere.twiderex.** {
*** Companion;
}
-keepclasseswithmembers class com.twidere.twiderex.** {
kotlinx.serialization.KSerializer serializer(...);
}

-keepclassmembers class * extends androidx.datastore.preferences.protobuf.GeneratedMessageLite {
<fields>;
}


# ServiceLoader support
-keepnames class kotlinx.coroutines.internal.MainDispatcherFactory {}
-keepnames class kotlinx.coroutines.CoroutineExceptionHandler {}

# Most of volatile fields are updated with AFU and should not be mangled
-keepclassmembers class kotlinx.coroutines.** {
volatile <fields>;
}

# Same story for the standard library's SafeContinuation that also uses AtomicReferenceFieldUpdater
-keepclassmembers class kotlin.coroutines.SafeContinuation {
volatile <fields>;
}

# These classes are only required by kotlinx.coroutines.debug.AgentPremain, which is only loaded when
# kotlinx-coroutines-core is used as a Java agent, so these are not needed in contexts where ProGuard is used.
-dontwarn java.lang.instrument.ClassFileTransformer
-dontwarn sun.misc.SignalHandler
-dontwarn java.lang.instrument.Instrumentation
-dontwarn sun.misc.Signal

# JSR 305 annotations are for embedding nullability information.
-dontwarn javax.annotation.**

# A resource is loaded with a relative path so the package of this class must be preserved.
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# OkHttp platform used only on JVM and when Conscrypt dependency is available.
-dontwarn okhttp3.internal.platform.ConscryptPlatform
-dontwarn org.conscrypt.ConscryptHostnameVerifier

# Animal Sniffer compileOnly dependency to ensure APIs are compatible with older versions of Java.
-dontwarn org.codehaus.mojo.animal_sniffer.*

-keeppackagenames org.jsoup.nodes

-keep class * extends com.google.protobuf.GeneratedMessageLite { *; }

-keep class com.twidere.services.nitter.model.**

-keepclassmembers class ** {
@moe.tlaster.hson.annotations.HtmlSerializable public *;
}

0 comments on commit ea6aa44

Please sign in to comment.