Modern Apps git
git clone https://git.maproj.org/Modern-Apps.git
cov/c3 ▾

Modern-Apps.git / weather / src / main / rust / README.md

README.md1.6 KiBRenderedCodeRaw
1# weather_om โ€” native `.om` decoder (Rust + JNI)
2
3Decodes Open-Meteo binary `.om` spatial files directly from the keyless
4`map-tiles.open-meteo.com` bucket (HTTP range reads โ†’ only the index + covering
5chunks 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
10The `:weather` module cross-compiles this crate for Android using the NDK's
11clang, driven directly from a Gradle task (`cargoNdkBuild` in
12`weather/build.gradle.kts`). You need `rustup` with the Android target:
13
14```sh
15rustup 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
23The Android NDK is required (pinned via `ndkVersion` in the build convention).
24Building the FFI dependency (`om-file-format-sys`) uses the NDK clang + sysroot,
25wired via `CC`/`AR`/`SYSROOT`/`BINDGEN_EXTRA_CLANG_ARGS` in the Gradle task.
26
27`./gradlew :weather:assembleDebug` (or `installDev`) runs `cargoNdkBuild`
28automatically (wired into `preBuild`) and packages the `.so` from
29`build/rustJniLibs/<abi>/`.
30
31## Host tests
32
33The decode path can be validated on the host (no Android) against the live
34bucket:
35
36```sh
37cd weather/src/main/rust
38cargo test -- --ignored --nocapture
39```
40
41This decodes a region of the current DWD ICON run and sanity-checks the sampled
42values (and the derived `wind_speed_10m` from u/v components).