diff --git a/AGENTS.md b/AGENTS.md index 615ef52..880a1db 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -48,6 +48,10 @@ crafter-build format --check # what CI gates on A test is an ordinary `int main()`: exit 0 passes. Tests link the core (and the bus library where they need GLib) and never need a bus, a phone or a GPU. +The build takes Crafter.DB and Crafter.Graphics from the forge at the +commits `project.cpp` pins; `crafter-build -- --local` builds them from +sibling checkouts in `../Crafter/` instead. + ## 4. Making changes - Commit messages: subject `area: what changes`, the body says why; no AI diff --git a/interfaces/ImsdMessages.Ui-App.cppm b/interfaces/ImsdMessages.Ui-App.cppm index 1430e35..2fcc9ad 100644 --- a/interfaces/ImsdMessages.Ui-App.cppm +++ b/interfaces/ImsdMessages.Ui-App.cppm @@ -91,10 +91,18 @@ export namespace ImsdMessages::Ui { static gboolean OnScreenshot(gpointer data) { App& self = *static_cast(data); if (self.canvas) { - self.canvas->Window().Update(); - self.canvas->Window().SaveFrame(self.screenshotPath); - self.Log(std::format("screenshot written to {} ({}x{} px)", self.screenshotPath.string(), self.canvas->Window().width, self.canvas->Window().height)); - self.exitCode = 0; // a failure until written (main) + try { + self.canvas->Window().CaptureNextFrame(self.screenshotPath); + self.canvas->Window().Update(); + self.Log(std::format("screenshot written to {} ({}x{} px)", self.screenshotPath.string(), self.canvas->Window().width, self.canvas->Window().height)); + self.exitCode = 0; // a failure until written (main) + } catch (const std::exception& e) { + // The library throws when the capture fails (a Vulkan call, + // the PNG's write): the bench learns it from the log and the + // exit status. + self.Log(std::format("screenshot not written to {}: {}", self.screenshotPath.string(), e.what())); + self.exitCode = 1; + } } else { // No window to render it — none could be made, or it went // between the request and the capture: logged, and the run diff --git a/project.cpp b/project.cpp index 9391694..ba3891a 100644 --- a/project.cpp +++ b/project.cpp @@ -67,21 +67,21 @@ static void ApplyGioFlags(Configuration& cfg, const GioFlags& f) { } extern "C" Configuration CrafterBuildProject(std::span args) { - // --local builds Crafter.DB from the sibling checkout under ~/repos/Crafter - // instead of the forge, for work on both sides at once. The flag is this - // project's: it is removed before the arguments are forwarded, so a + // Crafter.DB and Crafter.Graphics come from the forge at the commits + // pinned below; --local builds them from the sibling checkouts in + // ../Crafter/ instead, for work on both sides at once. The flag is + // this project's: it is removed before the arguments are forwarded, so a // dependency's project.cpp never sees it. std::vector depArgs(args.begin(), args.end()); const bool local = std::erase(depArgs, "--local") > 0; Configuration* db = local ? LocalProject({ .projectFile = "../Crafter/Crafter.DB/project.cpp", .args = depArgs }) - : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.DB.git" }, .args = depArgs }); - // The window library. --local takes the branch worktree with the Wayland - // input work until it is merged. + : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.DB.git", .commit = "bfd0cc261bb39dc6812bb9c0ef407c919e7cc258" }, .args = depArgs }); + // The window library. Configuration* graphics = local - ? LocalProject({ .projectFile = "../Crafter/Crafter.Graphics-imsd-messages/project.cpp", .args = depArgs }) - : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Graphics.git" }, .args = depArgs }); + ? LocalProject({ .projectFile = "../Crafter/Crafter.Graphics/project.cpp", .args = depArgs }) + : GitProject({ .source = { .url = "https://forgejo.catcrafts.net/Catcrafts/Crafter.Graphics.git", .commit = "079b6b0e1fa5ae5267086e61b0658b1c2704d14e" }, .args = depArgs }); // imsd-messages-core — numbers, time, the model, word wrap, gestures, // the message field's editing, the store and the sync logic: std +