// Read by Dev Updater -- this project's entry in its own list. Structured // as the body of the config: no outer parentheses, so nothing here is // indented for the sake of a wrapper. // What to call this project before there is a build to read a label from. label: "Dev Updater", // Where this project's own resources live. Read off the request path and // cached, because the `Script` variant would otherwise put a process // spawn on the manifest -- see `server/src/resources.rs`. resources: Ron("resources.ron"), // Walked in order, and the order is the point: the binary is built first // so that a failing APK build leaves the phone the APK it already had // rather than half of a matched pair. // // The server component is this process. That changes how it is *delivered* // -- restarting means exec-ing the binary just built, not asking the // script below to stop and start the code that is running (see // `restart.rs`) -- but nothing about how it is declared, installed or // reported on. The card is an ordinary one. components: [ Server( name: "server", // No cwd: this component is built and run from the checkout root, // which is where the server looks for its own project. That is // also what the generated unit takes as its working directory -- // started anywhere else this server finds no checkout of its own, // and its card silently loses the branch line, its commit count // and the Pull button. // The ways this component can be built, declared in one place. // Release first, because the first is the default: what this // server serves to a phone should be the optimised build unless // somebody says otherwise, and debug is here for the times when // a stack trace matters more than the speed. modes: ["release", "debug"], // Written per mode rather than handed the mode as an argument, // which is the escape hatch and this is what it is for: 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 can serve as both // the flag and the path, and a project that wants one would have // to carry a wrapper script to translate. build: { "release": "cargo build --release --manifest-path server/Cargo.toml", "debug": "cargo build --manifest-path server/Cargo.toml", }, // Managed, like anything else that just wants its binary kept // running. Nothing about restarting *this* server lives in the // script -- that is `restart.rs`, which defers the hand-over past // the reply and spawns it detached. So there was nothing left for // a script of its own to say. // And the same for the binary, which is the pairing that makes // per-mode worth having at all: built with `--release` and // started from `target/debug/`, this server would go on running // last week's build with nothing anywhere saying so. service: Managed({ "release": "server/target/release/dev-updater", "debug": "server/target/debug/dev-updater", }), ), Apk( name: "app", // The command resolves against the project root and `cwd` says // where to run it -- two different things, which is why this is // not `./build-apk.sh`. // // Deliberately one mode. A release build of *this* app would be // signed with a different key from the debug one, and Android // refuses to install a differently-signed APK over an installed // package -- which for this app means the copy on the phone can // no longer be updated through the server it updates itself // from. Every other project can switch freely; this is the one // that cannot, because it is the way back. build: "app/build-apk.sh", cwd: "app", ), ],