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 target = b.standardTargetOptions(.{});
 8    const optimize = b.standardOptimizeOption(.{});
 9
10    const main_mod = b.createModule(.{
11        .root_source_file = b.path("src/main.zig"),
12        .target = target,
13        .optimize = optimize,
14    });
15    const foo_mod = b.createModule(.{
16        .root_source_file = b.path("src/foo.zig"),
17    });
18
19    foo_mod.addImport("root2", main_mod);
20    main_mod.addImport("foo", foo_mod);
21
22    const exe = b.addExecutable(.{
23        .name = "depend_on_main_mod",
24        .root_module = main_mod,
25    });
26
27    const run_cmd = b.addRunArtifact(exe);
28    run_cmd.expectExitCode(0);
29
30    test_step.dependOn(&run_cmd.step);
31}