summaryrefslogtreecommitdiff
path: root/examples/live/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'examples/live/build.zig')
-rw-r--r--examples/live/build.zig11
1 files changed, 10 insertions, 1 deletions
diff --git a/examples/live/build.zig b/examples/live/build.zig
index ccfd32d..a07fe7d 100644
--- a/examples/live/build.zig
+++ b/examples/live/build.zig
@@ -40,7 +40,16 @@ pub fn build(b: *std.Build) void {
.{ .name = "scope", .module = sb.modules.scope },
.{ .name = "pardes-editor", .module = pardes.module("pardes-editor") },
} });
- const steps = app.addSteps(.{ .scripts = &.{b.path("test/live.script")} });
+ // The language's tree-sitter grammar: grammar/grammar.js and the
+ // parser.c generated from it, committed (the build never runs the
+ // generator); its colours and a new line's indent, queries/.
+ const grammar = b.addLibrary(.{ .name = "tree-sitter-live", .linkage = .static, .root_module = b.createModule(.{ .target = target, .optimize = .ReleaseFast, .link_libc = true, .pic = true }) });
+ grammar.root_module.addCSourceFile(.{ .file = b.path("grammar/src/parser.c") });
+ grammar.root_module.addIncludePath(b.path("grammar/src"));
+ app.module.linkLibrary(grammar);
+ app.module.addAnonymousImport("highlights.scm", .{ .root_source_file = b.path("queries/highlights.scm") });
+ app.module.addAnonymousImport("indents.scm", .{ .root_source_file = b.path("queries/indents.scm") });
+ const steps = app.addSteps(.{ .scripts = &.{b.path("test/live.script")}, .tests = &.{b.path("test/grammar.zig")} });
const lang_test = b.addTest(.{ .root_module = b.createModule(.{ .root_source_file = b.path("src/Lang.zig"), .target = target, .optimize = optimize }) });
steps.test_step.dependOn(&b.addRunArtifact(lang_test).step);