Skip to content

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

Closed

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.

Activity

  1. added
    bug
    on Sep 13, 2023
  2. mlugg commented on Sep 13, 2023

    @mlugg
    Member

    Is this an intentional design decision?

    No. (so Q2 not relevant)

    Are you sure you're not just hitting the actual bug which ended up existing in #16354?

  3. added 4 commits that reference this issue on Sep 15, 2023
    8bb5473
    7f616d9
    bdcbbd3
    7757da7
  4. added a commit that references this issue on Sep 15, 2023
    94529ff
  5. added this to the 0.12.0 milestone on Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions