File tree Expand file tree Collapse file tree 6 files changed +98
-6
lines changed
Expand file tree Collapse file tree 6 files changed +98
-6
lines changed Original file line number Diff line number Diff line change 1+
2+
3+ NEW_PACKAGE_NAME = " demo"
Original file line number Diff line number Diff line change 1616
1717# env file:
1818dotenv :
19- - .env
19+ - .env
2020
2121# ###############################################################################################
2222
@@ -44,17 +44,20 @@ tasks:
4444
4545 new :
4646 cmds :
47- - mkdir demo; cd demo; zig init-exe
47+ - mkdir ${NEW_PACKAGE_NAME}; cd ${NEW_PACKAGE_NAME}; zig init-exe
48+ dir : packages/
4849
4950 new:lib :
5051 cmds :
51- # - mkdir ${NEW_PACKAGE_NAME}; cd ${NEW_PACKAGE_NAME}; zig init-lib
52- - mkdir demo; cd demo; zig init-lib
52+ - mkdir ${NEW_PACKAGE_NAME}; cd ${NEW_PACKAGE_NAME}; zig init-lib
53+ dir : packages/
5354
5455 run :
5556 cmds :
56- - cd demo; zig build run
57+ - cd ${NEW_PACKAGE_NAME}; zig build run
58+ dir : packages/
5759
5860 build:lib :
5961 cmds :
60- - cd demo; zig build test
62+ - cd ${NEW_PACKAGE_NAME}; zig build test
63+ dir : packages/
Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+
3+ pub fn build (b : * std.build.Builder ) void {
4+ // Standard target options allows the person running `zig build` to choose
5+ // what target to build for. Here we do not override the defaults, which
6+ // means any target is allowed, and the default is native. Other options
7+ // for restricting supported target set are available.
8+ const target = b .standardTargetOptions (.{});
9+
10+ // Standard release options allow the person running `zig build` to select
11+ // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
12+ const mode = b .standardReleaseOptions ();
13+
14+ const exe = b .addExecutable ("basic" , "src/main.zig" );
15+ exe .setTarget (target );
16+ exe .setBuildMode (mode );
17+ exe .install ();
18+
19+ const run_cmd = exe .run ();
20+ run_cmd .step .dependOn (b .getInstallStep ());
21+ if (b .args ) | args | {
22+ run_cmd .addArgs (args );
23+ }
24+
25+ const run_step = b .step ("run" , "Run the app" );
26+ run_step .dependOn (& run_cmd .step );
27+
28+ const exe_tests = b .addTest ("src/main.zig" );
29+ exe_tests .setTarget (target );
30+ exe_tests .setBuildMode (mode );
31+
32+ const test_step = b .step ("test" , "Run unit tests" );
33+ test_step .dependOn (& exe_tests .step );
34+ }
Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+
3+ pub fn main () anyerror ! void {
4+ std .log .info ("All your codebase are belong to us." , .{});
5+ }
6+
7+ test "basic test" {
8+ try std .testing .expectEqual (10 , 3 + 7 );
9+ }
Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+
3+ pub fn build (b : * std.build.Builder ) void {
4+ // Standard target options allows the person running `zig build` to choose
5+ // what target to build for. Here we do not override the defaults, which
6+ // means any target is allowed, and the default is native. Other options
7+ // for restricting supported target set are available.
8+ const target = b .standardTargetOptions (.{});
9+
10+ // Standard release options allow the person running `zig build` to select
11+ // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
12+ const mode = b .standardReleaseOptions ();
13+
14+ const exe = b .addExecutable ("toolbox" , "src/main.zig" );
15+ exe .setTarget (target );
16+ exe .setBuildMode (mode );
17+ exe .install ();
18+
19+ const run_cmd = exe .run ();
20+ run_cmd .step .dependOn (b .getInstallStep ());
21+ if (b .args ) | args | {
22+ run_cmd .addArgs (args );
23+ }
24+
25+ const run_step = b .step ("run" , "Run the app" );
26+ run_step .dependOn (& run_cmd .step );
27+
28+ const exe_tests = b .addTest ("src/main.zig" );
29+ exe_tests .setTarget (target );
30+ exe_tests .setBuildMode (mode );
31+
32+ const test_step = b .step ("test" , "Run unit tests" );
33+ test_step .dependOn (& exe_tests .step );
34+ }
Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+
3+ pub fn main () anyerror ! void {
4+ std .log .info ("All your codebase are belong to us." , .{});
5+ }
6+
7+ test "basic test" {
8+ try std .testing .expectEqual (10 , 3 + 7 );
9+ }
You can’t perform that action at this time.
0 commit comments