╭ changed ╮ │build.zig│ ╰─────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭───────────────────────────────────────────────────────╮ │ 4 const target = b.standardTargetOptions(.{}); │ │ 5 const optimize = b.standardOptimizeOption(.{});│ │ 6 │ │ 7 + // main │ │ 8 const install_main_exe = blk: { │ │ 9 const exe = b.addExecutable(.{ │ │10 .name = "haxy", │ ╰───────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────╮ │32 │ │33 break :blk install_exe; │ │34 }; │ │35 + │ │36 + // module for using haxy as a library │ │37 + // (the commands below consume haxy this way) │ │38 + const haxy = b.addModule("haxy", .{ │ │39 + .root_source_file = b.path("src/lib.zig"), │ │40 + }); │ │41 + haxy.addImport("xit", b.dependency("xit", .{}).module("xit"));│ │42 │ │43 + // test │ │44 { │ │45 const unit_tests = b.addTest(.{ │ │46 .root_module = b.createModule(.{ │ ╰──────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │49 .optimize = optimize, │ │50 }), │ │51 }); │ │43 - unit_tests.root_module.addImport("xit", b.dependency("xit", .{}).module("xit"));│ │52 + unit_tests.root_module.addImport("haxy", haxy); │ │53 │ │54 const run_unit_tests = b.addRunArtifact(unit_tests); │ │55 run_unit_tests.has_side_effects = true; │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────╮ │58 test_step.dependOn(&run_unit_tests.step);│ │59 } │ │60 │ │61 + // testnet │ │62 { │ │63 const unit_tests = b.addTest(.{ │ │64 .root_module = b.createModule(.{ │ ╰─────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────────────────────────────────────╮ │67 .optimize = optimize, │ │68 }), │ │69 }); │ │60 - unit_tests.root_module.addImport("xit", b.dependency("xit", .{}).module("xit"));│ │70 + unit_tests.root_module.addImport("haxy", haxy); │ │71 │ │72 const run_unit_tests = b.addRunArtifact(unit_tests); │ │73 run_unit_tests.has_side_effects = true; │ ╰────────────────────────────────────────────────────────────────────────────────────────────╯