Is it possible to require a specific version of zig in my build script?
Here is the concrete use case:
In industrial controls, a project is finished and shipped to the customer, not touched for a long time, and then small changes are required, and the cycle repeats. It would perhaps be beneficial to enforce the version of the compiler used as part of the build system so I would not have to remember to read it from the README. The best documentation is code right
I want to note that itās also possible to provide build-specific steps based on the Zig version, and even gate logic within the package based on it, since builtin is available there as well.
Iāve found that pretty useful for minor differences between 0.13 and the master branch, although if the Type enum tag is involved, Iāve just given up and picked a lane. It wouldnāt be impossible even there, but the amount of comptime magic involved gets pretty gnarly.
With 0.14 around the corner, you might find that useful or even essential for supporting the longer deploy cycle in embedded contexts, while handling the fact that Zig tends to move quickly, and most users are going to update to the next release version accordingly.
Slightly off-topic, but Iāll just mention that shimming @typeInfo and std.builtin.Type isnāt that crazy difficult. @InKryption suggested the following to me and it has let me painlessly support both 0.13.0 and 0.14.0-dev just by replacing uses of @typeInfo with shims.typeInfo:
(Itās missing @Type because my project didnāt need it, but would more or less just be the inverse of the switch in the @typeInfo shim.)