Tool to recursively find Cargo.toml files and update the rust-version value to the latest installed Rust.
1const std = @import("std");
2
3pub fn build(b: *std.Build) void {
4 const target = b.standardTargetOptions(.{});
5 const optimize = b.standardOptimizeOption(.{});
6 const strip = b.option(bool, "strip", "Strip debug symbols from the binary") orelse false;
7
8 const exe = b.addExecutable(.{
9 .name = "rust-version-updater",
10 .root_module = b.createModule(.{
11 .root_source_file = b.path("src/main.zig"),
12 .target = target,
13 .optimize = optimize,
14 .strip = strip,
15 }),
16 });
17
18 b.installArtifact(exe);
19
20 const run_cmd = b.addRunArtifact(exe);
21 run_cmd.step.dependOn(b.getInstallStep());
22
23 if (b.args) |args| {
24 run_cmd.addArgs(args);
25 }
26
27 const run_step = b.step("run", "Run the rust-version-updater");
28 run_step.dependOn(&run_cmd.step);
29
30 const unit_tests = b.addTest(.{
31 .root_module = b.createModule(.{
32 .root_source_file = b.path("src/main.zig"),
33 .target = target,
34 .optimize = optimize,
35 }),
36 });
37
38 const run_unit_tests = b.addRunArtifact(unit_tests);
39 const test_step = b.step("test", "Run unit tests");
40 test_step.dependOn(&run_unit_tests.step);
41}