Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / library / tilecodec / src / main / rust / Cargo.toml
Cargo.toml57 lines · 2.7 KiBRaw
| 1 | # The PMTiles v3, MVT 2.1 and `.mamaps` codecs, shared by the offline tiler and the app. |
| 2 | # |
| 3 | # Extracted from `scripts/maps/tile_build`, which is still its older consumer. |
| 4 | # The Android vector renderer in `:library:map` needs to read exactly the archives |
| 5 | # that crate writes, and a second implementation of either format would be a |
| 6 | # second thing to keep in agreement with the published basemap. So there is one. |
| 7 | # |
| 8 | # Member of the repo-root workspace (single root Cargo.lock). It is consumed by a |
| 9 | # host binary AND by an aarch64-linux-android cdylib; workspace membership only |
| 10 | # unifies version resolution and does not change its targets. |
| 11 | # |
| 12 | # `miniz_oxide` is the only dependency and is pure Rust, so this builds for the |
| 13 | # host and cross-compiles for Android with no C toolchain and nothing to configure. |
| 14 | # PMTiles gzips both its directories and its tiles, so the DEFLATE side is needed |
| 15 | # as well as INFLATE. |
| 16 | # |
| 17 | # That single-pure-Rust-dependency rule is also what settled `.mamaps` compression. |
| 18 | # The obvious choice on paper is zstd, but its encoder is C, so adding it would end |
| 19 | # the property this whole file exists to preserve. `.mamaps` bodies are therefore raw |
| 20 | # DEFLATE through the same `miniz_oxide`, and the format's `compression` header byte |
| 21 | # keeps a swap open if a pure-Rust zstd encoder ever becomes worth the dependency. |
| 22 | |
| 23 | [package] |
| 24 | name = "tilecodec" |
| 25 | version = "0.1.0" |
| 26 | edition = "2021" |
| 27 | publish = false |
| 28 | license = "GPL-2.0-only" |
| 29 | description = "PMTiles v3, Mapbox Vector Tile 2.1 and .mamaps codecs shared by the Maps tiler and the Android renderer" |
| 30 | |
| 31 | [features] |
| 32 | # The `.mamaps` writer. Off by default: Android reads archives and never writes one, |
| 33 | # so gating it keeps the interner out of the cdylib and, more usefully, makes it a |
| 34 | # compile error rather than a review comment if the read path ever grows a dependency |
| 35 | # on the write path. `scripts/maps` enables it. |
| 36 | write = ["dep:zstd-rs"] |
| 37 | |
| 38 | [lib] |
| 39 | name = "tilecodec" |
| 40 | path = "src/lib.rs" |
| 41 | |
| 42 | [dependencies] |
| 43 | miniz_oxide.workspace = true |
| 44 | # Pure-Rust zstd decoder for v9 bodies (no C toolchain, so the |
| 45 | # aarch64-linux-android cdylib keeps its single-pure-Rust-dependency |
| 46 | # property — see the crate docs above). Decode-only here; the host-side |
| 47 | # encoder arrives with the writer change. |
| 48 | ruzstd.workspace = true |
| 49 | # Pure-Rust zstd encoder, host-side only (writer): v9 bodies. Optional so the |
| 50 | # cdylib never links it — Android reads archives, it never writes one. |
| 51 | zstd-rs = { workspace = true, optional = true } |
| 52 | |
| 53 | [dev-dependencies] |
| 54 | # Tests build archives, so they need the writer the Android cdylib never links. |
| 55 | # Self dev-dependency (same pattern as :library:map and maps) enables `write` |
| 56 | # only for test targets; the default lib build stays read-only. |
| 57 | tilecodec = { path = ".", features = ["write"] } |