Skip to main content

Module app_info

Module app_info 

Source
Expand description

Who the game is: shuyi.ron’s app part (AppPart, ADR-0059), its rules (problems, which check --target reports), and app-info, which writes it as the Rust constant the game’s binary compiles (rust, run) and the window’s icons, downscaled from the game’s one icon (downscale, ADR-0061) or drawn per size (ADR-0069).

The rules:

  • name: not empty, with no control character;
  • id: reverse-DNS, two or more parts between dots, each of ASCII letters, digits and -, starting with a letter; an id under com.example. is a warning, since two games with it share their saves;
  • version, when given: semver, MAJOR.MINOR.PATCH then an optional -pre-release and +build;
  • build: 1 or more;
  • storage, or the id when it is unset: one folder name;
  • icon, when given: a PNG file, square, ICON_SIDE pixels a side or more;
  • window_icons: set when icon and code are, since the Rust reads the window’s icons from there;
  • icon_sizes: each key one of WINDOW_ICON_SIDES, each file a PNG square at its key’s side, with icon and window_icons set, since the sizes it doesn’t draw come from the icon and it fills that folder;
  • the files app-info writes (code and the window’s icons) are the ones on disk.

Structs§

AppProblem
A problem of the app part.
Icon
The game’s icon: side × side RGBA8 pixels.

Constants§

COMMAND
The command’s name.
ICON_SIDE
The smallest side of the game’s icon, in pixels: every size a target asks is downscaled from it, never scaled up.
PLACEHOLDER
The id’s start that marks it as a placeholder.
WINDOW_ICON_SIDES
The window’s icons’ sides, in pixels: WindowIcon’s small, medium and big.

Functions§

check_id
Whether id is a reverse-DNS id: two or more parts between dots, each of ASCII letters, digits and -, starting with a letter. These are the characters Apple allows in a bundle id, with a letter first as Android asks.
check_storage
Whether storage can name a folder on every system: ASCII letters, digits, ., -, _ and spaces, with no . or space first or last.
check_version
Whether version is semver: MAJOR.MINOR.PATCH in digits, then an optional -pre-release and +build.
downscale
rgba, a width × height picture of RGBA8 pixels, downscaled to size × size, in integers, so the same picture gives the same bytes everywhere (ADR-0061). Each pixel out is the mean of the pixels of its square in, from x * width / size up to (x + 1) * width / size (and the same down), in premultiplied alpha, so a transparent pixel adds nothing to the colour beside it; each mean is rounded half up.
files
The files app-info writes for part in the project at root: each path from the root and its bytes, the Rust file and then the window’s icons, each the picture icon_sizes draws for its side, else downscaled from the icon. Fails when the icon or a drawn picture doesn’t load.
icon
part’s icon, read from the project at root and checked: a PNG file, square, ICON_SIDE pixels a side or more. None when the part names none.
parse_args
app-info’s arguments: none, or --check. Ok(true) for --check.
problems
Every problem of part, in the project at root whose tool is called command: its fields and its icon by the rules, and each file app-info writes that isn’t the one on disk.
run
app-info [--check] on part in the project at root: writes its files, or with check writes nothing and fails naming each file that differs. A part with an error writes nothing and fails with them.
rust
The Rust file app-info writes for part, with command as the tool’s name: one pub const APP: AppInfo, kept from rustfmt, so app-info --check is its only judge.
stale
The files app-info would write for part that differ from those in root (a missing file differs), by their paths. A text file’s line endings don’t count. When the icon or a drawn picture doesn’t load, the window’s icons aren’t compared: its rule says why.