garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /crates/cartopolis_android/Cargo.toml

raw

[package]
name = "cartopolis_android"
version.workspace = true
edition.workspace = true
# The workspace declares `MIT OR Apache-2.0`; a crate only inherits it by asking.
license.workspace = true

# The APK's `lib/arm64-v8a/libcartopolis_android.so`. A cdylib and nothing else:
# Android loads a shared object and calls into it, there is no `main`.
#
# This is a separate crate rather than a second `crate-type` on `cartopolis`'s own
# `[lib]`, because `crate-type` cannot be target-gated — adding `cdylib` there
# would make every desktop `cargo build` statically link the whole Bevy graph a
# second time, into a shared object nobody on a desktop ever loads, on a project
# whose link time is already the thing being managed
# (`docs/notes/client-build-cost.md`). The entrypoint also *has* to live in the
# cdylib: `#[no_mangle]` symbols in an upstream rlib are not guaranteed to survive
# into the final object when nothing references them, and nothing does —
# `android_main` is looked up by name from C.
[lib]
name = "cartopolis_android"
crate-type = ["cdylib"]
# No `#[test]`s here and nothing to doc-test; the crate is fifteen lines of glue.
doctest = false
test = false

# Both dependencies are target-gated, which is what keeps this crate free to sit in
# the workspace `members` list. Off Android it has no dependencies and an empty
# body, so `cargo build --workspace` pays 8.4 s and a 4.3 MB artifact (measured
# 2026-08-08, warm) instead of dragging Bevy through a second full static link.
#
# Note that is *not* free, and cannot be: a cdylib statically links std whether or
# not the crate uses it, so "empty" still means std. It is the price of the crate
# existing in `members` at all — worth it for the shared lockfile and for
# `cargo check --workspace` catching a syntax error in the entrypoint, but do not
# expect it to disappear. On Android it is the whole app.
[target.'cfg(target_os = "android")'.dependencies]
# `debug` is bevy's "keep the type names" feature, and it is on **here and only
# here** because Android is the platform where the log is the whole instrument.
# Without it every ECS command error reads `Encountered an error in command
# `<Enable the debug feature to see the name>``, which is what the 2026-08-25
# crash report said and why locating that despawn race took a code read rather
# than a glance (`docs/notes/entity-commands-outlive-entities.md`). It costs
# retained type names in the APK, not runtime — worth it on the one build that
# comes back as a text file from a phone with no cable attached.
bevy = { workspace = true, features = ["debug"] }
# `default-features = false, features = ["audio"]` is a deliberate pin even
# though it currently equals the defaults (the `solo` feature this line existed
# to drop was removed 2026-08-21): a future default this platform cannot build
# must not arrive silently. History worth keeping: `audio` once had to be named
# back explicitly, and forgetting that is how every early APK shipped with the
# footsteps, the landing thud, the wind and the driver turn cues compiled out. Android needs none of ALSA — `bevy_audio`'s cpal resolves to the NDK's
# AAudio, which is a plain C API in the platform (`libaaudio.so`, API 26; the
# manifest's minSdk is 28) and needs no permission for playback and no
# `classes.dex`. `platform::audio`'s *capture* half stays off here on its own cfg.
# `ui-probe` is the interface (the component library on bevy_ui), named here
# as `audio` is: an APK without it would draw no interface at all.
cartopolis = { path = "../cartopolis", default-features = false, features = [
    "audio",
    "comms",
    "ui-probe",
] }

[lints]
workspace = true