-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
68 lines (59 loc) · 2.34 KB
/
Copy pathbuild.zig
File metadata and controls
68 lines (59 loc) · 2.34 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Build modules
const railway_api = b.createModule(.{
.root_source_file = b.path("src/tri/railway_api.zig"),
.target = target,
.optimize = optimize,
});
const railway_circuit = b.createModule(.{
.root_source_file = b.path("src/tri/railway_circuit_breaker.zig"),
.target = target,
.optimize = optimize,
});
const railway_farm = b.createModule(.{
.root_source_file = b.path("src/tri/railway_farm.zig"),
.target = target,
.optimize = optimize,
});
railway_farm.addImport("railway_api", railway_api);
railway_farm.addImport("railway_circuit", railway_circuit);
const cloud_train = b.createModule(.{
.root_source_file = b.path("src/tri/cloud_train.zig"),
.target = target,
.optimize = optimize,
});
cloud_train.addImport("railway_api", railway_api);
cloud_train.addImport("railway_farm", railway_farm);
const hslm = b.createModule(.{
.root_source_file = b.path("src/hslm/cli.zig"),
.target = target,
.optimize = optimize,
});
hslm.addImport("railway_api", railway_api);
hslm.addImport("railway_farm", railway_farm);
const hslm_exe = b.addExecutable(.{
.name = "hslm-cli",
.root_module = hslm,
});
const train_step = b.step("train", "Build HSLM CLI");
train_step.dependOn(&hslm_exe.step);
b.default_step = train_step;
// There was no test step at all. `zig build test` answered
// "error: no step named 'test'", while 672 `test` blocks sat in the tree
// across 104 files. Nothing could run them, so nothing ever had.
const test_step = b.step("test", "Run tests");
const test_roots = [_]struct { name: []const u8, mod: *std.Build.Module }{
.{ .name = "hslm", .mod = hslm },
.{ .name = "railway_farm", .mod = railway_farm },
.{ .name = "cloud_train", .mod = cloud_train },
.{ .name = "railway_api", .mod = railway_api },
.{ .name = "railway_circuit", .mod = railway_circuit },
};
for (test_roots) |r| {
const t = b.addTest(.{ .name = r.name, .root_module = r.mod });
test_step.dependOn(&b.addRunArtifact(t).step);
}
}