diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-25 21:53:00 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-09-25 21:54:39 -0300 |
| commit | 2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702 (patch) | |
| tree | 32a8bbb55226721834fd5675e7bafc163508dd1e /build.zig | |
| parent | 50f4ee716aeafa13118cbcfa0f5cb37f7d3940a4 (diff) | |
| download | sketchbook-2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702.tar.gz sketchbook-2dfddee8c6fab6eb76cbfe3d95f7c30bfb870702.zip | |
sketchbook: what the game's review needed
- input.started: true on the first update of a run, never after a reload,
for a sketch to stop what should not resume from saved state.
- A console line that errors fails its script. Sketch commands answer
unknown, done or failed (abi.Outcome) instead of a bool that hid errors.
- addScript also takes the hot-reloadable library, run through the generic
host, so scripts can reload a real build.
- Sounds that do not load are .none, not an empty clip.
- sk_tag reads an enum field's tag name from the web build, for tests.
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -406,16 +406,20 @@ pub const App = struct { cwd: ?Build.LazyPath = null, }; - /// Plays a script headless against `exe` (from `addExecutable`), with a - /// throwaway state file. Fails when an expectation does. - pub fn addScript(app: App, exe: *Build.Step.Compile, script: Build.LazyPath, options: ScriptOptions) *Build.Step.Run { + /// Plays a script headless, with a throwaway state file, against + /// `artifact`: the executable (`addExecutable`), or the hot-reloadable + /// library (`addLibrary`) through the generic host, which scripts can + /// `reload`. Fails when an expectation or a console line does. + pub fn addScript(app: App, artifact: *Build.Step.Compile, script: Build.LazyPath, options: ScriptOptions) *Build.Step.Run { const b = app.sb.b; - const run = b.addRunArtifact(exe); + const library = artifact.isDynamicLibrary(); + const run = b.addRunArtifact(if (library) app.sb.host_exe else artifact); run.addArgs(&.{ "--headless", "--fresh", "--script" }); run.addFileArg(script); run.addArg("--state"); _ = run.addOutputFileArg(b.fmt("{s}.state", .{app.name})); for (options.defines) |pair| run.addArgs(&.{ "--define", b.fmt("{s}={s}", .{ pair[0], pair[1] }) }); + if (library) run.addArtifactArg(artifact); run.setCwd(options.cwd orelse b.path(".")); run.expectExitCode(0); run.has_side_effects = true; |
