Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / networklocation / build.gradle.kts
build.gradle.kts76 lines · 3.6 KiBRaw
| 1 | plugins { |
| 2 | id("common-conventions-app") |
| 3 | } |
| 4 | |
| 5 | launcherIcon { |
| 6 | symbol = "my_location" |
| 7 | } |
| 8 | |
| 9 | android { |
| 10 | defaultConfig { |
| 11 | applicationId = "com.vayunmathur.networklocation" |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | androidComponents { |
| 16 | onVariants { variant -> |
| 17 | variant.sources.jniLibs?.addStaticSourceDirectory( |
| 18 | layout.buildDirectory.dir("rustJniLibs").get().asFile.absolutePath |
| 19 | ) |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | // Native code for this module, loaded as libnetworklocation.so: RANSAC + EM multilateration |
| 24 | // device-position estimation over the resolved beacon fixes, AND the offline geocoder |
| 25 | // search over geocoder.db. Both live in networklocation/src/main/rust/. |
| 26 | rustNativeLib("networklocation") |
| 27 | |
| 28 | // Only the classes below actually load libnetworklocation: they call |
| 29 | // the *Native bridges directly, or drive OfflineBeaconStore / |
| 30 | // GeocodeService / LocationReportingTask, which open and query through |
| 31 | // WpsStoreNative / GeocoderNative / NetworkLocationNative (touching a |
| 32 | // bridge's `available` already loads the library). Pure key/position |
| 33 | // math, feed, provider-contract and compose tests never touch a bridge |
| 34 | // and stay in the main task. Quarantine the loaders into |
| 35 | // testDevUnitTestNative (forkEvery = 1); the remaining classes batch |
| 36 | // 20-per-JVM in testDevUnitTest, which depends on the quarantine task so |
| 37 | // the usual invocation still runs everything. No isolatedClasses: this |
| 38 | // module has no ViewModel and no DataStore owner (OfflineDatabases is |
| 39 | // plain files, and every test installs/clears them itself), so no |
| 40 | // shared-JVM polluters exist here. |
| 41 | rustNativeTests { |
| 42 | nativeClasses.addAll( |
| 43 | listOf( |
| 44 | "com.vayunmathur.networklocation.GeocodeServiceTest", |
| 45 | "com.vayunmathur.networklocation.NativeBridgesTest", |
| 46 | "com.vayunmathur.networklocation.provider.LocationReportingTaskTest", |
| 47 | "com.vayunmathur.networklocation.provider.OfflineBeaconStoreTest", |
| 48 | ) |
| 49 | ) |
| 50 | } |
| 51 | |
| 52 | // The offline databases (geocoder.db, wifi.wpsdb up to ~2 GB, cells.wpsdb far |
| 53 | // smaller) are NOT bundled. Shipping them as assets put a 3.5 GB APK in the MAOS system image, |
| 54 | // which pushed the factory install zip past fastboot's 4 GiB zip limit. They are downloaded to |
| 55 | // device-protected storage on request instead — see OfflineDatabases.kt. Until they arrive every |
| 56 | // lookup misses, which the readers already treat as "no data": beacons stay unresolved and no |
| 57 | // position is reported, and the geocoder reports itself unavailable. |
| 58 | |
| 59 | dependencies { |
| 60 | // Compile-only stubs for the framework's unbundled provider API (com.android.location.provider). |
| 61 | // Provided at runtime by <uses-library>; must NOT be packaged. |
| 62 | compileOnly(project(":library:locationprovider")) |
| 63 | // Reporting loop + IO for the offline database fetch. |
| 64 | implementation(libs.kotlinx.coroutines.android) |
| 65 | // Resumable, checksummed, unmetered-only fetch of the offline databases, which are no |
| 66 | // longer bundled (see OfflineDatabases). Also supplies the progress UI on the status screen. |
| 67 | implementation(project(":library:downloadservice")) |
| 68 | // The provider stubs are compile-only in production (the framework supplies them |
| 69 | // at runtime), but unit tests exercise GeocodeService's provider callbacks on the |
| 70 | // JVM, so the stub signatures must be on the test runtime classpath too. |
| 71 | testImplementation(project(":library:locationprovider")) |
| 72 | // For initializing WorkManager when a test taps the offline-database download button. |
| 73 | testImplementation(libs.androidx.work.runtime.ktx) |
| 74 | // The offline geocoder search runs natively (Rust/ruzstd) over geocoder.db; there is no |
| 75 | // Kotlin-side DB code, so no zstd-jni / serialization deps are needed here. |
| 76 | } |