Fix missing methods due to proguard

This commit is contained in:
Aleksandras Kostarevas 2024-01-09 23:07:04 +02:00
parent 55d5959f54
commit b5446fb77f
2 changed files with 27 additions and 3 deletions

View File

@ -1,12 +1,10 @@
package org.futo.inputmethod.latin.xlm
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.newSingleThreadContext
import kotlinx.coroutines.withContext
import org.futo.inputmethod.annotations.ExternallyReferenced
@OptIn(DelicateCoroutinesApi::class)
val TrainingContext = newSingleThreadContext("AdapterTrainingContext")
@ -31,10 +29,12 @@ class AdapterTrainer(
private var handle: Long = 0L
private fun isHandleValid() = handle != 0L
@ExternallyReferenced
private fun emitProgress(progress: Float) {
progressFlow?.tryEmit(progress)
}
@ExternallyReferenced
private fun emitLoss(loss: Float) {
lossFlow?.tryEmit(loss)
}

24
proguard-rules.pro vendored
View File

@ -27,6 +27,30 @@
-keepclasseswithmembers class * {
native <methods>;
}
# Keep classes and methods that have the @UsedForTesting annotation
-keep @org.futo.inputmethod.annotations.UsedForTesting class *
-keepclassmembers class * {
@org.futo.inputmethod.annotations.UsedForTesting *;
}
# Keep classes and methods that have the @ExternallyReferenced annotation
-keep @org.futo.inputmethod.annotations.ExternallyReferenced class *
-keepclassmembers class * {
@org.futo.inputmethod.annotations.ExternallyReferenced *;
}
# Keep native methods
-keepclassmembers class * {
native <methods>;
}
# Keep classes that are used as a parameter type of methods that are also marked as keep
# to preserve changing those methods' signature.
-keep class org.futo.inputmethod.latin.AssetFileAddress
-keep class org.futo.inputmethod.latin.Dictionary
-keep class org.futo.inputmethod.latin.NgramContext
-keep class org.futo.inputmethod.latin.makedict.ProbabilityInfo
-keep class org.futo.inputmethod.keyboard.KeyboardLayout { *; }
-dontobfuscate
-optimizations !code/allocation/variable