diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-02-02 14:42:29 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-02-02 20:43:01 -0700 |
| commit | 252f4ab2a509c5b8b2e570f4a0de6cb706dd9588 (patch) | |
| tree | e195a777f8c28b81041d925495d66ffa4dad680a /src/Compilation.zig | |
| parent | 434a6a4f633f3f9b29bd80f4089e8f403aab4f9b (diff) | |
| download | zig-252f4ab2a509c5b8b2e570f4a0de6cb706dd9588.tar.gz zig-252f4ab2a509c5b8b2e570f4a0de6cb706dd9588.zip | |
build system: implement lazy dependencies, part 1
Build manifest files support `lazy: true` for dependency sections.
This causes the auto-generated dependencies.zig to have 2 more
possibilities:
1. It communicates whether a dependency is lazy or not.
2. The dependency might be acknowledged, but missing due to being lazy
and not fetched.
Lazy dependencies are not fetched by default, but if they are already
fetched then they are provided to the build script.
The build runner reports the set of missing lazy dependenices that are
required to the parent process via stdout and indicates the situation
with exit code 3.
std.Build now has a `lazyDependency` function. I'll let the doc comments
speak for themselves:
When this function is called, it means that the current build does, in
fact, require this dependency. If the dependency is already fetched, it
proceeds in the same manner as `dependency`. However if the dependency
was not fetched, then when the build script is finished running, the
build will not proceed to the make phase. Instead, the parent process
will additionally fetch all the lazy dependencies that were actually
required by running the build script, rebuild the build script, and then
run it again.
In other words, if this function returns `null` it means that the only
purpose of completing the configure phase is to find out all the other
lazy dependencies that are also required.
It is allowed to use this function for non-lazy dependencies, in which
case it will never return `null`. This allows toggling laziness via
build.zig.zon without changing build.zig logic.
The CLI for `zig build` detects this situation, but the logic for then
redoing the build process with these extra dependencies fetched is not
yet implemented.
Diffstat (limited to 'src/Compilation.zig')
0 files changed, 0 insertions, 0 deletions
