Building
scripts/build.sh builds the CLI, the desktop app and the phone app into dist/, with a SHA256SUMS file:
scripts/build.sh # CLI, desktop app and dev APK
scripts/build.sh cli # CLI only
scripts/build.sh gui # desktop app only
scripts/build.sh apk # dev APK only
scripts/build.sh apk --release # release APK, unsigned (signed releases come from CI)
scripts/build.sh apk --tester # tester APK: a release with an override code
scripts/build.sh --help # all options: --version-code, --version-name, --target
It needs Rust for the CLI and the desktop app, and a JDK (17 or newer) and the Android SDK for the app. The SDK is found through ANDROID_HOME, ANDROID_SDK_ROOT, android/local.properties or ~/Android/Sdk. The book needs mdbook 0.5: mdbook serve docs shows it while you edit.
Dev, tester and release builds
| Dev build | Tester build | Release build | |
|---|---|---|---|
| Package ID | org.quitlock.dev | org.quitlock.tester | org.quitlock |
| Gradle build type | debug | qa | release |
| Signing | The local debug key | The local debug key | The release key, held only in CI’s secrets |
testOnly, debuggable | Yes | No | No |
| Instant removal | Always (Remove now), and developer tools | Only with the tester code | Never |
| adb while armed | Left on | Off except while USB debugging is allowed on the phone (5 minutes) | Same as tester |
| Updates itself | No (test-only apps cannot) | Yes, with APKs signed by the same computer | Yes, with release APKs |
| Arming without a managed browser or an enrolled key | Allowed | Refused | Refused |
| Marked on its screen | DEV | TESTER | Nothing |
The release certificate’s SHA-256 is compiled into the release CLI and desktop app (QUITLOCK_RELEASE_CERT_SHA256 at build time). A program built without it provisions dev and tester builds only, and says so.
Tester builds
A dev build hides what a release does: adb stays on, removal is always instant, and it cannot update itself. To check the real thing on a phone you can wipe, build a tester build:
scripts/build.sh apk --tester # writes dist/quitlock-tester.apk
quitlock provision dist/quitlock-tester.apk
It runs the release’s code in every way, with one addition: an override code that removes QuitLock at once, armed or not, apart from the exit and its delay. The first tester build on a computer makes the code and keeps it in android/tester-code.txt (20 characters, such as 7K2M-QX4D-...; git ignores the file). Only its SHA-256 goes into the APK, and each later build on that computer uses the same code.
Warning
Keep
android/tester-code.txt. Without it, an armed tester build is as hard to remove as a release: an exit that waits out the delay, or a factory reset.
To use it: on the phone, Leave or recover, Remove with the tester code, and type the code (case, spaces and dashes do not matter). Removal is the same teardown as an exit, and the history records it as removed with the tester code.
The Gradle build type is qa (./gradlew :app:assembleQa), because Gradle refuses build type names that begin with “test”. The code lives only in the src/qa source set, with the removal it shares with dev builds in src/instantRemoval; a release build contains neither (Invariants, invariant 5). Builds aim to be reproducible, so anyone can check a release against the source (Releasing).
Dependencies
The desktop programs live in one Rust workspace, desktop/, with one Cargo.lock. Every build uses --locked, so a build from the same commit uses the same crates.
cargo deny check (in desktop/, after cargo install --locked cargo-deny) checks them against desktop/deny.toml:
- Advisories: any RustSec advisory against a crate in use fails, and so does a yanked version.
- Licences: only licences compatible with the GPL-3.0-or-later.
- Banned crates: a second TLS or HTTP stack (OpenSSL, native-tls, reqwest, hyper) or an async runtime. The only network code is the GitHub download and the DNS filter check, both through ureq and rustls (Decisions).
- Sources: crates.io only.
CI runs it on every push, and scripts/check-invariants.sh runs it when cargo-deny is installed.
The desktop app
The desktop app (desktop/gui) uses egui with its OpenGL renderer. It builds with nothing but Rust on Windows and Linux: on Linux, X11, Wayland, OpenGL and the keyboard library are loaded when it starts, so no -dev packages are needed, and the program links only to the C library. cargo run -p quitlock-gui (in desktop/) starts it; -- --page settings opens on a page.
Releases build it for Linux on the oldest Ubuntu runner, for an older glibc than the newest, so it runs on more systems; the CLI stays a static musl program. scripts/verify-release.sh checks the CLI only: the desktop app is built the same way, but no one has yet confirmed that its builds match byte for byte.