╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ build.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
88 // (the commands below consume haxy this way) 89 const haxy = b.addModule("haxy", .{ 90 .root_source_file = b.path("src/lib.zig"), 91 }); 92 haxy.addImport("xit", xit_dep.module("xit")); 93 haxy.addAnonymousImport("haxy.wasm", .{ 94 .root_source_file = wasm_exe.getEmittedBin(), 95 }); 96 97 // try 98 { 99 const exe = b.addExecutable(.{ 100 .name = "try", 101 .root_module = b.createModule(.{ 102 .root_source_file = b.path("src/try.zig"), 103 .target = target, 104 .optimize = optimize, 105 }), 106 }); 107 exe.root_module.addImport("haxy", haxy); 108 const try_install = b.addInstallArtifact(exe, .{}); 109 110 const run_cmd = b.addRunArtifact(exe); 111 run_cmd.step.dependOn(&try_install.step); 112 if (b.args) |args| { 113 run_cmd.addArgs(args); 114 } 115 116 const run_step = b.step("try", "Try the app"); 117 run_step.dependOn(&run_cmd.step); 118 } 119 120 // testnet 121 { 122 const unit_tests = b.addTest(.{ 123 .root_module = b.createModule(.{ 124 .root_source_file = b.path("src/testnet.zig"), 125 .target = target, 126 .optimize = optimize, 127 }), 128 }); 129 unit_tests.root_module.addImport("haxy", haxy); 130 131 const run_unit_tests = b.addRunArtifact(unit_tests); 132 run_unit_tests.has_side_effects = true; 133 const test_step = b.step("testnet", "Run network unit tests"); 134 test_step.dependOn(&install_main_exe.step); 135 test_step.dependOn(&run_unit_tests.step); 136 } 137 } 138