authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-18 22:10:25-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:35-07:00
logeb80aa00608a6ada01b83cc7d8d4995c9636cfff
tree764893c066141046a37ae3e27a130f62f0212f71
parent6327741b73e00e08880b619ef4b10ad2a0a217d3

std.Build.LazyPath.basename: fix impl

* no more parameters * don't call getPath2, that was never valid to call in the configure phase...

2 files changed, 12 insertions(+), 11 deletions(-)

BRANCH_TODO+10-6
...@@ -1,22 +1,19 @@...@@ -1,22 +1,19 @@
1* WriteFile step failing when making langref
1* double check when targets get resolved (should be at configure time)2* double check when targets get resolved (should be at configure time)
2* pass overridden pkg-dir to maker
3* finish migrating the rest of the build steps3* finish migrating the rest of the build steps
4* pass overridden pkg-dir to maker
4* inspect b4ffb402c082605c4b324e88120306fc8fb3cf32 diff and apply changes as needed (merge conflict)5* inspect b4ffb402c082605c4b324e88120306fc8fb3cf32 diff and apply changes as needed (merge conflict)
5* make zig-pkg path root configurable in maker (make sure --system still works)6* make zig-pkg path root configurable in maker (make sure --system still works)
6* eliminate calls to getPath, getPath2, getPath37* eliminate calls to getPath, getPath2, getPath3
7* test lazyImport8* test lazyImport
8* solve the TODOs added in this branch
9* get zig tests passing9* get zig tests passing
10* solve the TODOs added in this branch
10* test a bunch of third party projects / help people migrate11* test a bunch of third party projects / help people migrate
11 * tetris12 * tetris
1213
13* get the target from the parent process instead
14* [handle missing cache hits when chaining two run steps](https://codeberg.org/ziglang/zig/pulls/30762)14* [handle missing cache hits when chaining two run steps](https://codeberg.org/ziglang/zig/pulls/30762)
15* [Absolute and cwd-relative paths in build cache](https://codeberg.org/ziglang/zig/issues/32097)15* [Absolute and cwd-relative paths in build cache](https://codeberg.org/ziglang/zig/issues/32097)
1616
17* make more stuff use IndexType
18* make addExtra return Index using reflection
19* refactor with DefaultingEnum
2017
21* implement {q} or delete {q} uses18* implement {q} or delete {q} uses
22* make the generated dependencies.zig be dependencies.zon and don't put absolute paths in there19* make the generated dependencies.zig be dependencies.zon and don't put absolute paths in there
...@@ -25,6 +22,10 @@...@@ -25,6 +22,10 @@
25* re-evaluate https://codeberg.org/ziglang/zig/pulls/3522422* re-evaluate https://codeberg.org/ziglang/zig/pulls/35224
2623
27## Followup Issues24## Followup Issues
25* make more stuff use IndexType
26* make addExtra return Index using reflection
27* refactor with DefaultingEnum
28* get the target from the parent process instead
28* stop leaking into global process arena29* stop leaking into global process arena
29* reduce the size of Maker.Step.Extended (make Run smaller) probably by using an arena per make30* reduce the size of Maker.Step.Extended (make Run smaller) probably by using an arena per make
30* link_eh_frame_hdr should be DefaultingBool31* link_eh_frame_hdr should be DefaultingBool
...@@ -37,6 +38,7 @@...@@ -37,6 +38,7 @@
37* UpdateSourceFiles: introduce Group38* UpdateSourceFiles: introduce Group
38* WriteFiles: introduce Group39* WriteFiles: introduce Group
39* re-examine the use case of adding file paths to Options steps40* re-examine the use case of adding file paths to Options steps
41* extract the reusable Configure abstractions and reuse it for Zir etc
4042
41## Already Filed Followup Issues43## Already Filed Followup Issues
42* build system fmt step with check=false does not acquire a write lock on source files #35204 44* build system fmt step with check=false does not acquire a write lock on source files #35204
...@@ -84,6 +86,8 @@ closes #31397...@@ -84,6 +86,8 @@ closes #31397
84* `b.build_root` (Directory) -> `b.root` (Path)86* `b.build_root` (Directory) -> `b.root` (Path)
85* `ConfigHeader.Options`: `include_guard_override` -> `include_guard`87* `ConfigHeader.Options`: `include_guard_override` -> `include_guard`
86* `LazyPath`: `getDisplayName` -> `format` or `fmt`88* `LazyPath`: `getDisplayName` -> `format` or `fmt`
89* `LazyPath.basename` no longer takes parameters. The returned basename might
90 be unknown until make phase in which case returned string is length zero.
8791
88### Perf Data Point: `zig build -h` (cached)92### Perf Data Point: `zig build -h` (cached)
8993
lib/std/Build.zig+2-5
...@@ -2332,14 +2332,11 @@ pub const LazyPath = union(enum) {...@@ -2332,14 +2332,11 @@ pub const LazyPath = union(enum) {
2332 }2332 }
2333 }2333 }
23342334
2335 pub fn basename(lazy_path: LazyPath, src_builder: *Build, asking_step: ?*Step) []const u8 {2335 pub fn basename(lazy_path: LazyPath) []const u8 {
2336 return fs.path.basename(switch (lazy_path) {2336 return fs.path.basename(switch (lazy_path) {
2337 .src_path => |sp| sp.sub_path,2337 .src_path => |sp| sp.sub_path,
2338 .cwd_relative => |sub_path| sub_path,2338 .cwd_relative => |sub_path| sub_path,
2339 .generated => |gen| if (gen.sub_path.len > 0)2339 .generated => |gen| gen.sub_path,
2340 gen.sub_path
2341 else
2342 gen.file.getPath2(src_builder, asking_step),
2343 .dependency => |dep| dep.sub_path,2340 .dependency => |dep| dep.sub_path,
2344 });2341 });
2345 }2342 }