Skip to content

use case: ability to declare dependency on single file #17895

Description

@techatrix

ZLS depends on Zig's langref.html.in file to extract the set of a builtin function.
Right now, this file is being manually downloaded during the build phase which does not integrate well with Zig's package manager and caching system. GitHub can't provide that file as a compressed tarball and fetching the entire repository source code is too wasteful.

It would be nice if there was a way to declare it as dependency to build.zig.zon:

    .dependencies = .{
        .langref = .{
            .url = "https://raw.githubusercontent.com/ziglang/zig/5b2ee5eacc177873ce674a307a1bebdfffeeae10/doc/langref.html.in",
            // have some option here to tell Zig that the url points to a single file and does not need to be decompressed
            .hash = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
        },
    },

Activity

  1. added
    proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.
    zig build systemstd.Build, the build runner, `zig build` subcommand, package management
    use caseDescribes a real use case that is difficult or impossible, but does not propose a solution.
    on Nov 6, 2023
  2. added this to the 0.13.0 milestone on Nov 6, 2023
  3. marler8997 commented on Jun 29, 2024

    @marler8997
    Contributor

    Here's another use case I discovered today. I'm adding a build.zig file to build VVVVVV, and it has a data.zip you can download with free assets and levels. I added the data.zip to build.zig.zon, but the game actually needs the zip file, not the extracted contents. To solve this I "re-zip" the contents and install them to the bin directory for the game to load, however, if there was a way to instead download the zip file as just a "file", this would remove some unnecessary steps.

  4. added
    acceptedThis proposal is planned.
    and removed
    use caseDescribes a real use case that is difficult or impossible, but does not propose a solution.
    on Sep 15, 2024
  5. andrewrk commented on Sep 15, 2024

    @andrewrk
    Member

    This seems like it would be fully solved with .unpack = false, yeah?

  6. modified the milestones: 0.14.0, 0.15.0 on Sep 15, 2024
  7. added
    contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.
    on Sep 15, 2024
  8. marler8997 commented on Nov 20, 2024

    @marler8997
    Contributor

    I think I'll put together a PR for this imminently as I now have a real need for it, unsupported archive formats. With the ability to disable unpacking an archive, this unlocks the ability to download an archive in any format. It can then be extracted via another dependency.

    More specifically, I'm converting my win32metdata to JSON converter from C# to zig and the metadata itself is a nuget package. With this "unpack" option I can just download the nupkg file and extract it with my own extraction tool.

  9. added 3 commits that reference this issue on Nov 21, 2024
    e78fd71
    73c1251
    df5f821
  10. 9 remaining items

  11. added a commit that references this issue on Nov 22, 2024
    6e953cf
  12. added 3 commits that reference this issue on Feb 24, 2025
    c7816a9
    8ee494f
    7d60290
  13. added 6 commits that reference this issue on Jul 6, 2025
    9d57e24
    6e3a76d
    ca78b60
    edaf036
    487bc1c
    105dd31
  14. added
    enhancementSolving this issue will likely involve adding new logic or components to the codebase.
    and removed
    proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.
    acceptedThis proposal is planned.
    on Apr 22, 2026
  15. linusg commented on Apr 23, 2026

    @linusg
    Collaborator
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

    contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions