@@ -74,20 +74,37 @@ pub fn build(b: *std.Build) void {
7474 });
7575 }
7676
77+ const tree_sitter_diff_dep = b .lazyDependency ("tree_sitter_diff" , .{
78+ .target = target ,
79+ .optimize = optimize ,
80+ });
81+ if (tree_sitter_diff_dep ) | tsd | {
82+ exe_mod .addIncludePath (tsd .path ("src" ));
83+ exe_mod .addCSourceFiles (.{
84+ .root = tsd .path ("" ),
85+ .files = &.{"src/parser.c" },
86+ .flags = &.{"-std=c11" },
87+ });
88+ }
89+
90+ const diffz_dep = b .dependency ("diffz" , .{
91+ .target = target ,
92+ .optimize = optimize ,
93+ });
94+ exe_mod .addImport ("diffz" , diffz_dep .module ("diffz" ));
95+
7796 const exe = b .addExecutable (.{
7897 .name = "sorcerer" ,
7998 .root_module = exe_mod ,
8099 });
81100 b .installArtifact (exe );
82101
83102 const run_cmd = b .addRunArtifact (exe );
84- //run_cmd.addArg("--register-schemas");
85103
86104 // I only want the path to the register schema file, not the lazy path,
87105 // because I want to be able to refresh it with `zig build` while sorcerer
88106 // is running. Sorcerer will watch the file for changes and update itself
89107 // automatically.
90- //run_cmd.addArg(b.getInstallPath(.prefix, register_schema_install.dest_rel_path));
91108 run_cmd .step .dependOn (b .getInstallStep ());
92109
93110 if (b .args ) | args | {
@@ -104,6 +121,21 @@ pub fn build(b: *std.Build) void {
104121 const run_exe_unit_tests = b .addRunArtifact (exe_unit_tests );
105122 const test_step = b .step ("test" , "Run unit tests" );
106123 test_step .dependOn (& run_exe_unit_tests .step );
124+
125+ // Diff algorithm unit tests
126+ const diff_test_mod = b .createModule (.{
127+ .root_source_file = b .path ("src/test_diff.zig" ),
128+ .target = target ,
129+ .optimize = optimize ,
130+ });
131+ diff_test_mod .addImport ("diffz" , diffz_dep .module ("diffz" ));
132+
133+ const diff_tests = b .addTest (.{
134+ .root_module = diff_test_mod ,
135+ });
136+
137+ const run_diff_tests = b .addRunArtifact (diff_tests );
138+ test_step .dependOn (& run_diff_tests .step );
107139}
108140
109141const TargetWithPath = struct {
0 commit comments