Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / ocr / build.gradle.kts
build.gradle.kts31 lines · 1.6 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-library") |
| 3 | } |
| 4 | |
| 5 | // This module has no rustNativeLib of its own: the native load arrives |
| 6 | // transitively from :library:ml (libmodelrunner), which is what puts this |
| 7 | // module's tests on the forkEvery = 1 path at all. Only OcrEngineTest |
| 8 | // actually loads it: OcrEngine.isAvailable/recognize construct a |
| 9 | // TextRecognizer (in :library:ml), whose init reads MlNative.isAvailable — |
| 10 | // the System.loadLibrary("modelrunner") attempt. OcrMappingTest only |
| 11 | // exercises the pure OcrEngine.linesToResult mapping and never constructs |
| 12 | // an engine or a recogniser. Quarantine the loader into |
| 13 | // testDebugUnitTestNative (forkEvery = 1); OcrMappingTest batches |
| 14 | // 20-per-JVM in testDebugUnitTest, which depends on the quarantine task |
| 15 | // so the usual invocation still runs everything. No isolatedClasses: no |
| 16 | // DataStore/ViewModel or process-wide singleton here. |
| 17 | rustNativeTests { |
| 18 | nativeClasses.add("com.vayunmathur.library.ocr.OcrEngineTest") |
| 19 | } |
| 20 | |
| 21 | dependencies { |
| 22 | // On-device OCR via PP-OCRv5 on the Vulkan compute runtime in `:library:ml`. Both |
| 23 | // models ship as `.maml` in this module's assets and the whole detect-crop-recognise |
| 24 | // pipeline is Rust; consumers only see the OcrEngine API. |
| 25 | // |
| 26 | // `implementation` is enough even though `:library:ml` supplies `libmodelrunner.so`: |
| 27 | // an Android library's jniLibs are packaged into the consuming APK transitively, and |
| 28 | // OcrEngine maps `RecognizedLine` into its own TextBox rather than re-exporting it. |
| 29 | implementation(project(":library:ml")) |
| 30 | implementation(libs.kotlinx.coroutines.android) |
| 31 | } |