Commit f5613a0e35
Changed files (1)
tools
tools/docgen.zig
@@ -9,13 +9,12 @@ const print = std.debug.print;
const mem = std.mem;
const testing = std.testing;
const Allocator = std.mem.Allocator;
+const getExternalExecutor = std.zig.system.getExternalExecutor;
const max_doc_file_size = 10 * 1024 * 1024;
-const exe_ext = @as(std.zig.CrossTarget, .{}).exeFileExt();
const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch);
const tmp_dir_name = "docgen_tmp";
-const test_out_path = tmp_dir_name ++ fs.path.sep_str ++ "test" ++ exe_ext;
const usage =
\\Usage: docgen [--zig] [--skip-code-tests] input output"
@@ -1309,7 +1308,7 @@ fn genHtml(
var env_map = try process.getEnvMap(allocator);
try env_map.put("YES_COLOR", "1");
- const host = try std.zig.system.NativeTargetInfo.detect(.{});
+ const host = try std.zig.system.resolveTargetQuery(.{});
const builtin_code = try getBuiltinCode(allocator, &env_map, zig_exe, opt_zig_lib_dir);
for (toc.nodes) |node| {
@@ -1424,9 +1423,7 @@ fn genHtml(
try build_args.append("-lc");
try shell_out.print("-lc ", .{});
}
- const target = try std.zig.CrossTarget.parse(.{
- .arch_os_abi = code.target_str orelse "native",
- });
+
if (code.target_str) |triple| {
try build_args.appendSlice(&[_][]const u8{ "-target", triple });
try shell_out.print("-target {s} ", .{triple});
@@ -1490,9 +1487,13 @@ fn genHtml(
}
}
+ const target_query = try std.Target.Query.parse(.{
+ .arch_os_abi = code.target_str orelse "native",
+ });
+ const target = try std.zig.system.resolveTargetQuery(target_query);
+
const path_to_exe = try std.fmt.allocPrint(allocator, "./{s}{s}", .{
- code.name,
- target.exeFileExt(),
+ code.name, target.exeFileExt(),
});
const run_args = &[_][]const u8{path_to_exe};
@@ -1565,13 +1566,13 @@ fn genHtml(
try test_args.appendSlice(&[_][]const u8{ "-target", triple });
try shell_out.print("-target {s} ", .{triple});
- const cross_target = try std.zig.CrossTarget.parse(.{
+ const target_query = try std.Target.Query.parse(.{
.arch_os_abi = triple,
});
- const target_info = try std.zig.system.NativeTargetInfo.detect(
- cross_target,
+ const target = try std.zig.system.resolveTargetQuery(
+ target_query,
);
- switch (host.getExternalExecutor(&target_info, .{
+ switch (getExternalExecutor(host, &target, .{
.link_libc = code.link_libc,
})) {
.native => {},