I was messing around with the build system, and made an Advent of Code solution printer that lives entirely inside of a build.zig. Maybe not really the intended use of the build system, but I had fun making this template.
Put it in a directory like this:
input/
YYYY/
day01.txt
day02.txt
YYYY/
day_01.zig
day_02.zig
build.zig
In each day_DD.zig you define functions part1([]u8) and part2([]u8), that take a mutable or constant slice of u8, and can return anything printable with {s}, {any}, or {f}, including error unions, which either print their error or the inner value.
$ zig build solve -Dday=..4
[01/1] (43.3 µs) foo
I am stderr print from within Day 1 Part 2
[01/2] failed: Overflow
[02/1] (26.361 ms) 27
...
[03/2] (1.652 ms) bar
Total elapsed solution time: 104.833 ms (excluding 1 failure)
I wanted to make it as thoughtless as possible to jump into puzzle exercises and ended up with this. You only have to write your own solution code inside of each day_DD.zig, and it all runs as a single build step. I hope someone finds it useful!