From 6115cf22404467fd13d0290fc022d51d372d139a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 4 Oct 2021 23:47:27 -0700 Subject: migrate from `std.Target.current` to `@import("builtin").target` closes #9388 closes #9321 --- src/Cache.zig | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Cache.zig') diff --git a/src/Cache.zig b/src/Cache.zig index 8a3b801e71..7d3bfdc3f2 100644 --- a/src/Cache.zig +++ b/src/Cache.zig @@ -4,6 +4,7 @@ hash: HashHelper = .{}, const Cache = @This(); const std = @import("std"); +const builtin = @import("builtin"); const crypto = std.crypto; const fs = std.fs; const assert = std.debug.assert; @@ -713,7 +714,7 @@ pub const Manifest = struct { /// uses the file contents. Windows supports symlinks but only with elevated privileges, so /// it is treated as not supporting symlinks. pub fn readSmallFile(dir: fs.Dir, sub_path: []const u8, buffer: []u8) ![]u8 { - if (std.Target.current.os.tag == .windows) { + if (builtin.os.tag == .windows) { return dir.readFile(sub_path, buffer); } else { return dir.readLink(sub_path, buffer); @@ -726,7 +727,7 @@ pub fn readSmallFile(dir: fs.Dir, sub_path: []const u8, buffer: []u8) ![]u8 { /// `data` must be a valid UTF-8 encoded file path and 255 bytes or fewer. pub fn writeSmallFile(dir: fs.Dir, sub_path: []const u8, data: []const u8) !void { assert(data.len <= 255); - if (std.Target.current.os.tag == .windows) { + if (builtin.os.tag == .windows) { return dir.writeFile(sub_path, data); } else { return dir.symLink(data, sub_path, .{}); @@ -778,7 +779,7 @@ fn isProblematicTimestamp(fs_clock: i128) bool { } test "cache file and then recall it" { - if (std.Target.current.os.tag == .wasi) { + if (builtin.os.tag == .wasi) { // https://github.com/ziglang/zig/issues/5437 return error.SkipZigTest; } @@ -856,7 +857,7 @@ test "give nonproblematic timestamp" { } test "check that changing a file makes cache fail" { - if (std.Target.current.os.tag == .wasi) { + if (builtin.os.tag == .wasi) { // https://github.com/ziglang/zig/issues/5437 return error.SkipZigTest; } @@ -932,7 +933,7 @@ test "check that changing a file makes cache fail" { } test "no file inputs" { - if (std.Target.current.os.tag == .wasi) { + if (builtin.os.tag == .wasi) { // https://github.com/ziglang/zig/issues/5437 return error.SkipZigTest; } @@ -977,7 +978,7 @@ test "no file inputs" { } test "Manifest with files added after initial hash work" { - if (std.Target.current.os.tag == .wasi) { + if (builtin.os.tag == .wasi) { // https://github.com/ziglang/zig/issues/5437 return error.SkipZigTest; } -- cgit v1.2.3