Skip to content

fix some breaking changes with build runner and NativePaths.detect #2368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = 15, .patch = 0, .pre = "dev" };

/// Specify the minimum Zig version that is required to compile and test ZLS:
/// std.Build: resolved generated paths are cwd-relative
/// Target: pass and use locals by pointer instead of by value
///
/// 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 = 15, .patch = 0,
/// ```
///
/// Also update the `minimum_zig_version` in `build.zig.zon`.
const minimum_build_zig_version = "0.15.0-dev.631+9a3540d61";
const minimum_build_zig_version = "0.15.0-dev.864+75d0ec9c0";

/// Specify the minimum Zig version that is required to run ZLS:
/// Release 0.14.0
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
.version = "0.15.0-dev",
// Must be kept in line with the `minimum_build_zig_version` in `build.zig`.
// Should be a Zig version that is downloadable from https://ziglang.org/download/ or a mirror.
.minimum_zig_version = "0.15.0-dev.769+4d7980645",
.minimum_zig_version = "0.15.0-dev.864+75d0ec9c0",
// 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.

2 changes: 1 addition & 1 deletion src/DocumentStore.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ pub fn collectIncludeDirs(
.ofmt = comptime std.Target.ObjectFormat.default(builtin.os.tag, builtin.cpu.arch),
.dynamic_linker = std.Target.DynamicLinker.none,
};
const native_paths: std.zig.system.NativePaths = try .detect(arena_allocator.allocator(), target_info);
const native_paths: std.zig.system.NativePaths = try .detect(arena_allocator.allocator(), &target_info);

try include_dirs.ensureUnusedCapacity(allocator, native_paths.include_dirs.items.len);
for (native_paths.include_dirs.items) |native_include_dir| {
Expand Down
12 changes: 9 additions & 3 deletions src/build_runner/0.14.0.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub const dependencies = @import("@dependencies");
// ----------- List of Zig versions that introduced breaking changes -----------

const add_embed_path_version = std.SemanticVersion.parse("0.15.0-dev.141+b5a526054") catch unreachable;
const config_header_generated_dir_version = std.SemanticVersion.parse("0.15.0-dev.847+850655f0") catch unreachable;

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

Expand Down Expand Up @@ -1075,7 +1076,7 @@ fn extractBuildInformation(
if (has_embed_path and include_dir == .embed_path) {
// This only affects C source files
} else if (include_dir == .config_header_step) {
try set.put(allocator, include_dir.config_header_step.output_file.step, {});
try set.put(allocator, &include_dir.config_header_step.step, {});
} else unreachable;
},
}
Expand Down Expand Up @@ -1146,12 +1147,17 @@ fn extractBuildInformation(
},
else => {
const has_embed_path = comptime builtin.zig_version.order(add_embed_path_version) != .lt;
const config_header_has_generated_dir = comptime builtin.zig_version.order(config_header_generated_dir_version) != .lt;
comptime assert(@typeInfo(std.Build.Module.IncludeDir).@"union".fields.len == @as(usize, 7) + @intFromBool(has_embed_path));
if (has_embed_path and include_dir == .embed_path) {
// This only affects C source files
} else if (include_dir == .config_header_step) {
const full_file_path = include_dir.config_header_step.output_file.getPath();
const header_dir_path = full_file_path[0 .. full_file_path.len - include_dir.config_header_step.include_path.len];
const header_dir_path = if (config_header_has_generated_dir)
include_dir.config_header_step.generated_dir.getPath()
else blk: {
const full_file_path = include_dir.config_header_step.output_file.getPath();
break :blk full_file_path[0 .. full_file_path.len - include_dir.config_header_step.include_path.len];
};
try include_dirs.put(
allocator,
header_dir_path,
Expand Down