Skip to content

ability to declare package development dependencies #14591

Closed as not planned
Closed as not planned
@dweiller

Description

@dweiller

This is a competing proposal to #14597.

Currently in a build.zig.zon file you can declare dependencies for a project, which will be fetched transitively by dependees. Various projects might have dependencies that are only required by developers of the project itself and not for any exported artifacts (modules, executables, libraries, ...); an example could be benchmarking or testing tools. In this case dependees of the package have no need to fetch these development dependencies and they should be declare separately or have an extra flag indicating this.

For example build.zig.zon file of a package could look like:

.{
    .name = "optimised-package",
    .version = "1.0.0",

    .dependencies = .{
        .some_pkg = .{
            .url = "https://some.forge/some_pkg.tar.gz",
            .hash = "asdfasdf0",
        },
    },
    .dev_dependencies = .{
        .benchmarking = .{
            .url = "https://some.forge/benchmarking.tar.gz",
            .hash = "asdfasdf1",
        },
        .fuzz_tools = .{
            .url = "https://some.forge/fuzz_tools.tar.gz",
            .hash = "asdfasdf2",
    },
}

Alternately, this could be expressed as:

.{
    .name = "optimised-package",
    .version = "1.0.0",

    .dependencies = .{
        .some_pkg = .{
            .url = "https://some.forge/some_pkg.tar.gz",
            .hash = "asdfasdf0",
        },
        .benchmarking = .{
            .url = "https://some.forge/benchmarking.tar.gz",
            .hash = "asdfasdf1",
            .devel_only = true,
        },
        .fuzz_tools = .{
            .url = "https://some.forge/fuzz_tools.tar.gz",
            .hash = "asdfasdf2",
            .devel_only = true,
    },
}

Then these development dependencies can be skipped by the build runner of a dependee.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    Status

    Proposals

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions