authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-12-04 23:16:42-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-01 17:51:18-07:00
logf5613a0e3589fcca51411ce379f3c90eace99fa6
tree32300af5524638edd0534d6755551bc3956f3c26
parent8d5da5558827d9152dc8453c87c41ac6519f8a05

update docgen for std Target.Query API breaks


1 files changed, 13 insertions(+), 12 deletions(-)

tools/docgen.zig+13-12
......@@ -9,13 +9,12 @@ const print = std.debug.print;
99const mem = std.mem;
1010const testing = std.testing;
1111const Allocator = std.mem.Allocator;
12const getExternalExecutor = std.zig.system.getExternalExecutor;
1213
1314const max_doc_file_size = 10 * 1024 * 1024;
1415
15const exe_ext = @as(std.zig.CrossTarget, .{}).exeFileExt();
1616const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch);
1717const tmp_dir_name = "docgen_tmp";
18const test_out_path = tmp_dir_name ++ fs.path.sep_str ++ "test" ++ exe_ext;
1918
2019const 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 => {},