1-
21const std = @import ("std" );
32
43pub fn build (b : * std.Build ) void {
5- const target = b .standardTargetOptions (.{});
6- const optimize = b .standardOptimizeOption (.{});
7-
8- const spice_dep = b .dependency ("spice" , .{
9- .target = target ,
10- .optimize = optimize ,
11- });
12-
134 // Core module
145 const core_module = b .addModule ("core" , .{
156 .root_source_file = .{ .cwd_relative = "src/framework/core.zig" },
@@ -23,178 +14,44 @@ pub fn build(b: *std.Build) void {
2314 },
2415 });
2516
26- // Framework module
27- const framework_module = b .addModule ("framework" , .{
28- .root_source_file = .{ .cwd_relative = "src/framework/server.zig" },
29- .imports = &.{
30- .{ .name = "spice" , .module = spice_dep .module ("spice" ) },
31- .{ .name = "core" , .module = core_module },
32- .{ .name = "schema" , .module = schema_module },
33- },
34- });
35-
3617 // Runtime Router module
3718 const runtime_router_module = b .addModule ("runtime_router" , .{
3819 .root_source_file = .{ .cwd_relative = "src/framework/trpc/runtime_router.zig" },
3920 .imports = &.{
40- .{ .name = "schema" , .module = schema_module },
41- .{ .name = "framework" , .module = framework_module },
4221 .{ .name = "core" , .module = core_module },
43- .{ .name = "spice " , .module = spice_dep . module ( "spice" ) },
22+ .{ .name = "schema " , .module = schema_module },
4423 },
4524 });
4625
4726 // gRPC Router module
4827 const grpc_router_module = b .addModule ("grpc_router" , .{
4928 .root_source_file = .{ .cwd_relative = "src/framework/trpc/grpc_router.zig" },
5029 .imports = &.{
30+ .{ .name = "core" , .module = core_module },
5131 .{ .name = "schema" , .module = schema_module },
5232 .{ .name = "runtime_router" , .module = runtime_router_module },
53- .{ .name = "framework" , .module = framework_module },
54- .{ .name = "core" , .module = core_module },
55- .{ .name = "spice" , .module = spice_dep .module ("spice" ) },
5633 },
5734 });
5835
59- // Server executable
60- const server = b .addExecutable (.{
61- .name = "server" ,
62- .root_source_file = .{ .cwd_relative = "src/main.zig" },
63- .target = target ,
64- .optimize = optimize ,
65- });
66-
67- // Add module dependencies to server
68- server .root_module .addImport ("framework" , framework_module );
69- server .root_module .addImport ("core" , core_module );
70- server .root_module .addImport ("schema" , schema_module );
71- server .root_module .addImport ("runtime_router" , runtime_router_module );
72- server .root_module .addImport ("grpc_router" , grpc_router_module );
73- server .root_module .addImport ("spice" , spice_dep .module ("spice" ));
74-
75- b .installArtifact (server );
76-
77- // Client executable
78- const client = b .addExecutable (.{
79- .name = "client" ,
80- .root_source_file = .{ .cwd_relative = "src/client.zig" },
81- .target = target ,
82- .optimize = optimize ,
83- });
84- b .installArtifact (client );
85-
86- // Run steps
87- const run_server_cmd = b .addRunArtifact (server );
88- const run_server_step = b .step ("run-server" , "Run the gRPC server" );
89- run_server_step .dependOn (& run_server_cmd .step );
90-
91- const run_client_cmd = b .addRunArtifact (client );
92- const run_client_step = b .step ("run-client" , "Run the gRPC client" );
93- run_client_step .dependOn (& run_client_cmd .step );
94-
95- // gRPC Example executable
96- const grpc_example = b .addExecutable (.{
97- .name = "grpc-example" ,
98- .root_source_file = .{ .cwd_relative = "src/framework/trpc/grpc_example.zig" },
99- .target = target ,
100- .optimize = optimize ,
101- });
102-
103- // Add module dependencies to gRPC example
104- grpc_example .root_module .addImport ("framework" , framework_module );
105- grpc_example .root_module .addImport ("core" , core_module );
106- grpc_example .root_module .addImport ("schema" , schema_module );
107- grpc_example .root_module .addImport ("runtime_router" , runtime_router_module );
108- grpc_example .root_module .addImport ("grpc_router" , grpc_router_module );
109- grpc_example .root_module .addImport ("spice" , spice_dep .module ("spice" ));
110-
111- b .installArtifact (grpc_example );
112-
113- const run_example_cmd = b .addRunArtifact (grpc_example );
114- const run_example_step = b .step ("run-example" , "Run the gRPC example server" );
115- run_example_step .dependOn (& run_example_cmd .step );
116-
117- // Add test client
118- const test_client = b .addExecutable (.{
119- .name = "grpc-test-client" ,
120- .root_source_file = .{ .cwd_relative = "src/framework/trpc/grpc_test_client.zig" },
121- .target = target ,
122- .optimize = optimize ,
123- });
124- const run_test_client = b .addRunArtifact (test_client );
125- const run_test_client_step = b .step ("run-test-client" , "Run the test client" );
126- run_test_client_step .dependOn (& run_test_client .step );
127-
128- // Test step
129- const test_step = b .step ("test" , "Run all tests" );
130-
131- // Server tests
132- const server_tests = b .addTest (.{
133- .root_source_file = .{ .cwd_relative = "src/framework/server_test.zig" },
134- .target = target ,
135- .optimize = optimize ,
136- });
137-
138- // Add module dependencies to server tests
139- server_tests .root_module .addImport ("framework" , framework_module );
140- server_tests .root_module .addImport ("core" , core_module );
141- server_tests .root_module .addImport ("schema" , schema_module );
142- server_tests .root_module .addImport ("runtime_router" , runtime_router_module );
143- server_tests .root_module .addImport ("grpc_router" , grpc_router_module );
144- server_tests .root_module .addImport ("spice" , spice_dep .module ("spice" ));
145-
146- const run_server_tests = b .addRunArtifact (server_tests );
147- test_step .dependOn (& run_server_tests .step );
148-
149- // TRPC tests
150- const trpc_tests = b .addTest (.{
151- .root_source_file = .{ .cwd_relative = "src/framework/trpc_test.zig" },
152- .target = target ,
153- .optimize = optimize ,
36+ // Framework module
37+ const framework_module = b .addModule ("framework" , .{
38+ .root_source_file = .{ .cwd_relative = "src/framework/server.zig" },
39+ .imports = &.{
40+ .{ .name = "core" , .module = core_module },
41+ .{ .name = "schema" , .module = schema_module },
42+ .{ .name = "grpc_router" , .module = grpc_router_module },
43+ },
15444 });
15545
156- // Add module dependencies to TRPC tests
157- trpc_tests .root_module .addImport ("framework" , framework_module );
158- trpc_tests .root_module .addImport ("core" , core_module );
159- trpc_tests .root_module .addImport ("schema" , schema_module );
160- trpc_tests .root_module .addImport ("runtime_router" , runtime_router_module );
161- trpc_tests .root_module .addImport ("grpc_router" , grpc_router_module );
162- trpc_tests .root_module .addImport ("spice" , spice_dep .module ("spice" ));
163-
164- const run_trpc_tests = b .addRunArtifact (trpc_tests );
165- test_step .dependOn (& run_trpc_tests .step );
166-
167- // Run step
168- const run_step = b .step ("run" , "Run the server executable" );
169- run_step .dependOn (& run_server_cmd .step );
170-
171- // Export modules for other packages
172- _ = b .addModule ("zup" , .{
46+ // API module
47+ _ = b .addModule ("zup-api" , .{
17348 .root_source_file = .{ .cwd_relative = "src/root.zig" },
17449 .imports = &.{
175- .{ .name = "spice" , .module = spice_dep .module ("spice" ) },
17650 .{ .name = "core" , .module = core_module },
17751 .{ .name = "framework" , .module = framework_module },
17852 .{ .name = "schema" , .module = schema_module },
17953 .{ .name = "runtime_router" , .module = runtime_router_module },
18054 .{ .name = "grpc_router" , .module = grpc_router_module },
18155 },
18256 });
183-
184- // Add zup CLI tool
185- const zup_cli = b .addExecutable (.{
186- .name = "zup" ,
187- .root_source_file = .{ .cwd_relative = "zup.zig" },
188- .target = target ,
189- .optimize = optimize ,
190- });
191- b .installArtifact (zup_cli );
192-
193- const run_zup_cmd = b .addRunArtifact (zup_cli );
194- if (b .args ) | args | {
195- run_zup_cmd .addArgs (args );
196- }
197- const run_zup_step = b .step ("run-zup" , "Run the zup CLI tool" );
198- run_zup_step .dependOn (& run_zup_cmd .step );
199-
20057}
0 commit comments