diet-guard/app/run.sh
Krzysztof kuhy Rudnicki c12faa3920
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run
app: package the desktop app as the web build, and delete the Linux embedder
Completes the move: `linux/` is gone, replaced by the web build served by the
wrapper in a Chrome `--app` window. The icons and the .desktop installer move
out of `linux/` first -- they are not Flutter scaffolding and are still
needed; the entry now points at the packaged launcher and matches the
`--class=diet_guard_app` the wrapper passes, so the taskbar shows the app's
icon rather than a browser's.

install_arch.sh carries over the three traps each of which produced an
install that looked fine until launched: `dart build cli` rather than
`dart compile exe` (which refuses any package whose dependency graph has
native build hooks), `options=('!strip')` (makepkg would otherwise discard
the AOT snapshot, leaving a binary that runs as the bare Dart VM printing a
usage message), and no browser in `depends` (this machine's policy uninstalls
`chromium` seconds later, failing dependency resolution).

Also adds the frame-cadence instrument the performance claim is measured
with, armed by `--dart-define=DIET_GUARD_FRAME_STATS=1` and read with
`String.fromEnvironment` -- `bool.fromEnvironment` only accepts the literal
`true`, so `=1` would evaluate to false and a whole run would silently
produce no data. It reports frame-to-frame cadence rather than build/raster
durations, since work that fits the budget says nothing about the frame rate
actually achieved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-20 16:32:24 +02:00

32 lines
813 B
Bash
Executable File

#!/bin/bash
# Builds the web bundle and launches the diet_guard companion app through the
# desktop wrapper, straight out of the repo (no packaging step).
#
# The desktop app is a Flutter *web* build rather than a Linux embedder build:
# the embedder manages only ~20fps at 4K, while the same Dart code in Chrome
# sustains ~144fps.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_DIR
log() { echo "==> $*"; }
command -v flutter >/dev/null 2>&1 || {
echo "flutter is not on PATH" >&2
exit 1
}
cd "$SCRIPT_DIR"
flutter config --enable-web >/dev/null
log "fetching pub packages"
flutter pub get
log "building the web bundle"
flutter build web --release
log "launching the app"
exec dart run bin/diet_guard_desktop.dart --web-root "$SCRIPT_DIR/build/web"