aboutsummaryrefslogtreecommitdiff
path: root/examples/monorepo/build.zig
blob: f5651543f0e327672bfde0c3f1c7bd8bb624c8bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const std = @import("std");

// Root build.zig for a two-package monorepo.
// Open the workspace root in Nova → discovers "test-all" and "gen-docs" steps.
// Open packages/beta/ separately → discovers that package's own "test" step.
pub fn build(b: *std.Build) void {
    const target = b.standardTargetOptions(.{});
    const optimize = b.standardOptimizeOption(.{});

    const exe = b.addExecutable(.{
        .name = "monorepo-root",
        .root_module = b.createModule(.{
            .root_source_file = b.path("src/main.zig"),
            .target = target,
            .optimize = optimize,
        }),
    });
    b.installArtifact(exe);

    const run_cmd = b.addRunArtifact(exe);
    const run_step = b.step("run", "Run the root executable");
    run_step.dependOn(&run_cmd.step);

    // Placeholder step that would orchestrate sub-package tests in a real monorepo.
    const test_all_step = b.step("test-all", "Run tests for all packages");
    _ = test_all_step;

    const docs_step = b.step("gen-docs", "Generate docs for all packages");
    _ = docs_step;
}