Commit 01aab9f6b3

Andrew Kelley <andrew@ziglang.org>
2024-10-10 23:19:04
std.Build.Step.CheckObject: display source file path
and upgrade to getPath3
1 parent 101d21a
Changed files (1)
lib
std
Build
lib/std/Build/Step/CheckObject.zig
@@ -557,15 +557,15 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void {
     const check_object: *CheckObject = @fieldParentPtr("step", step);
     try step.singleUnchangingWatchInput(check_object.source);
 
-    const src_path = check_object.source.getPath2(b, step);
-    const contents = fs.cwd().readFileAllocOptions(
+    const src_path = check_object.source.getPath3(b, step);
+    const contents = src_path.root_dir.handle.readFileAllocOptions(
         gpa,
-        src_path,
+        src_path.sub_path,
         check_object.max_bytes,
         null,
         @alignOf(u64),
         null,
-    ) catch |err| return step.fail("unable to read '{s}': {s}", .{ src_path, @errorName(err) });
+    ) catch |err| return step.fail("unable to read '{'}': {s}", .{ src_path, @errorName(err) });
 
     var vars = std.StringHashMap(u64).init(gpa);
     for (check_object.checks.items) |chk| {
@@ -640,8 +640,13 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void {
                             \\{s}
                             \\========= but parsed file does not contain it: =======
                             \\{s}
-                            \\======================================================
-                        , .{ fmtMessageString(chk.kind, act.phrase.resolve(b, step)), fmtMessageString(chk.kind, output) });
+                            \\========= file path: =================================
+                            \\{}
+                        , .{
+                            fmtMessageString(chk.kind, act.phrase.resolve(b, step)),
+                            fmtMessageString(chk.kind, output),
+                            src_path,
+                        });
                     }
                 },
 
@@ -655,8 +660,13 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void {
                             \\*{s}*
                             \\========= but parsed file does not contain it: =======
                             \\{s}
-                            \\======================================================
-                        , .{ fmtMessageString(chk.kind, act.phrase.resolve(b, step)), fmtMessageString(chk.kind, output) });
+                            \\========= file path: =================================
+                            \\{}
+                        , .{
+                            fmtMessageString(chk.kind, act.phrase.resolve(b, step)),
+                            fmtMessageString(chk.kind, output),
+                            src_path,
+                        });
                     }
                 },
 
@@ -669,8 +679,13 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void {
                             \\{s}
                             \\========= but parsed file does contain it: ========
                             \\{s}
-                            \\===================================================
-                        , .{ fmtMessageString(chk.kind, act.phrase.resolve(b, step)), fmtMessageString(chk.kind, output) });
+                            \\========= file path: ==============================
+                            \\{}
+                        , .{
+                            fmtMessageString(chk.kind, act.phrase.resolve(b, step)),
+                            fmtMessageString(chk.kind, output),
+                            src_path,
+                        });
                     }
                 },
 
@@ -684,8 +699,13 @@ fn make(step: *Step, make_options: Step.MakeOptions) !void {
                             \\{s}
                             \\========= but parsed file does not contain it: =======
                             \\{s}
-                            \\======================================================
-                        , .{ act.phrase.resolve(b, step), fmtMessageString(chk.kind, output) });
+                            \\========= file path: ==============================
+                            \\{}
+                        , .{
+                            act.phrase.resolve(b, step),
+                            fmtMessageString(chk.kind, output),
+                            src_path,
+                        });
                     }
                 },