(originally posted here: https://zig.news/liyu1981/asdf-to-manage-multiple-versions-of-zig-including-custom-dev-versions-47bi)
asdf is a good general tool version management tool. Just like virtualenv
for python
, or rvm
for Ruby
, or nvm
for nodejs
. It supports plugins so it can be used as a one tool to rule all languages thing. So I was attempted to use it to manage my local zig
version.
Then I found asdf-zig
from asdf-community/asdf-zig, and it works, and works great! Until that I found as zig
envolves fast, seems every important project is using their own specific dev version like 0.12.0-dev.2139+e025ad7b4
or 0.12.0-dev.1828+225fe6ddb
, they are unfortunately not supported by asdf-zig
.
But I do want to use this tool for managing my local zig
versions, so again, seems the code of asdf-zig
is simple enough, so I forked and created my own flavor, where I put it at https://github.com/liyu1981/asdf-zig.
Simply to say, it allows to create a custom version file at ~/.asdf/custom/zig/versions.json
like below
{
"0.12.0-dev.2139+e025ad7b4": {},
"0.12.0-dev.1828+225fe6ddb": {},
}
then normal asdf list-all zig
can show these versions and asdf install zig 0.12.0-dev.2139+e025ad7b4
can install it and then use it as it supports natively.
Following pictures shows how it is used
{% embed https://github.com/liyu1981/asdf-zig %}
Update:
added the ability to use zig master
version as @justinryanh commented.