#examples of multi package repositories

1 messages · Page 1 of 1 (latest)

cloud rain
#

What are some examples of multi package zig GitHub repos?

I’m looking to learn what the zig analog to rusts cargo workspaces looks like and if there is a way introspect over all lib and exe artifacts.

fast thicket
#

The general recommendation is "don't do that"

#

You should use multiple modules in one package instead

#

Though its build.zig is quite big, and does some odd things that are planned to be changed (specifically the App and CoreApp structs)

fast thicket
cloud rain
#

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.

fast thicket
#

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

cloud rain
#

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

That one weird Rust trick that makes your users sad

GitHub

zig game engine & graphics toolkit. Contribute to hexops/mach development by creating an account on GitHub.