Is there some documentation or easy to read examples for how to integrate custom build steps better? I'd like it to show time taken + the MaxRSS for my step same as the others, but reading the source code i cant figure out why its not doing so, and my "process images" step can get quite long with a lot of images, so id like to be able to take advantage of the cache, tried searching the discord for keywords and couldnt find much
#How to use cache in custom build step
1 messages · Page 1 of 1 (latest)
https://github.com/Beyley/ztyping/commit/0e8b0a03d195308dfb9cbcb92a16edb6f6616a45
turns out i need to set the timestamps myself, but this is my current temp solution to caching
ideally i would use the proper Cache abstraction thing, but hardcoding it seems to work
I took a similar approach (just yolo-jamming my own folder into zig-cache) for my generated shader data package (via sokol-shdc).
One thing I did find is you can use std.Build.cache_root, which is a Cache.Directory, which has a helpful join method on it. I'm anticipating possibly doing a little more zig source generation, so I decided to claim the "zig-cache/gen" folder, so the path where I put my generated shader data package is b.cache_root.join(b.allocator, &[_][]const u8 { "gen", "shaders" }) catch unreachable.
Then at least if somebody changes the cache root with a flag or something, code can adapt. Otherwise, still fundamentally the same thing--you and I are in the same "well I'm sure there's a proper way...but this works for now" headspace 😅
I hadn't deduced how the timestamping stuff was intended to be used yet though, so thank you for posting your commit 🙂
yeah timestamp seems to just be a "you set it yourself" so i did a simple "start then defer end" to wrap the whole function timeline
and it seems to work
i THINK you can do the MaxRSS thing by creating an ArenaAllocator and using stats from that(?) but i havent gotten around to it