| ... | @@ -9,13 +9,12 @@ const print = std.debug.print; | ... | @@ -9,13 +9,12 @@ const print = std.debug.print; |
| 9 | const mem = std.mem; | 9 | const mem = std.mem; |
| 10 | const testing = std.testing; | 10 | const testing = std.testing; |
| 11 | const Allocator = std.mem.Allocator; | 11 | const Allocator = std.mem.Allocator; |
| | 12 | const getExternalExecutor = std.zig.system.getExternalExecutor; |
| 12 | | 13 | |
| 13 | const max_doc_file_size = 10 * 1024 * 1024; | 14 | const max_doc_file_size = 10 * 1024 * 1024; |
| 14 | | 15 | |
| 15 | const exe_ext = @as(std.zig.CrossTarget, .{}).exeFileExt(); | | |
| 16 | const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch); | 16 | const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch); |
| 17 | const tmp_dir_name = "docgen_tmp"; | 17 | const tmp_dir_name = "docgen_tmp"; |
| 18 | const test_out_path = tmp_dir_name ++ fs.path.sep_str ++ "test" ++ exe_ext; | | |
| 19 | | 18 | |
| 20 | const usage = | 19 | const usage = |
| 21 | \\Usage: docgen [--zig] [--skip-code-tests] input output" | 20 | \\Usage: docgen [--zig] [--skip-code-tests] input output" |
| ... | @@ -1309,7 +1308,7 @@ fn genHtml( | ... | @@ -1309,7 +1308,7 @@ fn genHtml( |
| 1309 | var env_map = try process.getEnvMap(allocator); | 1308 | var env_map = try process.getEnvMap(allocator); |
| 1310 | try env_map.put("YES_COLOR", "1"); | 1309 | try env_map.put("YES_COLOR", "1"); |
| 1311 | | 1310 | |
| 1312 | const host = try std.zig.system.NativeTargetInfo.detect(.{}); | 1311 | const host = try std.zig.system.resolveTargetQuery(.{}); |
| 1313 | const builtin_code = try getBuiltinCode(allocator, &env_map, zig_exe, opt_zig_lib_dir); | 1312 | const builtin_code = try getBuiltinCode(allocator, &env_map, zig_exe, opt_zig_lib_dir); |
| 1314 | | 1313 | |
| 1315 | for (toc.nodes) |node| { | 1314 | for (toc.nodes) |node| { |
| ... | @@ -1424,9 +1423,7 @@ fn genHtml( | ... | @@ -1424,9 +1423,7 @@ fn genHtml( |
| 1424 | try build_args.append("-lc"); | 1423 | try build_args.append("-lc"); |
| 1425 | try shell_out.print("-lc ", .{}); | 1424 | try shell_out.print("-lc ", .{}); |
| 1426 | } | 1425 | } |
| 1427 | const target = try std.zig.CrossTarget.parse(.{ | 1426 | |
| 1428 | .arch_os_abi = code.target_str orelse "native", | | |
| 1429 | }); | | |
| 1430 | if (code.target_str) |triple| { | 1427 | if (code.target_str) |triple| { |
| 1431 | try build_args.appendSlice(&[_][]const u8{ "-target", triple }); | 1428 | try build_args.appendSlice(&[_][]const u8{ "-target", triple }); |
| 1432 | try shell_out.print("-target {s} ", .{triple}); | 1429 | try shell_out.print("-target {s} ", .{triple}); |
| ... | @@ -1490,9 +1487,13 @@ fn genHtml( | ... | @@ -1490,9 +1487,13 @@ fn genHtml( |
| 1490 | } | 1487 | } |
| 1491 | } | 1488 | } |
| 1492 | | 1489 | |
| | 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 | |
| 1493 | const path_to_exe = try std.fmt.allocPrint(allocator, "./{s}{s}", .{ | 1495 | const path_to_exe = try std.fmt.allocPrint(allocator, "./{s}{s}", .{ |
| 1494 | code.name, | 1496 | code.name, target.exeFileExt(), |
| 1495 | target.exeFileExt(), | | |
| 1496 | }); | 1497 | }); |
| 1497 | const run_args = &[_][]const u8{path_to_exe}; | 1498 | const run_args = &[_][]const u8{path_to_exe}; |
| 1498 | | 1499 | |
| ... | @@ -1565,13 +1566,13 @@ fn genHtml( | ... | @@ -1565,13 +1566,13 @@ fn genHtml( |
| 1565 | try test_args.appendSlice(&[_][]const u8{ "-target", triple }); | 1566 | try test_args.appendSlice(&[_][]const u8{ "-target", triple }); |
| 1566 | try shell_out.print("-target {s} ", .{triple}); | 1567 | try shell_out.print("-target {s} ", .{triple}); |
| 1567 | | 1568 | |
| 1568 | const cross_target = try std.zig.CrossTarget.parse(.{ | 1569 | const target_query = try std.Target.Query.parse(.{ |
| 1569 | .arch_os_abi = triple, | 1570 | .arch_os_abi = triple, |
| 1570 | }); | 1571 | }); |
| 1571 | const target_info = try std.zig.system.NativeTargetInfo.detect( | 1572 | const target = try std.zig.system.resolveTargetQuery( |
| 1572 | cross_target, | 1573 | target_query, |
| 1573 | ); | 1574 | ); |
| 1574 | switch (host.getExternalExecutor(&target_info, .{ | 1575 | switch (getExternalExecutor(host, &target, .{ |
| 1575 | .link_libc = code.link_libc, | 1576 | .link_libc = code.link_libc, |
| 1576 | })) { | 1577 | })) { |
| 1577 | .native => {}, | 1578 | .native => {}, |