zig icon indicating copy to clipboard operation
zig copied to clipboard

`std.Build.Step.Fmt` handles paths incorrectly

Open mlugg opened this issue 11 months ago • 1 comments

std.Build.Step.Fmt takes a []const []const u8 to represents its paths. They are interpreted as relative to the step's owner Build's build root.

This is inappropriate. They should likely be relative to a user-provided "root" LazyPath, like how std.Build.Module.addCSourceFiles takes its list of file paths.

This would eliminate the last calls to std.Build.pathFromRoot outside of lib/std/Build.zig, allowing us to mark it as non-pub. That's a good idea; build scripts should work in LazyPaths, and Step.make implementations should resolve those LazyPaths to strings with the provided methods.

Fixing this will require a breaking change to std.Build.Step.Fmt.

mlugg avatar May 22 '25 02:05 mlugg

Vaguely related: #23359

alexrp avatar May 22 '25 02:05 alexrp