diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 32 |
1 files changed, 0 insertions, 32 deletions
| @@ -42,43 +42,11 @@ pub fn build(b: *std.Build) void { | |||
| 42 | }); | 42 | }); |
| 43 | docs_step.dependOn(&install_docs.step); | 43 | docs_step.dependOn(&install_docs.step); |
| 44 | 44 | ||
| 45 | const readme_step = b.step("readme", "Remake README."); | ||
| 46 | const readme = readMeStep(b); | ||
| 47 | readme.dependOn(example_step); | ||
| 48 | readme_step.dependOn(readme); | ||
| 49 | |||
| 50 | const all_step = b.step("all", "Build everything and runs all tests"); | 45 | const all_step = b.step("all", "Build everything and runs all tests"); |
| 51 | all_step.dependOn(test_step); | 46 | all_step.dependOn(test_step); |
| 52 | all_step.dependOn(example_step); | 47 | all_step.dependOn(example_step); |
| 53 | all_step.dependOn(readme_step); | ||
| 54 | 48 | ||
| 55 | b.default_step.dependOn(all_step); | 49 | b.default_step.dependOn(all_step); |
| 56 | } | 50 | } |
| 57 | 51 | ||
| 58 | fn readMeStep(b: *std.Build) *std.Build.Step { | ||
| 59 | const s = b.allocator.create(std.Build.Step) catch unreachable; | ||
| 60 | s.* = std.Build.Step.init(.{ | ||
| 61 | .id = .custom, | ||
| 62 | .name = "ReadMeStep", | ||
| 63 | .owner = b, | ||
| 64 | .makeFn = struct { | ||
| 65 | fn make(step: *std.Build.Step, _: std.Build.Step.MakeOptions) anyerror!void { | ||
| 66 | @setEvalBranchQuota(10000); | ||
| 67 | _ = step; | ||
| 68 | const file = try std.fs.cwd().createFile("README.md", .{}); | ||
| 69 | const stream = file.writer(); | ||
| 70 | try stream.print(@embedFile("example/README.md.template"), .{ | ||
| 71 | @embedFile("example/simple.zig"), | ||
| 72 | @embedFile("example/simple-ex.zig"), | ||
| 73 | @embedFile("example/subcommands.zig"), | ||
| 74 | @embedFile("example/streaming-clap.zig"), | ||
| 75 | @embedFile("example/help.zig"), | ||
| 76 | @embedFile("example/usage.zig"), | ||
| 77 | }); | ||
| 78 | } | ||
| 79 | }.make, | ||
| 80 | }); | ||
| 81 | return s; | ||
| 82 | } | ||
| 83 | |||
| 84 | const std = @import("std"); | 52 | const std = @import("std"); |