The official asdf-zig
can only support what versions are listed at https://ziglang.org/download/index.json
, which are all versions either official or cutting-edge master. But as we know zig
is evolving fast, sometime I need to stick with a specific version for a while, like 0.12.0-dev.2139+e025ad7b4
. This is easy job if just download it and make it available to my path. But if there are multiple projects using different custom zig version, manual changing will be tedious.
So I start to miss asdf
, the one shop for managing many different new language runtimes, and luckily there is asdf-zig
, but unluckily it supports no custom versions.
So I just make my fork and adjust it a bit for my usage.
essentially my fork replaces the official asdf-zig
. To install it, need to remove the old one, just
asdf plugin remove asdf-zig
asdf plugin add zig https://github.com/liyu1981/asdf-zig.git
will replace your version with mine :)
then create a custom version file like below in ~/.asdf/custom/zig
mkdir -p ~/.asdf/custom/zig
echo "{\"0.12.0-dev.2139+e025ad7b4\": {}}" > ~/.asdf/custom/zig/versions.json
and after that you will find your custom version is available in asdf
commands. See this demo video for how I use it in life
currently it is just naive :)
{
"0.12.0-dev.2139+e025ad7b4": {},
"0.12.0-dev.1828+225fe6ddb": {},
"<more zig dev versions>": {}
}
you get the idea, only the key
part is relevant, the value
part is not, so I just keep a simple '{}' to fool the underlying json parser (from original asdf-zig
).
commit a789504
added this feature! just do asdf list-all zig
and asdf install zig <version>
, like follows
I hope this helps!
Zig plugin for asdf version manager
asdf plugin-add zig https://github.com/asdf-community/asdf-zig.git
Check asdf readme for instructions on how to install & manage versions.
Licensed under the Apache License, Version 2.0.