Skip to content

Commit

Permalink
update build runner for latest zig master
Browse files Browse the repository at this point in the history
  • Loading branch information
leecannon committed Dec 17, 2024
1 parent a74eda0 commit f7c8d9a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
4 changes: 2 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const builtin = @import("builtin");
const zls_version = std.SemanticVersion{ .major = 0, .minor = 14, .patch = 0, .pre = "dev" };

/// Specify the minimum Zig version that is required to compile and test ZLS:
/// compiler: remove anonymous struct types, unify all tuples
/// Sema: disallow unsafe in-memory coercions #22243
///
/// If you do not use Nix, a ZLS maintainer can take care of this.
/// Whenever this version is increased, run the following command:
Expand All @@ -15,7 +15,7 @@ const zls_version = std.SemanticVersion{ .major = 0, .minor = 14, .patch = 0, .p
/// ```
///
/// Must match the `minimum_zig_version` in `build.zig.zon`.
const minimum_build_zig_version = "0.14.0-dev.2088+3f7fac5ff";
const minimum_build_zig_version = "0.14.0-dev.2506+32354d119";

/// Specify the minimum Zig version that is required to run ZLS:
/// Release 0.12.0
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Must match the `zls_version` in `build.zig`
.version = "0.14.0-dev",
// Must match the `minimum_build_zig_version` in `build.zig`
.minimum_zig_version = "0.14.0-dev.2088+3f7fac5ff",
.minimum_zig_version = "0.14.0-dev.2506+32354d119",
// If you do not use Nix, a ZLS maintainer can take care of this.
// Whenever the dependencies are updated, run the following command:
// ```bash
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 @@ -41,6 +41,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 @@ -775,20 +777,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 f7c8d9a

Please sign in to comment.