Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / weather / src / main / rust / README.md
| 1 | # weather_om โ native `.om` decoder (Rust + JNI) |
| 2 | |
| 3 | Decodes Open-Meteo binary `.om` spatial files directly from the keyless |
| 4 | `map-tiles.open-meteo.com` bucket (HTTP range reads โ only the index + covering |
| 5 | chunks are transferred), for the Weather app's map overlay. Built into |
| 6 | `libweather_om.so` and called from Kotlin via `OmTilesNative`. |
| 7 | |
| 8 | ## Prerequisites (local + CI) |
| 9 | |
| 10 | The `:weather` module cross-compiles this crate for Android using the NDK's |
| 11 | clang, driven directly from a Gradle task (`cargoNdkBuild` in |
| 12 | `weather/build.gradle.kts`). You need `rustup` with the Android target: |
| 13 | |
| 14 | ```sh |
| 15 | rustup target add aarch64-linux-android |
| 16 | ``` |
| 17 | |
| 18 | - `aarch64-linux-android` โ device / emulator (`arm64-v8a`), the only ABI the |
| 19 | app ships (dev and release both filter to `arm64-v8a`). To also target |
| 20 | Intel-host emulators, add `x86_64-linux-android` and re-enable it in |
| 21 | `rustAbis` (see the comment in `weather/build.gradle.kts`). |
| 22 | |
| 23 | The Android NDK is required (pinned via `ndkVersion` in the build convention). |
| 24 | Building the FFI dependency (`om-file-format-sys`) uses the NDK clang + sysroot, |
| 25 | wired via `CC`/`AR`/`SYSROOT`/`BINDGEN_EXTRA_CLANG_ARGS` in the Gradle task. |
| 26 | |
| 27 | `./gradlew :weather:assembleDebug` (or `installDev`) runs `cargoNdkBuild` |
| 28 | automatically (wired into `preBuild`) and packages the `.so` from |
| 29 | `build/rustJniLibs/<abi>/`. |
| 30 | |
| 31 | ## Host tests |
| 32 | |
| 33 | The decode path can be validated on the host (no Android) against the live |
| 34 | bucket: |
| 35 | |
| 36 | ```sh |
| 37 | cd weather/src/main/rust |
| 38 | cargo test -- --ignored --nocapture |
| 39 | ``` |
| 40 | |
| 41 | This decodes a region of the current DWD ICON run and sanity-checks the sampled |
| 42 | values (and the derived `wind_speed_10m` from u/v components). |