diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-20 06:33:52 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 06:33:53 -0300 |
| commit | ffe05cceb897b3ae6a6d36491f9318a8aa3426e7 (patch) | |
| tree | 352414579559060b3e8486af34e29d49fd5df781 /test/consumer/build.zig | |
| parent | 5b7124d10f9b2db8d1c5e99eacb9b6d2fffff0cc (diff) | |
| parent | a403340ec5c90238b136ca85fc64d65809b29a65 (diff) | |
| download | pardes-ffe05cceb897b3ae6a6d36491f9318a8aa3426e7.tar.gz pardes-ffe05cceb897b3ae6a6d36491f9318a8aa3426e7.zip | |
integration: the build's second pass on the handle and the devices once: pardes-build-pass2 (pardes-isolate and the tree-sitter=disabled tier deleted; one option, grammars = none | minimal | full; build.zig with the consumer's lines as its head comment; test/lib -> test/consumer; the manual's library section) and pardes-merge31, merged without a textual conflict; one line follows a deletion: dev/file_watch.zig's end-to-end test of a session's watches (written since on the base) guarded on fs.platform_has_fs, which the first of these changes deleted: the guard reads as the file's other tests' (comptime !supported); tui core-test 857/1008 (151 skipped), shell-test 1048/1051, the window builds; the coordinator's gate in the ledger (reorg/merge32)
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'test/consumer/build.zig')
| -rw-r--r-- | test/consumer/build.zig | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/consumer/build.zig b/test/consumer/build.zig new file mode 100644 index 00000000..ca63bb6e --- /dev/null +++ b/test/consumer/build.zig @@ -0,0 +1,42 @@ +//! A package that depends on pardes, as a program would (build.zig's head +//! comment has its lines): pardes's `lib-test`, which `unit-test` runs, +//! runs `zig build test` here. `pardes-syntax` with the minimal grammars, +//! as a program that draws source text itself takes it; and +//! `pardes-editor` with no grammar of pardes's and one of its own, C's, +//! compiled here from the package pardes pins and handed in at run time, +//! as sketchbook's `examples/live` takes it. +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + const syntax = b.dependency("pardes", .{ .target = target, .optimize = optimize, .grammars = .minimal }); + const editor = b.dependency("pardes", .{ .target = target, .optimize = optimize, .grammars = .none, .editor = true }); + // The grammar of its own: C's, from the package pardes's manifest pins + // (so `--pkg-dir` at pardes's zig-pkg has it), as that package builds it. + const grammar = b.dependency("ts_c", .{ .target = target, .optimize = .ReleaseFast, .@"build-shared" = false }).artifact("tree-sitter-c"); + const step = b.step("test", "colour, outline and walk a C and a Zig source through pardes's syntax, and edit a text with its editor and a grammar of this package's"); + // A file belongs to one module: the syntax alone, and the editor (which + // has it as `.syntax`), each a test of its own. + for ([_]struct { []const u8, []const u8, *std.Build.Dependency }{ .{ "lib.zig", "pardes-syntax", syntax }, .{ "editor.zig", "pardes-editor", editor } }) |t| { + const mod = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path(t[0]), + .imports = &.{.{ .name = t[1], .module = t[2].module(t[1]) }}, + }); + if (t[2] == editor) mod.linkLibrary(grammar); + step.dependOn(&b.addRunArtifact(b.addTest(.{ .root_module = mod })).step); + } + // What a key costs, a page count and a parse: `zig build bench -- <KiB> <keys>`. + const bench = b.addExecutable(.{ .name = "bench", .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .root_source_file = b.path("bench.zig"), + .imports = &.{.{ .name = "pardes-editor", .module = editor.module("pardes-editor") }}, + }) }); + bench.root_module.linkLibrary(grammar); + const run_bench = b.addRunArtifact(bench); + run_bench.addPassthruArgs(); + b.step("bench", "a key typed into the library's editor at a size, its pages and a parse").dependOn(&run_bench.step); +} |
