#examples of multi package repositories
1 messages · Page 1 of 1 (latest)
The general recommendation is "don't do that"
You should use multiple modules in one package instead
For the latter, mach is a good example: https://github.com/hexops/mach/
Though its build.zig is quite big, and does some odd things that are planned to be changed (specifically the App and CoreApp structs)
If you share more about your usecase I can provide some more specific advice :)
I’m just curious and also thinking about what kinds of tooling could be build on top of the defaults.
The cargo ecosystem has a notion of plugins and these plugins typically operate on declarative form of build metadata.
Zig has a basic build.zig.zon files but I haven’t seen anything but examples of simple single package (my terminology may be off here) projects.
I’ll take a look at Mach. Thanks!
I’m looking more for prescribed conventions than per projects specifics if it helps.
You can get info about all defined modules and installed artifacts from b.modules and b.install_tls.step.dependencies.items respectively
A "plugin" in Zig probably wouldn't operate on that though
You can import dependencies' build.zigs from your own build.zig, so a "plugin" would simply expose a function in its build.zig that you can call with whatever info it needs
https://github.com/hexops/mach/blob/279290bbf2f1adab0af00323280a07d6bfff47a5/build.zig#L156 is kind of a good example. I’m just making mental mappings where mental mappings might exist. I think what’s going on in this build.zig file is roughly analogous to what’s being explained in this post about single package cargo builds but with feature flags https://blog.axo.dev/2024/03/its-a-lib-and-a-bin