Files
irisandClaude Opus 5 17d873ab7c Give each component build modes and a settings sheet
A component now declares its ways of being built in one list -- `modes:
["release", "debug"]`, the first the default -- and every command it runs
is handed the mode as its last argument, so a project whose script takes
`release` or `debug` names that script once. A field may instead be
written per mode, which is the escape hatch for the commands that cannot
take the word: cargo takes `--release` or nothing, and its profile for
the unoptimised build is called `dev` while the directory it writes is
called `debug`, so no single word serves as both the flag and the path.
A command written per mode is not handed the word as well; it already is
the answer, and a stray argument to a service binary is a process that
will not start.

One list rather than gathering names from whichever fields happened to
mention them is what makes a mode missing from one part unsayable: every
per-mode map is checked against it, so a gap is named rather than
resolved to some other mode's command.

Which mode to build in and whether to strip are the build machine's --
there is one checkout and one set of outputs, so a per-device mode would
have two phones rebuilding over each other silently. Which of the
finished builds a phone installs stays that phone's. Neither choice is
part of the acceptance gate, so both have to be carried across the
components list being rewritten, by acceptance and by the self entry's
startup reconciliation alike; without the second a mode chosen for this
server's own component would not survive the restart that applies it.

A mode switch moves no commit, so `builtMode` is recorded beside
`builtFrom`. Without it a component built in debug and switched to
release reads as current and serves the debug build for ever -- and for
an APK nothing else notices, because the "never built at all" check finds
any variant under the component's directory.

Each component card gains a settings sheet behind a gear at the row's
right-hand end, holding the mode, which build to install, strip, and an
Enrol button. The variant picker moved into it: on the card the two read
as one choice, both saying debug and release, and they are not. The row's
text is now bounded and truncates, so a long status can no longer push
the log and settings buttons off the edge.

`enroll:` is a declared command whose one line of stdout is a URL for the
phone to open after installing -- generic on purpose, run per press since
such a link is one-shot and carries a credential, and in the acceptance
gate because it runs on the build machine.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-02 06:22:05 -04:00

40 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# The long-running half of this test project: a service that does nothing
# except say so, once every ten seconds, forever.
#
# It writes into its own data directory -- the one resources.ron names -- so
# that Uninstall's "remove data" toggle has something real to remove, and so
# that the directory exists to be shown in the dialog. Its *log* is not
# written here: a managed service's output is captured by Dev Updater's
# service script, which is what the runtime log tab reads.
#
# Takes the build mode as its one argument, ahead of whatever subcommand
# the service contract appends -- which is how a command written once
# learns which mode it is running in. It ticks at a different rate in
# each, so that a mode switch is checkable from a phone: the runtime log
# is the only place the difference shows.
set -eu
MODE="${1:-release}"
case "$MODE" in
release) INTERVAL=10 ;;
debug) INTERVAL=2 ;;
*)
echo "unknown mode: $MODE (expected release or debug)" >&2
exit 2
;;
esac
DATA="${XDG_DATA_HOME:-$HOME/.local/share}/dutest-service"
mkdir -p "$DATA"
echo "started at $(date -Is), writing to $DATA, ticking every ${INTERVAL}s in $MODE"
count=0
while true; do
count=$((count + 1))
echo "$(date -Is) tick $count" >>"$DATA/ticks.log"
# Colour, so the runtime log tab has escapes to render too -- the same
# reason breakable/build.sh writes them.
printf 'tick \033[1;32m%s\033[0m -- still here\n' "$count"
sleep "$INTERVAL"
done