Question is it possible to reference a private repo in the build.zig.zon file?
Currently I am getting 404 unless I make the repo public.
I am using the latest build of zig.
Question is it possible to reference a private repo in the build.zig.zon file?
Currently I am getting 404 unless I make the repo public.
I am using the latest build of zig.
No, at least not at the moment.
Maybe a bit late and not with perfect solutions, but you can try with:
a git submodule (or a simple project subfolder) and add the library in build.zig.zon:
.dependencies = .{
.ztester = .{
.path = "external/private_repo",
},
},
or, make a local archive with your code and:
.dependencies = .{
.ztester = .{
.url = "file:///home/some_path/project/archives/private_repo.tar.gz",
.hash = "some_hash",
},
},
or, make an archive, store it in your email drive and:
.dependencies = .{
.ztester = .{
.url = "https:///some_path/archives/private_repo.tar.gz",
.hash = "some_hash",
},
},
More or less these are “testing” solutions, not very suitable for production.
I think this feature isn’t implemented yet. I’m working with v0.15.2, I know v0.16.0 was recently released. I need to check if there is a solution to import a private repo from a remote Git server.
At the moment, cloning the repo into my project and referencing it locally is a solution. Thinking about a release pipeline, something like cloning locally and building using references from the main project (which already has the dependency paths configured) could work, nothing serious, but if someone has a better approach for handling this in a CI/CD pipeline without hacking paths, that would be great.
I haven’t used any external packages in any of my Zig projects yet but if I did have a need for a private repository package, I would probably use the new --fork flag that 0.16.0 has and just reference it locally. That way I could generate a fingerprint for the package and have it be slightly more integrated into the build system than if I didn’t use --fork. Not the most convenient but not a blocker either.
Thank you! I’ll try it
Thanks! I’ll check the --fork flag, I think I found it here: 0.16.0 Release Notes ⚡ The Zig Programming Language