Skip to content

Commit

Permalink
build: enable r8 compiler, fix issue crashing the backend
Browse files Browse the repository at this point in the history
If you have a broken config, you need to delete it to stop the backend from crashing!

Signed-off-by: Luca Bretting <[email protected]>
  • Loading branch information
luca-dot-sh committed Dec 17, 2024
1 parent 7b5abfe commit 36f28ac
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
12 changes: 11 additions & 1 deletion frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,14 @@ To automatically update all dependencies, run

### Format and check formatting
Format `./gradlew combinedFormat` <br/>
Check: `./gradlew ktfmtCheck`
Check: `./gradlew ktfmtCheck`

## Troubleshooting
### The frontend crashes
Make sure the backend is running or that you are running a mocked version.
If you are running a release, check for MethodNotFoundException etc., these errors are most likely
caused by R8/ProGuard removing used classes.
Quickfix: Use the debug build type.

### The backend and frontend crashes
Delete the local configuration to make sure it does not contain outdated entries.
5 changes: 3 additions & 2 deletions frontend/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ android {

buildTypes {
release {
isMinifyEnabled = false
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
Expand Down Expand Up @@ -106,7 +106,8 @@ dependencies {
implementation(libs.vico.compose.m2)
implementation(libs.vico.compose.m3)
implementation(libs.vico.core)

implementation(libs.arrow.core)
implementation(libs.arrow.fx.coroutines)
detektPlugins(libs.detekt.compose.rules)
}

Expand Down
5 changes: 4 additions & 1 deletion frontend/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile
-keep class com.sun.jna.** { *; }
-dontwarn java.awt.**
-keep class uniffi.** { *; }
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ class ConfigurationManager(val clientFactory: ClientFactory) :

override val localConfiguration =
_localConfiguration
.map {
if (it is ConfigurationUpdate.Valid) {
it.copy(it.configuration.copy(jniReferences = null))
} else it
} // TODO remove this once the backend has integrated setting this feature
.onEach { Timber.i("local configuration updated $it") }
.map { it ?: ConfigurationUpdate.Unknown }

Expand Down
9 changes: 6 additions & 3 deletions frontend/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
[versions]
accompanistDrawablepainter = "0.36.0"
activityCompose = "1.9.3"
agp = "8.7.2"
agp = "8.7.3"
arrow = "1.2.4"
benmanes-versions = "0.51.0"
compose-navigation = "2.8.4"
composeBom = "2024.11.00"
compose-navigation = "2.8.5"
composeBom = "2024.12.01"
coreKtx = "1.15.0"
cyclonedx = "1.10.0"
detekt = "1.23.7"
Expand Down Expand Up @@ -43,6 +44,8 @@ androidx-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
androidx-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" }
androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
arrow-core = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" }
arrow-fx-coroutines = { module = "io.arrow-kt:arrow-fx-coroutines", version.ref = "arrow" }
detekt-compose-rules = { module = "com.twitter.compose.rules:detekt", version.ref = "detektRulesVersion" }
jackwharton-timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" }
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
Expand Down

0 comments on commit 36f28ac

Please sign in to comment.