build: retry when nested lazy dependency causes missing artifact#20051
Open
bfredl wants to merge 1 commit intoziglang:masterfrom
Open
build: retry when nested lazy dependency causes missing artifact#20051bfredl wants to merge 1 commit intoziglang:masterfrom
bfredl wants to merge 1 commit intoziglang:masterfrom
Conversation
3ed1c52 to
d1bf035
Compare
Member
|
Are you sure this is right? In build_runner.zig I see that it prints the lazy dependencies to stdout before exiting with code 3. |
Consider root build.zig having a mandatory dependency on package A which
in turns has a lazy dependency on package B.
When the root build.zig calls
const artifact = dep_a.artifact("a_artifact");
This might cause an error, as package B needs to be fetched before the
artifact can be built. However, the hard panic in Dependency.artifact()
is seen as a fatal error which _prevents_ the parent `zig build` process
from fetching missing dependencies and trying once more.
Handle this more gracefully by checking if we already know there were
missing lazy dependencies, which might come from package A. In the case
we still reach a fixed point with a missing artifact, panic as before.
bfredl
added a commit
to bfredl/lazy_test
that referenced
this pull request
Jan 18, 2025
bfredl
added a commit
to bfredl/lazy_test
that referenced
this pull request
Jan 18, 2025
Contributor
Author
|
The original reproduce doesn't work anymore as ziglua currently doesn't use lazyDependencies (although it wants to again eventually). So I created a minimal one here https://github.com/bfredl/lazy_test And yes, you are right this doesn't work (anymore or maybe it never did). Spontaneously, this seems to me like something that should be modeled by an error which can be propagated upwards, cleanly. Something like: The price would be that any use of |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consider root build.zig having a mandatory dependency on package A which in turns has a lazy dependency on package B.
When the root build.zig calls
This might cause an error, as package B needs to be fetched before the artifact in A can be built. However, the hard panic in Dependency.artifact() is seen as a fatal error which prevents the parent
zig buildprocess from fetching missing dependencies and trying once more.Handle this more gracefully by checking if we already know there were missing lazy dependencies, which might come from package A. In the case we still reach a fixed point with a missing artifact, panic as before.
For reference, this happened when depending upon https://github.com/natecraddock/ziglua/blob/486f51d3acc61d805783f5f07aee34c75ab59a25/build.zig and using the
ziglua.artifact("lua")artifact before its lazy dependencies were fetched.