Skip to content

package manager: transitive dependencies must be listed in the top-level build.zig.zon is painful #17135

@emidoots

Description

@emidoots

Zig Version

0.12.0-dev.21+ac95cfe44

Steps to Reproduce and Observed Behavior

Use any package that has transitive dependencies via the package manager.


Mach, mach-core, and mach-glfw all have a handful or two of dependencies. They're logical bits of code that we've extracted into independent Zig packages, actually useful on their own, not an npm-encroaching situation. This should be good for us and the ecosystem as a whole.

But today when users import e.g. mach-glfw via the package manager following our guide, we have to tell them to make sure they meticulously copy all the dependencies from our build.zig.zon file into their own, and keep those up-to-date / correct with what we expect. This is because the Zig package manager today requires all transitive dependencies be specified in the build.zig.zon file.

Whether this is an intentional design decision or not is unclear to me.

But it is very tedious, error prone, and annoying for our users to have to manually copy this informationn over to their own build.zig.zon file. I am regularly seeing 1-3 people per week file issues and ask questions that ultimately boil down to 'I copied the dependencies wrong' or 'I didn't know I had to copy them'. We've added docs around this, created starter projects, etc. to try and reduce the annoyance on our side - but it's still painful overall for our users.

This issue is two questions:

  1. Is this an intentional design decision, intended to e.g. encourage less dependencies?
  2. Is an easier way to add transitive dependencies to your build.zig.zon in scope?

Without at least #2 solved, I think many package authors will be encouraged to reduce dependencies not by actually having less of them.. but rather by 'shoving multiple dependencies into one' and pretending it's one

Expected Behavior

1 & 2 above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions