Closed marler8997 closed 2 days ago
My issue about that was closed so I don't think it will be merged #120
All URLs within build.zig.zon files must point to archives that never change
That sounds like a reasonable requirement, but I can't find it in official Zig documentation. If you can point me to it I'll gladly merge this.
It turns out this works and adds latest commit hash in build.zig.zon. So no need to manually get hash from github
zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
.@"raylib-zig" = .{
.url = "git+https://github.com/Not-Nik/raylib-zig?ref=devel#58df62807f62bef1db79538d04b37b9f79909d0a",
.hash = "1220df9aa89d657f5dca24ab0ac3d187f7a992a4d27461fd9e76e934bf0670ca9a90",
},
That definitely seems like a better solution than what this PR proposes, however, I'm still not entirely convinced.
That definitely seems like a better solution than what this PR proposes, however, I'm still not entirely convinced.
I'm also not entirely convinced. Just saw it on kristoff_it's stream
I've created PR to update the ziglang docs here: https://github.com/ziglang/zig/pull/21120
zig fetch --save https://github.com/Not-Nik/raylib-zig/archive/devel.tar.gz
has the problem that the Zig build system can't know that it is a moving target, so the URL gets copied verbatim into the build.zig.zon file and matched with the hash that results from the download at the time. This always works first time, but then if somebody else (or just CI) clones the project and has to download all dependencies from scratch, they will get an error when the tar archive results to a different hash.
zig fetch --save git+https://github.com/Not-Nik/raylib-zig#devel
works because the devel
ref gets first resolved to a commit and then written in the zon file after that. So once added it will always reference the same commit, which guarantees reproducibility. If after a while you want to update to latest devel, all you need to do is run the zig fetch command again, as that will update the contents of the zon file accordingly.
Thanks @kristoff-it that's a cool trick. I've updated the PR to use it. The user no longer needs to resolve the branch to a SHA themselves, now zig does it for them.
If accepted, github link style should also be changed in project_setup scripts
I'm not too proficient in PowerShell scripts and I don't have a Windows machine available right now. Let's hope this works.
Hello, is this PR going to be merged? Is there anything else that needs to be done?
I was waiting on ziglang/zig#21120, but honestly, the wording is barely a suggestion anymore, so it doesn't really make a difference.
All URLs within build.zig.zon files must point to archives that never change. However, the zig fetch command in the README.md adds a URL that points to the
devel
git branch whose content changes whenever thedevel
branch is updated.I've updated the README to instruct users to first pick a git SHA to reference if they want to add this project to their build.zig.zon file, then use that sha in their URL.