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* WriteFile step failing when making langref
12* double check when targets get resolved (should be at configure time)
2* pass overridden pkg-dir to maker
33* finish migrating the rest of the build steps
4* pass overridden pkg-dir to maker
45* inspect b4ffb402c082605c4b324e88120306fc8fb3cf32 diff and apply changes as needed (merge conflict)
56* make zig-pkg path root configurable in maker (make sure --system still works)
67* eliminate calls to getPath, getPath2, getPath3
78* test lazyImport
8* solve the TODOs added in this branch
99* get zig tests passing
10* solve the TODOs added in this branch
1011* test a bunch of third party projects / help people migrate
1112 * tetris
1213
13* get the target from the parent process instead
1414* [handle missing cache hits when chaining two run steps](https://codeberg.org/ziglang/zig/pulls/30762)
1515* [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
2118* implement {q} or delete {q} uses
2219* make the generated dependencies.zig be dependencies.zon and don't put absolute paths in there
......@@ -25,6 +22,10 @@
2522* re-evaluate https://codeberg.org/ziglang/zig/pulls/35224
2623
2724## 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
2829* stop leaking into global process arena
2930* reduce the size of Maker.Step.Extended (make Run smaller) probably by using an arena per make
3031* link_eh_frame_hdr should be DefaultingBool
......@@ -37,6 +38,7 @@
3738* UpdateSourceFiles: introduce Group
3839* WriteFiles: introduce Group
3940* 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
4143## Already Filed Followup Issues
4244* build system fmt step with check=false does not acquire a write lock on source files #35204
......@@ -84,6 +86,8 @@ closes #31397
8486* `b.build_root` (Directory) -> `b.root` (Path)
8587* `ConfigHeader.Options`: `include_guard_override` -> `include_guard`
8688* `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
8892### Perf Data Point: `zig build -h` (cached)
8993
lib/std/Build.zig+2-5
......@@ -2332,14 +2332,11 @@ pub const LazyPath = union(enum) {
23322332 }
23332333 }
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 {
23362336 return fs.path.basename(switch (lazy_path) {
23372337 .src_path => |sp| sp.sub_path,
23382338 .cwd_relative => |sub_path| sub_path,
2339 .generated => |gen| if (gen.sub_path.len > 0)
2340 gen.sub_path
2341 else
2342 gen.file.getPath2(src_builder, asking_step),
2339 .generated => |gen| gen.sub_path,
23432340 .dependency => |dep| dep.sub_path,
23442341 });
23452342 }