-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
155 lines (132 loc) · 5.53 KB
/
build.zig
File metadata and controls
155 lines (132 loc) · 5.53 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const mod = b.addModule("htmlparser", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
});
const exe = b.addExecutable(.{
.name = "htmlparser",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "htmlparser", .module = mod },
},
}),
});
const bench_exe = b.addExecutable(.{
.name = "htmlparser-bench",
.root_module = b.createModule(.{
.root_source_file = b.path("tools/bench/bench.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "htmlparser", .module = mod },
},
}),
});
const tools_exe = b.addExecutable(.{
.name = "htmlparser-tools",
.root_module = b.createModule(.{
.root_source_file = b.path("tools/scripts.zig"),
.target = target,
.optimize = optimize,
}),
});
b.installArtifact(exe);
b.installArtifact(bench_exe);
b.installArtifact(tools_exe);
const run_step = b.step("run", "Run the demo app");
const bench_step = b.step("bench", "Run parser/query benchmarks");
const tools_step = b.step("tools", "Run htmlparser-tools utility");
const bench_compare_step = b.step("bench-compare", "Benchmark against external parser implementations");
const conformance_step = b.step("conformance", "Run external parser/selector conformance suites (strictest+fastest)");
const docs_check_step = b.step("docs-check", "Validate markdown links and documented commands");
const examples_check_step = b.step("examples-check", "Compile and run all examples in test mode");
const run_cmd = b.addRunArtifact(exe);
const bench_cmd = b.addRunArtifact(bench_exe);
const tools_cmd = b.addRunArtifact(tools_exe);
const setup_parsers_cmd = b.addRunArtifact(tools_exe);
setup_parsers_cmd.addArg("setup-parsers");
const setup_fixtures_cmd = b.addRunArtifact(tools_exe);
setup_fixtures_cmd.addArg("setup-fixtures");
setup_fixtures_cmd.step.dependOn(&setup_parsers_cmd.step);
const compare_cmd = b.addRunArtifact(tools_exe);
compare_cmd.addArg("run-benchmarks");
compare_cmd.step.dependOn(&setup_fixtures_cmd.step);
const conformance_cmd = b.addRunArtifact(tools_exe);
conformance_cmd.addArg("run-external-suites");
conformance_cmd.addArg("--mode");
conformance_cmd.addArg("both");
const docs_check_cmd = b.addRunArtifact(tools_exe);
docs_check_cmd.addArg("docs-check");
const examples_check_cmd = b.addRunArtifact(tools_exe);
examples_check_cmd.addArg("examples-check");
run_step.dependOn(&run_cmd.step);
bench_step.dependOn(&bench_cmd.step);
tools_step.dependOn(&tools_cmd.step);
bench_compare_step.dependOn(&compare_cmd.step);
conformance_step.dependOn(&conformance_cmd.step);
docs_check_step.dependOn(&docs_check_cmd.step);
examples_check_step.dependOn(&examples_check_cmd.step);
run_cmd.step.dependOn(b.getInstallStep());
bench_cmd.step.dependOn(b.getInstallStep());
tools_cmd.step.dependOn(b.getInstallStep());
setup_parsers_cmd.step.dependOn(b.getInstallStep());
setup_fixtures_cmd.step.dependOn(b.getInstallStep());
compare_cmd.step.dependOn(b.getInstallStep());
conformance_cmd.step.dependOn(b.getInstallStep());
docs_check_cmd.step.dependOn(b.getInstallStep());
examples_check_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
bench_cmd.addArgs(args);
tools_cmd.addArgs(args);
compare_cmd.addArgs(args);
conformance_cmd.addArgs(args);
docs_check_cmd.addArgs(args);
examples_check_cmd.addArgs(args);
}
const mod_tests = b.addTest(.{
.root_module = mod,
});
const run_mod_tests = b.addRunArtifact(mod_tests);
const exe_tests = b.addTest(.{
.root_module = exe.root_module,
});
const run_exe_tests = b.addRunArtifact(exe_tests);
const examples_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("tools/tests/examples_tests.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "htmlparser", .module = mod },
},
}),
});
const run_examples_tests = b.addRunArtifact(examples_tests);
const behavioral_tests = b.addTest(.{
.root_module = b.createModule(.{
.root_source_file = b.path("tools/tests/behavioral_tests.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "htmlparser", .module = mod },
},
}),
});
const run_behavioral_tests = b.addRunArtifact(behavioral_tests);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_mod_tests.step);
test_step.dependOn(&run_exe_tests.step);
test_step.dependOn(&run_examples_tests.step);
test_step.dependOn(&run_behavioral_tests.step);
const ship_check_step = b.step("ship-check", "Run release-readiness checks (test + docs + examples)");
ship_check_step.dependOn(test_step);
ship_check_step.dependOn(docs_check_step);
ship_check_step.dependOn(examples_check_step);
}