-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.zig
105 lines (90 loc) · 3.26 KB
/
build.zig
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
// .'\ /`.
// .'.-.`-'.-.`.
// ..._: .-. .-. :_...
// .' '-.(o ) (o ).-' `.
// : _ _ _`~(_)~`_ _ _ :
// : /: ' .-=_ _=-. ` ;\ :
// : :|-.._ ' ` _..-|: :
// : `:| |`:-:-.-:-:'| |:' :
// `. `.| | | | | | |.' .'
// `. `-:_| | |_:-' .'
// `-._ ```` _.-'
// ``-------''
//
// Created by ab, 14.11.2024
const std = @import("std");
pub const ProtoGenStep = @import("step.zig");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
_ = b.addModule("gremlin_parser", .{
.root_source_file = b.path("src/parser/main.zig"),
});
const gremlin = b.addModule("gremlin", .{
.root_source_file = b.path("src/gremlin/main.zig"),
});
const test_step = b.step("test", "Run tests");
{
const parser_test = b.addTest(.{
.name = "parser",
.root_source_file = b.path("src/parser/main.zig"),
.target = target,
.optimize = optimize,
});
const run_parser_tests = b.addRunArtifact(parser_test);
test_step.dependOn(&run_parser_tests.step);
}
{
const gremlin_test = b.addTest(.{
.name = "wire",
.root_source_file = b.path("src/gremlin/main.zig"),
.target = target,
.optimize = optimize,
});
const run_gremiln_tests = b.addRunArtifact(gremlin_test);
test_step.dependOn(&run_gremiln_tests.step);
}
{
const codegen_test = b.addTest(.{
.name = "codegen",
.root_source_file = b.path("step.zig"),
.target = target,
.optimize = optimize,
});
const run_codegen_tests = b.addRunArtifact(codegen_test);
test_step.dependOn(&run_codegen_tests.step);
}
{
// First create a step that will run both protobuf generations
const proto_gen_step = b.step("proto-gen", "Generate protobuf files");
const google_protobuf = ProtoGenStep.create(
b,
.{
.name = "test_data/google protobuf",
.proto_sources = b.path("test_data/google"),
.target = b.path("integration-test/gen/google"),
},
);
proto_gen_step.dependOn(&google_protobuf.step);
const gogofast_protobuf = ProtoGenStep.create(
b,
.{
.name = "test_data/gogofast protobuf",
.proto_sources = b.path("test_data/gogofast"),
.target = b.path("integration-test/gen/gogofast"),
},
);
proto_gen_step.dependOn(&gogofast_protobuf.step);
const integration_test = b.addTest(.{
.name = "integration",
.root_source_file = b.path("integration-test/main.zig"),
.target = target,
.optimize = optimize,
});
// Make the test module depend on proto generation
integration_test.step.dependOn(proto_gen_step);
integration_test.root_module.addImport("gremlin", gremlin);
const run_integration = b.addRunArtifact(integration_test);
test_step.dependOn(&run_integration.step);
}
}