Skip to content

Commit

Permalink
build_runner: Zig 0.14.0-dev.2506+32354d119 compatibility
Browse files Browse the repository at this point in the history
author:"Lee Cannon <[email protected]>"
  • Loading branch information
llogick committed Dec 18, 2024
1 parent e41fbde commit 95a9de6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/build_runner/0.12.0.zig
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const live_rebuild_processes =
std.SemanticVersion.parse("0.14.0-dev.310+9d38e82b5") catch unreachable;
const file_watch_windows_version =
std.SemanticVersion.parse("0.14.0-dev.625+2de0e2eca") catch unreachable;
const child_type_coercion_version =
std.SemanticVersion.parse("0.14.0-dev.2506+32354d119") catch unreachable;

// -----------------------------------------------------------------------------

Expand Down Expand Up @@ -779,20 +781,25 @@ fn workerMakeOneStep(
}
}

fn nextArg(args: [][:0]const u8, idx: *usize) ?[:0]const u8 {
const ArgsType = if (builtin.zig_version.order(child_type_coercion_version) == .lt)
[][:0]const u8
else
[]const [:0]const u8;

fn nextArg(args: ArgsType, idx: *usize) ?[:0]const u8 {
if (idx.* >= args.len) return null;
defer idx.* += 1;
return args[idx.*];
}

fn nextArgOrFatal(args: [][:0]const u8, idx: *usize) [:0]const u8 {
fn nextArgOrFatal(args: ArgsType, idx: *usize) [:0]const u8 {
return nextArg(args, idx) orelse {
std.debug.print("expected argument after '{s}'\n access the help menu with 'zig build -h'\n", .{args[idx.* - 1]});
process.exit(1);
};
}

fn argsRest(args: [][:0]const u8, idx: usize) ?[][:0]const u8 {
fn argsRest(args: ArgsType, idx: usize) ?ArgsType {
if (idx >= args.len) return null;
return args[idx..];
}
Expand Down

0 comments on commit 95a9de6

Please sign in to comment.