-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
ability to depend on pure zig modules without running any build.zig logic #14282
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This 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 managementstd.Build, the build runner, `zig build` subcommand, package management
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
enhancementSolving this issue will likely involve adding new logic or components to the codebase.Solving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests language modifications. If it also has the "accepted" label then it is planned.This 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 managementstd.Build, the build runner, `zig build` subcommand, package management
Type
Projects
- StatusShow more project fieldsProposals
Extracted from #14265.
Terminology clarification: #14307
For many zig modules, advanced build system features are not needed, such as generating source files, compiling C code, or accepting build options. In such cases, build.zig is overkill. All that is really needed is the .zig source files to be available to the project which has the dependency on this one.
For this I propose the package to be organized like this:
Meanwhile the package depending on it will do something like this:
build.zig.zon
.{ .name = "clap", .url = "...", .hash = "...", }build.zig
Note that this allows a project to add a dependency based on any arbitrary directory of files without the dependee being aware of it being used that way.
When a module is added this way, no build.zig logic is executed. Note that this could be problematic, such as in the case of a dependency introducing a new generated file as part of their package, or adding build options. To future-proof against this situation, instead of
addModuleFromDependencyPath, build scripts should useb.dependency()which will execute the dependency's build logic.See #14278 for depending on zig packages while respecting build.zig logic.
See #14286 for running build.zig logic in a sandbox.