Files
alkane-os/ci/check-ui-size.sh
x ad31cfbafa Vendor flare-ui v0.2.9 and prove the schema-driven UI in an image
Spike, not the final UI: it answers whether flare-ui can drive Alkane OS's
on-box pages, and what it costs.

What works:

- schema/alkane-bb.json authors the sidebar as data (3 sections, 14 tabs);
- src/bin/ui-spike.rs renders it through flare_ui::nav + flare_ui::shell, so
  the unified sidebar, ordering and surface filtering come from the schema
  rather than from hand-written HTML;
- the render uses the shared bf- design tokens, the same ones the rest of the
  suite uses.

Size, measured rather than assumed (armv7, release, stripped):

  ui-baseline   323 KiB   (maud + serde_json, no flare-ui)
  ui-spike      771 KiB   (flare-ui + wschema + sha2)
  marginal      448 KiB

Vendoring: third-party/flare-ui is the full v0.2.9 tree pinned in
flare-ui/flare-ui.lock (a partial archive does not compile, since the crate
include_str!s assets from dash-editor/). vendor/ is re-generated as a cargo
directory source with the new registry dependencies (maud, sha2, typenum,
digest, generic-array, block-buffer, crypto-common, cfg-if, etc.) so the build
still works offline. third-party/README.md records how to re-pin.
2026-11-04 14:06:25 -06:00

38 lines
1.5 KiB
Bash

#!/bin/sh
# Report what the schema-driven UI costs in a firmware binary.
#
# Two binaries are built for the same target with the same profile: one renders
# a page through flare-ui and wschema, the other renders the same shape with only
# maud and serde_json. The difference is the marginal cost of the dependency, and
# it is the number a release decision should be made on.
#
# Measured on armv7-unknown-linux-gnueabihf, release, stripped:
# ui-baseline 323 KiB
# ui-spike 771 KiB (marginal: ~448 KiB)
set -eu
ROOT=${1:-$(cd "$(dirname "$0")/.." && pwd)}
TARGET=${ALKANE_SIZE_TARGET:-armv7-unknown-linux-gnueabihf}
OUT=${CARGO_TARGET_DIR:-/tmp/alkane-os-target}
STRIP=${ALKANE_STRIP:-arm-linux-gnueabihf-strip}
cd "$ROOT"
# The workspace mount drops the executable bit on build scripts, so build into
export CARGO_TARGET_DIR="$OUT"
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=${ALKANE_ARM_LINKER:-arm-linux-gnueabihf-gcc} \
cargo build --release --offline --target "$TARGET" --bins >/dev/null
sizes=""
for bin in ui-baseline ui-spike; do
src="$OUT/$TARGET/release/$bin"
[ -f "$src" ] || { echo "ui-size: $bin was not built" >&2; exit 1; }
cp "$src" "/tmp/$bin.size"
"$STRIP" "/tmp/$bin.size" 2>/dev/null || true
bytes=$(wc -c < "/tmp/$bin.size")
sizes="$sizes $bin=$bytes"
printf ' %-12s %4d KiB\n' "$bin" $((bytes / 1024))
done
base=$(printf '%s' "$sizes" | sed 's/.*ui-baseline=\([0-9]*\).*/\1/')
spike=$(printf '%s' "$sizes" | sed 's/.*ui-spike=\([0-9]*\).*/\1/')
printf ' marginal %4d KiB\n' $(((spike - base) / 1024))