Files
dev-updater/test-projects/service-and-app/.dev-updater.ron
T
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

46 lines
2.1 KiB
Plaintext

// A test project for Dev Updater, not a real app. See ../README.md.
//
// The two-component case: a server on the build machine beside an APK for
// the phone. That pairing is what Dev Updater itself is, so it is the shape
// most worth having a second of -- a project where breaking something
// cannot take the updater down with it.
//
// What it exercises that a one-component project cannot: two builds running
// at once with a bar and a timing each, the project area at the bottom
// holding only what belongs to the whole project, and the whole service
// contract -- install, start, stop, status, restart, and a runtime log that
// is not this server's own.
label: "Test: Service + App",
// Declared, so the Uninstall dialog has real paths to show and its data and
// config toggles are enabled. `hello-app` deliberately declares nothing,
// which is the other half of that test.
resources: Ron("resources.ron"),
components: [
Server(
name: "daemon",
// Two modes, declared once. Both commands are written *once*
// and handed the mode as their last argument, which is the
// ordinary way -- Dev Updater's own declaration covers the other
// way, where a command cannot take the word and is written per
// mode instead. Between the two fixtures both paths are
// exercised. `release` first, since the first is the default.
modes: ["release", "debug"],
build: "./build-daemon.sh",
// Managed, so Dev Updater's own service script drives it and this
// project needs no systemd or OpenRC knowledge of its own. The
// unit is named `<key>-daemon` after the key this project is added
// under.
//
// The leading `./` is load-bearing: service-default.sh resolves a
// program containing a slash against the working directory and
// looks anything else up on PATH.
service: Managed("./serve.sh"),
),
Apk(
name: "app",
build: ["../lib/build-apk.sh", "--package", "com.example.dutest.service", "--label", "Test Service"],
),
],