Dev dependencies

Is there a notion of dev dependencies?

I have a library which has a small main.zig in order to test it. This main.zig needs a dependency to build but I don’t want users of my library to depend on that transitively.

Is there a way?

You can use a lazy dependency. Use b.lazyDependency in your build script and set .lazy = true in the build.zig.zon.

Then the dependency should only get loaded if you actually run the a build step that needs it.

11 Likes