Skip to content

Commit 11f86d4

Browse files
committed
update docgen for std Target.Query API breaks
1 parent a3c93e1 commit 11f86d4

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

tools/docgen.zig

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ const print = std.debug.print;
99
const mem = std.mem;
1010
const testing = std.testing;
1111
const Allocator = std.mem.Allocator;
12+
const getExternalExecutor = std.zig.system.getExternalExecutor;
1213

1314
const max_doc_file_size = 10 * 1024 * 1024;
1415

15-
const exe_ext = @as(std.zig.CrossTarget, .{}).exeFileExt();
1616
const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch);
1717
const tmp_dir_name = "docgen_tmp";
18-
const test_out_path = tmp_dir_name ++ fs.path.sep_str ++ "test" ++ exe_ext;
1918

2019
const usage =
2120
\\Usage: docgen [--zig] [--skip-code-tests] input output"
@@ -1309,7 +1308,7 @@ fn genHtml(
13091308
var env_map = try process.getEnvMap(allocator);
13101309
try env_map.put("YES_COLOR", "1");
13111310

1312-
const host = try std.zig.system.NativeTargetInfo.detect(.{});
1311+
const host = try std.zig.system.resolveTargetQuery(.{});
13131312
const builtin_code = try getBuiltinCode(allocator, &env_map, zig_exe, opt_zig_lib_dir);
13141313

13151314
for (toc.nodes) |node| {
@@ -1424,9 +1423,7 @@ fn genHtml(
14241423
try build_args.append("-lc");
14251424
try shell_out.print("-lc ", .{});
14261425
}
1427-
const target = try std.zig.CrossTarget.parse(.{
1428-
.arch_os_abi = code.target_str orelse "native",
1429-
});
1426+
14301427
if (code.target_str) |triple| {
14311428
try build_args.appendSlice(&[_][]const u8{ "-target", triple });
14321429
try shell_out.print("-target {s} ", .{triple});
@@ -1490,9 +1487,13 @@ fn genHtml(
14901487
}
14911488
}
14921489

1490+
const target_query = try std.Target.Query.parse(.{
1491+
.arch_os_abi = code.target_str orelse "native",
1492+
});
1493+
const target = try std.zig.system.resolveTargetQuery(target_query);
1494+
14931495
const path_to_exe = try std.fmt.allocPrint(allocator, "./{s}{s}", .{
1494-
code.name,
1495-
target.exeFileExt(),
1496+
code.name, target.exeFileExt(),
14961497
});
14971498
const run_args = &[_][]const u8{path_to_exe};
14981499

@@ -1565,13 +1566,13 @@ fn genHtml(
15651566
try test_args.appendSlice(&[_][]const u8{ "-target", triple });
15661567
try shell_out.print("-target {s} ", .{triple});
15671568

1568-
const cross_target = try std.zig.CrossTarget.parse(.{
1569+
const target_query = try std.Target.Query.parse(.{
15691570
.arch_os_abi = triple,
15701571
});
1571-
const target_info = try std.zig.system.NativeTargetInfo.detect(
1572-
cross_target,
1572+
const target = try std.zig.system.resolveTargetQuery(
1573+
target_query,
15731574
);
1574-
switch (host.getExternalExecutor(&target_info, .{
1575+
switch (getExternalExecutor(host, &target, .{
15751576
.link_libc = code.link_libc,
15761577
})) {
15771578
.native => {},

0 commit comments

Comments
 (0)