perf: increase release optimizations

This commit is contained in:
Diamond 2022-09-18 12:42:27 -07:00
parent ac7182fdb0
commit 69ff9b531c
No known key found for this signature in database
GPG key ID: DCBE5952BB3B6420
3 changed files with 54 additions and 0 deletions

View file

@ -31,6 +31,28 @@ android {
}
}
androidComponents {
onVariants(selector().withBuildType("release")) {
it.packaging.resources.excludes.apply {
// Debug metadata
add("/**/*.version")
add("/kotlin-tooling-metadata.json")
// Kotlin debugging (https://github.com/Kotlin/kotlinx.coroutines/issues/2274)
add("/DebugProbesKt.bin")
}
}
}
packagingOptions {
resources {
// Reflection symbol list (https://stackoverflow.com/a/41073782/13964629)
excludes += "/**/*.kotlin_builtins"
// okhttp3 is used by some lib (no cookies so publicsuffixes.gz can be dropped)
excludes += "/okhttp3/**"
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11

View file

@ -24,3 +24,29 @@
# @Serializable and @Polymorphic are used at runtime for polymorphic serialization.
-keepattributes RuntimeVisibleAnnotations,AnnotationDefault
# Serializer for classes with named companion objects are retrieved using `getDeclaredClasses`.
# If you have any, uncomment and replace classes with those containing named companion objects.
-keepattributes InnerClasses # Needed for `getDeclaredClasses`.
#-if @kotlinx.serialization.Serializable class
#com.xinto.opencord.gateway.io.OpCode, # <-- List serializable classes with named companions.
#com.xinto.opencord.gateway.io.EventName
#{
# static **$* *;
#}
-keepnames class <1>$$serializer { # -keepnames suffices; class is kept when serializer() is kept.
static <1>$$serializer INSTANCE;
}
# Uncomment this to preserve the line number information for
# debugging stack traces.
-keepattributes SourceFile,LineNumberTable
# Repackage classes into the top-level.
-repackageclasses
# Amount of optimization iterations, taken from an SO post
-optimizationpasses 5
# Broaden access modifiers to increase results during optimization
-allowaccessmodification

View file

@ -7,13 +7,19 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enable R8 full mode.
android.enableR8.fullMode=true