master
 1const std = @import("std");
 2
 3pub fn build(b: *std.Build) void {
 4    const test_step = b.step("test", "Test it");
 5    b.default_step = test_step;
 6
 7    const optimize: std.builtin.OptimizeMode = .Debug;
 8
 9    const main_mod = b.createModule(.{
10        .root_source_file = b.path("test.zig"),
11        .target = b.graph.host,
12        .optimize = optimize,
13    });
14    const shared_mod = b.createModule(.{ .root_source_file = b.path("shared.zig") });
15    const foo_mod = b.createModule(.{ .root_source_file = b.path("foo.zig") });
16    const bar_mod = b.createModule(.{ .root_source_file = b.path("bar.zig") });
17
18    main_mod.addImport("foo", foo_mod);
19    main_mod.addImport("bar", bar_mod);
20    foo_mod.addImport("shared", shared_mod);
21    bar_mod.addImport("shared", shared_mod);
22
23    const exe = b.addExecutable(.{
24        .name = "test",
25        .root_module = main_mod,
26    });
27
28    const run = b.addRunArtifact(exe);
29    test_step.dependOn(&run.step);
30}