Based on:
It seems like there are a lot of people (@gonzo @Luke @ngrilly) who want some way to have minimal little files, that can use some set of dependencies and be run with dependencies automatically hooked up to them.
When running zig build --help
these options seem interesting:
Advanced Options:
--build-file [file] Override path to build.zig
--build-runner [file] Override path to build runner
I wonder whether it would be possible to write some custom build-runner, that extracts dependencies from a comment at the start of the file, fetches them, configures them as imports and then compiles the file as an executable.
I am currently busy with other stuff, but maybe somebody wants to explore that idea and see whether it is possible? I think I will explore that idea eventually, but it could take a while.
Or maybe some variant of zig run
, that can extract dependencies from a build.zig.zon
that is embedded in a comment at the beginning of the file?
Imagining something like zig run --allow-fetch script.zig