@@ -8,18 +8,48 @@ pub fn build(b: *std.Build) void {
8
8
9
9
const dep_ssz = b .dependency ("ssz" , .{});
10
10
11
+ const dep_blst_z = b .dependency ("blst_z" , .{});
12
+
11
13
const options_build_options = b .addOptions ();
12
14
const option_preset = b .option ([]const u8 , "preset" , "" ) orelse "mainnet" ;
13
15
options_build_options .addOption ([]const u8 , "preset" , option_preset );
14
16
const options_module_build_options = options_build_options .createModule ();
15
17
18
+ const module_hex = b .createModule (.{
19
+ .root_source_file = b .path ("src/hex.zig" ),
20
+ .target = target ,
21
+ .optimize = optimize ,
22
+ });
23
+ b .modules .put (b .dupe ("hex" ), module_hex ) catch @panic ("OOM" );
24
+
25
+ const module_config = b .createModule (.{
26
+ .root_source_file = b .path ("src/config/root.zig" ),
27
+ .target = target ,
28
+ .optimize = optimize ,
29
+ });
30
+ b .modules .put (b .dupe ("config" ), module_config ) catch @panic ("OOM" );
31
+
16
32
const module_consensus_types = b .createModule (.{
17
33
.root_source_file = b .path ("src/consensus_types/root.zig" ),
18
34
.target = target ,
19
35
.optimize = optimize ,
20
36
});
21
37
b .modules .put (b .dupe ("consensus_types" ), module_consensus_types ) catch @panic ("OOM" );
22
38
39
+ const module_params = b .createModule (.{
40
+ .root_source_file = b .path ("src/params/root.zig" ),
41
+ .target = target ,
42
+ .optimize = optimize ,
43
+ });
44
+ b .modules .put (b .dupe ("params" ), module_params ) catch @panic ("OOM" );
45
+
46
+ const module_state_transition = b .createModule (.{
47
+ .root_source_file = b .path ("src/state_transition/root.zig" ),
48
+ .target = target ,
49
+ .optimize = optimize ,
50
+ });
51
+ b .modules .put (b .dupe ("state_transition" ), module_state_transition ) catch @panic ("OOM" );
52
+
23
53
const module_state_transition_utils = b .createModule (.{
24
54
.root_source_file = b .path ("src/lib_state_transition_utils.zig" ),
25
55
.target = target ,
@@ -34,19 +64,46 @@ pub fn build(b: *std.Build) void {
34
64
.linkage = .dynamic ,
35
65
});
36
66
37
- const install_lib_state_transition_utils = b .addInstallArtifact (lib_state_transition_utils , .{
38
- });
67
+ const install_lib_state_transition_utils = b .addInstallArtifact (lib_state_transition_utils , .{});
39
68
40
69
const tls_install_lib_state_transition_utils = b .step ("build-lib:state_transition_utils" , "Install the state_transition_utils library" );
41
70
tls_install_lib_state_transition_utils .dependOn (& install_lib_state_transition_utils .step );
42
71
b .getInstallStep ().dependOn (& install_lib_state_transition_utils .step );
43
72
44
73
const tls_run_test = b .step ("test" , "Run all tests" );
45
74
75
+ const test_hex = b .addTest (.{
76
+ .name = "hex" ,
77
+ .root_module = module_hex ,
78
+ .filters = &[_ ][]const u8 {},
79
+ });
80
+ const install_test_hex = b .addInstallArtifact (test_hex , .{});
81
+ const tls_install_test_hex = b .step ("build-test:hex" , "Install the hex test" );
82
+ tls_install_test_hex .dependOn (& install_test_hex .step );
83
+
84
+ const run_test_hex = b .addRunArtifact (test_hex );
85
+ const tls_run_test_hex = b .step ("test:hex" , "Run the hex test" );
86
+ tls_run_test_hex .dependOn (& run_test_hex .step );
87
+ tls_run_test .dependOn (& run_test_hex .step );
88
+
89
+ const test_config = b .addTest (.{
90
+ .name = "config" ,
91
+ .root_module = module_config ,
92
+ .filters = &[_ ][]const u8 {},
93
+ });
94
+ const install_test_config = b .addInstallArtifact (test_config , .{});
95
+ const tls_install_test_config = b .step ("build-test:config" , "Install the config test" );
96
+ tls_install_test_config .dependOn (& install_test_config .step );
97
+
98
+ const run_test_config = b .addRunArtifact (test_config );
99
+ const tls_run_test_config = b .step ("test:config" , "Run the config test" );
100
+ tls_run_test_config .dependOn (& run_test_config .step );
101
+ tls_run_test .dependOn (& run_test_config .step );
102
+
46
103
const test_consensus_types = b .addTest (.{
47
104
.name = "consensus_types" ,
48
105
.root_module = module_consensus_types ,
49
- .filters = &[_ ][]const u8 { },
106
+ .filters = &[_ ][]const u8 {},
50
107
});
51
108
const install_test_consensus_types = b .addInstallArtifact (test_consensus_types , .{});
52
109
const tls_install_test_consensus_types = b .step ("build-test:consensus_types" , "Install the consensus_types test" );
@@ -57,10 +114,38 @@ pub fn build(b: *std.Build) void {
57
114
tls_run_test_consensus_types .dependOn (& run_test_consensus_types .step );
58
115
tls_run_test .dependOn (& run_test_consensus_types .step );
59
116
117
+ const test_params = b .addTest (.{
118
+ .name = "params" ,
119
+ .root_module = module_params ,
120
+ .filters = &[_ ][]const u8 {},
121
+ });
122
+ const install_test_params = b .addInstallArtifact (test_params , .{});
123
+ const tls_install_test_params = b .step ("build-test:params" , "Install the params test" );
124
+ tls_install_test_params .dependOn (& install_test_params .step );
125
+
126
+ const run_test_params = b .addRunArtifact (test_params );
127
+ const tls_run_test_params = b .step ("test:params" , "Run the params test" );
128
+ tls_run_test_params .dependOn (& run_test_params .step );
129
+ tls_run_test .dependOn (& run_test_params .step );
130
+
131
+ const test_state_transition = b .addTest (.{
132
+ .name = "state_transition" ,
133
+ .root_module = module_state_transition ,
134
+ .filters = &[_ ][]const u8 {},
135
+ });
136
+ const install_test_state_transition = b .addInstallArtifact (test_state_transition , .{});
137
+ const tls_install_test_state_transition = b .step ("build-test:state_transition" , "Install the state_transition test" );
138
+ tls_install_test_state_transition .dependOn (& install_test_state_transition .step );
139
+
140
+ const run_test_state_transition = b .addRunArtifact (test_state_transition );
141
+ const tls_run_test_state_transition = b .step ("test:state_transition" , "Run the state_transition test" );
142
+ tls_run_test_state_transition .dependOn (& run_test_state_transition .step );
143
+ tls_run_test .dependOn (& run_test_state_transition .step );
144
+
60
145
const test_state_transition_utils = b .addTest (.{
61
146
.name = "state_transition_utils" ,
62
147
.root_module = module_state_transition_utils ,
63
- .filters = &[_ ][]const u8 { },
148
+ .filters = &[_ ][]const u8 {},
64
149
});
65
150
const install_test_state_transition_utils = b .addInstallArtifact (test_state_transition_utils , .{});
66
151
const tls_install_test_state_transition_utils = b .step ("build-test:state_transition_utils" , "Install the state_transition_utils test" );
@@ -71,7 +156,77 @@ pub fn build(b: *std.Build) void {
71
156
tls_run_test_state_transition_utils .dependOn (& run_test_state_transition_utils .step );
72
157
tls_run_test .dependOn (& run_test_state_transition_utils .step );
73
158
159
+ const module_unit = b .createModule (.{
160
+ .root_source_file = b .path ("src/state_transition/root.zig" ),
161
+ .target = target ,
162
+ .optimize = optimize ,
163
+ });
164
+ b .modules .put (b .dupe ("unit" ), module_unit ) catch @panic ("OOM" );
165
+
166
+ const test_unit = b .addTest (.{
167
+ .name = "unit" ,
168
+ .root_module = module_unit ,
169
+ .filters = &[_ ][]const u8 {},
170
+ });
171
+ const install_test_unit = b .addInstallArtifact (test_unit , .{});
172
+ const tls_install_test_unit = b .step ("build-test:unit" , "Install the unit test" );
173
+ tls_install_test_unit .dependOn (& install_test_unit .step );
174
+
175
+ const run_test_unit = b .addRunArtifact (test_unit );
176
+ const tls_run_test_unit = b .step ("test:unit" , "Run the unit test" );
177
+ tls_run_test_unit .dependOn (& run_test_unit .step );
178
+ tls_run_test .dependOn (& run_test_unit .step );
179
+
180
+ const module_int = b .createModule (.{
181
+ .root_source_file = b .path ("test/int/root.zig" ),
182
+ .target = target ,
183
+ .optimize = optimize ,
184
+ });
185
+ b .modules .put (b .dupe ("int" ), module_int ) catch @panic ("OOM" );
186
+
187
+ const test_int = b .addTest (.{
188
+ .name = "int" ,
189
+ .root_module = module_int ,
190
+ .filters = &[_ ][]const u8 {},
191
+ });
192
+ const install_test_int = b .addInstallArtifact (test_int , .{});
193
+ const tls_install_test_int = b .step ("build-test:int" , "Install the int test" );
194
+ tls_install_test_int .dependOn (& install_test_int .step );
195
+
196
+ const run_test_int = b .addRunArtifact (test_int );
197
+ const tls_run_test_int = b .step ("test:int" , "Run the int test" );
198
+ tls_run_test_int .dependOn (& run_test_int .step );
199
+ tls_run_test .dependOn (& run_test_int .step );
200
+
201
+ module_config .addImport ("build_options" , options_module_build_options );
202
+ module_config .addImport ("params" , module_params );
203
+ module_config .addImport ("consensus_types" , module_consensus_types );
204
+ module_config .addImport ("hex" , module_hex );
205
+
74
206
module_consensus_types .addImport ("build_options" , options_module_build_options );
75
207
module_consensus_types .addImport ("ssz" , dep_ssz .module ("ssz" ));
76
208
209
+ module_params .addImport ("build_options" , options_module_build_options );
210
+ module_params .addImport ("consensus_types" , module_consensus_types );
211
+
212
+ module_state_transition .addImport ("build_options" , options_module_build_options );
213
+ module_state_transition .addImport ("ssz" , dep_ssz .module ("ssz" ));
214
+ module_state_transition .addImport ("config" , module_config );
215
+ module_state_transition .addImport ("consensus_types" , module_consensus_types );
216
+ module_state_transition .addImport ("blst_min_pk" , dep_blst_z .module ("blst_min_pk" ));
217
+ module_state_transition .addImport ("params" , module_params );
218
+
219
+ module_unit .addImport ("build_options" , options_module_build_options );
220
+ module_unit .addImport ("ssz" , dep_ssz .module ("ssz" ));
221
+ module_unit .addImport ("state_transition" , module_state_transition );
222
+ module_unit .addImport ("config" , module_config );
223
+ module_unit .addImport ("params" , module_params );
224
+ module_unit .addImport ("consensus_types" , module_consensus_types );
225
+ module_unit .addImport ("blst_min_pk" , dep_blst_z .module ("blst_min_pk" ));
226
+
227
+ module_int .addImport ("build_options" , options_module_build_options );
228
+ module_int .addImport ("ssz" , dep_ssz .module ("ssz" ));
229
+ module_int .addImport ("state_transition" , module_state_transition );
230
+ module_int .addImport ("config" , module_config );
231
+ module_int .addImport ("consensus_types" , module_consensus_types );
77
232
}
0 commit comments