personal monorepo
// ---- Build.

pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const lib = b.addModule("zuri", .{
        .root_source_file = b.path("source/root.zig"),
        .target = target,
    });

    const mod = b.createModule(.{
        .root_source_file = b.path("source/main.zig"),
        .target = target,
        .optimize = optimize,
        .imports = &.{
            .{
                .name = "zuri",
                .module = lib,
            },
        },
    });

    const cli = b.addExecutable(.{
        .name = "zuri",
        .root_module = mod,
    });

    b.installArtifact(cli);

    // --- Running.

    const run_step = b.step("run", "Run the app");

    const run_cmd = b.addRunArtifact(cli);
    run_step.dependOn(&run_cmd.step);

    run_cmd.step.dependOn(b.getInstallStep());

    if (b.args) |args| run_cmd.addArgs(args);

    // --- Testing.

    const test_step = b.step("test", "Run tests");

    const lib_tests = b.addTest(.{ .root_module = lib });
    const mod_tests = b.addTest(.{ .root_module = mod });

    const run_lib_tests = b.addRunArtifact(lib_tests);
    const run_mod_tests = b.addRunArtifact(mod_tests);

    test_step.dependOn(&run_lib_tests.step);
    test_step.dependOn(&run_mod_tests.step);
}

// ---- Imports.

const std = @import("std");