╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ build.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
76 }; 77 78 // module for using haxy as a library 79 // (the commands below consume haxy this way) 80 const haxy = b.addModule("haxy", .{ 81 .root_source_file = b.path("src/lib.zig"), 82 }); 83 haxy.addImport("xit", xit_dep.module("xit")); 84 85 // try 86 { 87 const exe = b.addExecutable(.{ 88 .name = "try", 89 .root_module = b.createModule(.{ 90 .root_source_file = b.path("src/try.zig"), 91 .target = target, 92 .optimize = optimize, 93 }), 94 }); 95 exe.root_module.addImport("haxy", haxy); 96 b.installArtifact(exe); 97 98 const run_cmd = b.addRunArtifact(exe); 99 run_cmd.step.dependOn(b.getInstallStep()); 100 if (b.args) |args| { 101 run_cmd.addArgs(args); 102 } 103 104 const run_step = b.step("try", "Try the app"); 105 run_step.dependOn(&run_cmd.step); 106 } 107 108 // test 109 { 110 const unit_tests = b.addTest(.{ 111 .root_module = b.createModule(.{ 112 .root_source_file = b.path("src/test.zig"), 113 .target = target, 114 .optimize = optimize, 115 }), 116 }); 117 unit_tests.root_module.addImport("haxy", haxy); 118 119 const run_unit_tests = b.addRunArtifact(unit_tests); 120 run_unit_tests.has_side_effects = true; 121 const test_step = b.step("test", "Run unit tests"); 122 test_step.dependOn(&install_main_exe.step); 123 test_step.dependOn(&run_unit_tests.step); 124 } 125 126 // testnet 127 { 128 const unit_tests = b.addTest(.{ 129 .root_module = b.createModule(.{ 130 .root_source_file = b.path("src/testnet.zig"), 131 .target = target, 132 .optimize = optimize, 133 }), 134 }); 135 unit_tests.root_module.addImport("haxy", haxy); 136 137 const run_unit_tests = b.addRunArtifact(unit_tests); 138 run_unit_tests.has_side_effects = true; 139 const test_step = b.step("testnet", "Run network unit tests"); 140 test_step.dependOn(&install_main_exe.step); 141 test_step.dependOn(&run_unit_tests.step); 142 } 143 } 144